this.modules.put(FacilitiesConfigGroup.GROUP_NAME, this.facilities); this.strategy = new StrategyConfigGroup(); this.modules.put(StrategyConfigGroup.GROUP_NAME, this.strategy);
/** * Tests that only the known param-names are accepted, and no others. * * @author mrieser */ @Test public void testParamNames() { StrategyConfigGroup configGroup = new StrategyConfigGroup(); configGroup.addParam("maxAgentPlanMemorySize", "3"); configGroup.addParam("Module_1", "ReRoute"); configGroup.addParam("ModuleProbability_1", "0.5"); configGroup.addParam("ModuleDisableAfterIteration_1", "20"); try { configGroup.addParam("ModuleWrong_1", "should fail"); fail("Expected to get an IllegalArgumentException, but got none."); } catch (IllegalArgumentException e) { log.info("Catched IllegalArgumentException, as expected: " + e.getMessage()); } assertEquals("unexpected number of strategy settings", 1, configGroup .getStrategySettings().size()); }
public void testCheckConsistency() { StrategyConfigGroup configGroup = new StrategyConfigGroup(); configGroup.addParam("maxAgentPlanMemorySize", "3"); configGroup.addParam("Module_1", "ReRoute");
private StrategyConfigGroup createTestConfigGroup() { final StrategyConfigGroup group = new StrategyConfigGroup(); group.setExternalExeConfigTemplate( "bwark" ); group.setExternalExeTimeOut( 999 ); group.setExternalExeTmpFileRootDir( "some/random/location" ); group.setFractionOfIterationsToDisableInnovation( 8 ); group.setMaxAgentPlanMemorySize( 999999 ); group.setPlanSelectorForRemoval( "SelectSomeArbitraryPlan" ); /* scope of settings: minimal */ { final StrategySettings settings = new StrategySettings(); settings.setStrategyName( "MyModule" ); settings.setWeight( 10. ); group.addStrategySettings( settings ); } /* scope of settings: all options */ { final StrategySettings settings = new StrategySettings(); settings.setStrategyName( "YourModule" ); settings.setWeight( 0 ); settings.setDisableAfter( 10 ); settings.setExePath( "path/to/nowhere/" ); settings.setSubpopulation( "sushi_eaters" ); group.addStrategySettings( settings ); } return group; } }