コード例 #1
0
 public void run() {
   // yy move config reading into the c'tor.  Lock config there.  Force everybody who wants to
   // modify the config to
   // do this by loading it before the controler.
   // yy move events into the c'tor.  ... Similarly.
   // (Yet with this simplified controler you cannot get at the scenario or the events between ctor
   // and run,
   // so this is really of less importance here.  kai, sep'12)
   this.config.addConfigConsistencyChecker(new ConfigConsistencyCheckerImpl());
   ControlerUtils.checkConfigConsistencyAndWriteToLog(
       this.config, "Complete config dump after reading the config file:");
   this.setupOutputDirectory(
       config.controler().getOutputDirectory(),
       config.controler().getRunId(),
       OutputDirectoryHierarchy.OverwriteFileSetting.overwriteExistingFiles);
   this.network = this.scenario.getNetwork();
   this.population = this.scenario.getPopulation();
   this.events = EventsUtils.createEventsManager(config);
   // add a couple of useful event handlers:
   this.events.addHandler(new VolumesAnalyzer(3600, 24 * 3600 - 1, this.network));
   this.legTimes = new CalcLegTimes();
   this.events.addHandler(legTimes);
   this.travelTimeCalculator =
       TravelTimeCalculator.create(this.network, this.config.travelTimeCalculator());
   this.events.addHandler(travelTimeCalculator);
   super.run(config);
 }
コード例 #2
0
 @Override
 protected void prepareForSim() {
   ControlerUtils.checkConfigConsistencyAndWriteToLog(
       this.config, "Config dump before doIterations:");
   ParallelPersonAlgorithmRunner.run(
       this.population,
       this.config.global().getNumberOfThreads(),
       new ParallelPersonAlgorithmRunner.PersonAlgorithmProvider() {
         @Override
         public AbstractPersonAlgorithm getPersonAlgorithm() {
           return new PersonPrepareForSim(
               createRoutingAlgorithm(), KnSimplifiedController.this.scenario);
         }
       });
 }