public ExtendedLocationChoiceReRoutePlanStrategy(
      MatsimServices controler, Provider<TripRouter> tripRouterProvider) {

    Scenario scenario = controler.getScenario();
    TravelTime travelTimeCalc = controler.getLinkTravelTimes();

    planStrategyDelegate = new PlanStrategyImpl(new RandomPlanSelector());
    planStrategyDelegate.addStrategyModule(
        new ExtendedLocationChoicePlanModule(scenario, travelTimeCalc));
    planStrategyDelegate.addStrategyModule(new ReRoute(scenario, tripRouterProvider));
  }
  /**
   * Design thoughts:
   *
   * <ul>
   *   <li>At this point, my tendency is to not provide a default version here. Reason is that this
   *       would need to be based on the config to be consistent with what is done in the mobsim,
   *       router, and scoring builders. This, however, would obfuscate the strategy more than it
   *       would help. kai, sep'12
   */
  private StrategyManager createStrategyManager() {
    StrategyManager strategyManager = new StrategyManager();

    strategyManager.setPlanSelectorForRemoval(new WorstPlanForRemovalSelector());

    PlanStrategy strategy1 =
        new PlanStrategyImpl(new ExpBetaPlanChanger(this.config.planCalcScore().getBrainExpBeta()));
    strategyManager.addStrategyForDefaultSubpopulation(strategy1, 0.9);

    PlanStrategyImpl strategy2 =
        new PlanStrategyImpl(new ExpBetaPlanSelector(this.config.planCalcScore()));
    strategy2.addStrategyModule(
        new AbstractMultithreadedModule(this.scenario.getConfig().global().getNumberOfThreads()) {
          @Override
          public PlanAlgorithm getPlanAlgoInstance() {
            return createRoutingAlgorithm();
          }
        });
    strategyManager.addStrategyForDefaultSubpopulation(strategy2, 0.1);

    return strategyManager;
  }
Esempio n. 3
0
  private StrategyManager myLoadStrategyManager() {
    SubSetStrategyManager manager = new SubSetStrategyManager();
    StrategyManagerConfigLoader.load(this, manager); // load defaults

    // load special groups
    {
      Set<Id> ids = ReadSingleTripPersons.readStopNameMap(singleTripPersonsFile);
      StrategyManager mgr = new StrategyManager();

      PlanStrategy strategy1 =
          new PlanStrategyImpl(new ExpBetaPlanSelector(this.getConfig().planCalcScore()));
      mgr.addStrategyForDefaultSubpopulation(strategy1, 0.9);

      PlanStrategyImpl strategy2 = new PlanStrategyImpl(new RandomPlanSelector());
      strategy2.addStrategyModule(new TripTimeAllocationMutator(this.getConfig(), 7200, true));
      strategy2.addStrategyModule(new ReRoute(getScenario()));
      mgr.addStrategyForDefaultSubpopulation(strategy2, 0.1);
      mgr.addChangeRequestForDefaultSubpopulation(90, strategy2, 0.0);

      manager.addSubset(ids, mgr);
    }
    return manager;
  }
 @Override
 public String toString() {
   return planStrategyDelegate.toString();
 }
 @Override
 public void run(HasPlansAndId<Plan, Person> person) {
   planStrategyDelegate.run(person);
 }
 @Override
 public void init(ReplanningContext replanningContext) {
   planStrategyDelegate.init(replanningContext);
 }
 public int getNumberOfStrategyModules() {
   return planStrategyDelegate.getNumberOfStrategyModules();
 }
 @Override
 public void finish() {
   planStrategyDelegate.finish();
 }
 public void addStrategyModule(PlanStrategyModule module) {
   planStrategyDelegate.addStrategyModule(module);
 }