@Override public ExpBetaPlanChanger<Plan, Person> get() { return new ExpBetaPlanChanger<>( - config.getBrainExpBeta()); } }
@Override public PlanStrategy get() { return new PlanStrategyImpl(new ExpBetaPlanChanger(config.getBrainExpBeta())); }
@Override protected ExpBetaPlanChanger getPlanSelector() { return new ExpBetaPlanChanger(2.0); }
strategyManager.setMaxPlansPerAgent(5); GenericPlanStrategyImpl<CarrierPlan, Carrier> strategy = new GenericPlanStrategyImpl<>(new ExpBetaPlanChanger<CarrierPlan, Carrier>(1.));
public LocationChoicePlanStrategy(Scenario scenario, Provider<TripRouter> tripRouterProvider) { this.tripRouterProvider = tripRouterProvider; if ( DestinationChoiceConfigGroup.Algotype.bestResponse==((DestinationChoiceConfigGroup)scenario.getConfig().getModule("locationchoice")).getAlgorithm() ) { throw new RuntimeException("best response location choice not supported as part of LocationChoicePlanStrategy. " + "Use BestReplyLocationChoicePlanStrategy instead, but be aware that as of now some Java coding is necessary to do that. kai, feb'13") ; } DestinationChoiceConfigGroup dccg = (DestinationChoiceConfigGroup) scenario.getConfig().getModule(DestinationChoiceConfigGroup.GROUP_NAME); String planSelector = dccg.getPlanSelector(); if (planSelector.equals("BestScore")) { delegate = new PlanStrategyImpl(new BestPlanSelector()); } else if (planSelector.equals("ChangeExpBeta")) { delegate = new PlanStrategyImpl(new ExpBetaPlanChanger(scenario.getConfig().planCalcScore().getBrainExpBeta())); } else if (planSelector.equals("SelectRandom")) { delegate = new PlanStrategyImpl(new RandomPlanSelector()); } else { delegate = new PlanStrategyImpl(new ExpBetaPlanSelector(scenario.getConfig().planCalcScore())); } delegate.addStrategyModule(new DestinationChoice(this.tripRouterProvider, scenario)); delegate.addStrategyModule(new ReRoute(scenario, tripRouterProvider)); }
@Override public void init(ReplanningContext replanningContext) { /* * Somehow this is ugly. Should be initialized in the constructor. But I do not know, how to initialize the lc scenario elements * such that they are already available at the time of constructing this object. ah feb'13 */ DestinationChoiceContext lcContext = (DestinationChoiceContext) scenario.getScenarioElement(DestinationChoiceContext.ELEMENT_NAME); Config config = lcContext.getScenario().getConfig(); DestinationChoiceConfigGroup dccg = (DestinationChoiceConfigGroup) config.getModule(DestinationChoiceConfigGroup.GROUP_NAME); MaxDCScoreWrapper maxDcScoreWrapper = (MaxDCScoreWrapper)scenario.getScenarioElement(MaxDCScoreWrapper.ELEMENT_NAME); if ( !DestinationChoiceConfigGroup.Algotype.bestResponse.equals(dccg.getAlgorithm())) { throw new RuntimeException("wrong class for selected location choice algorithm type; aborting ...") ; } String planSelector = dccg.getPlanSelector(); if (planSelector.equals("BestScore")) { delegate = new PlanStrategyImpl(new BestPlanSelector<Plan, Person>()); } else if (planSelector.equals("ChangeExpBeta")) { delegate = new PlanStrategyImpl(new ExpBetaPlanChanger(config.planCalcScore().getBrainExpBeta())); } else if (planSelector.equals("SelectRandom")) { delegate = new PlanStrategyImpl(new RandomPlanSelector()); } else { delegate = new PlanStrategyImpl(new ExpBetaPlanSelector(config.planCalcScore())); } delegate.addStrategyModule(new TripsToLegsModule(tripRouterProvider, config.global())); delegate.addStrategyModule(new BestReplyDestinationChoice(tripRouterProvider, lcContext, maxDcScoreWrapper.getPersonsMaxDCScoreUnscaled(), scoringFunctionFactory, travelTimes, travelDisutilities)); delegate.addStrategyModule(new ReRoute(lcContext.getScenario(), tripRouterProvider)); delegate.init(replanningContext); }