/** * Adds a strategy to this manager with the specified weight. This weight * compared to the sum of weights of all strategies in this manager defines * the probability this strategy will be used for an agent. * */ public final void addStrategy( final PlanStrategy strategy, final String subpopulation, final double weight) { delegate.addStrategy(strategy, subpopulation, weight); }
private static CarrierPlanStrategyManagerFactory createStrategyManagerFactory(final CarrierVehicleTypes types, final MatsimServices controler) { return () -> { final GenericStrategyManager<CarrierPlan, Carrier> strategyManager = new GenericStrategyManager<>(); strategyManager.addStrategy(new GenericPlanStrategyImpl<>(new BestPlanSelector<>()), null, 0.95); strategyManager.addStrategy(new SelectBestPlanAndOptimizeItsVehicleRouteFactory(controler.getScenario().getNetwork(), types, controler.getLinkTravelTimes()).createStrategy(), null, 0.05); return strategyManager; }; }
strategyManager.addStrategy(strategy, null, 1.0); strategy.addStrategyModule(new TimeAllocationMutator()); strategy.addStrategyModule(new ReRouteVehicles(router, network, modeTravelTimes.get(TransportMode.car), 1.)); strategyManager.addStrategy(strategy, null, 0.5);