Exemplo n.º 1
0
  /**
   * 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;
  }
Exemplo n.º 2
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;
  }