Пример #1
0
  public void analyzeModeChainFeasibility(Config config) {

    MutableScenario scenario =
        (MutableScenario) ScenarioUtils.createScenario(ConfigUtils.createConfig());

    // initialize scenario with events from a given events file
    // - network
    logger.info("Reading network xml file...");
    Network network = scenario.getNetwork();
    new MatsimNetworkReader(scenario).readFile(config.network().getInputFile());
    logger.info("Reading network xml file...done.");

    // - facilities
    logger.info("Reading facilities xml file...");
    ActivityFacilities facilities = scenario.getActivityFacilities();
    new MatsimFacilitiesReader(scenario).parse(config.facilities().getInputFile());
    logger.info("Reading facilities xml file...");

    // - population
    PersonAnalyzeModeChainFeasibility pa =
        new PersonAnalyzeModeChainFeasibility(facilities, network);
    ArrayList<PersonAlgorithm> plansAlgos = new ArrayList<PersonAlgorithm>();
    plansAlgos.add(pa);

    PopulationImpl matsimAgentPopulation = (PopulationImpl) scenario.getPopulation();
    matsimAgentPopulation.setIsStreaming(true);
    matsimAgentPopulation.addAlgorithm(pa);
    PopulationReader plansReader = new MatsimPopulationReader(scenario);
    plansReader.readFile(config.plans().getInputFile());

    logger.info("Number of selected plans which are infeasible: " + pa.getNumInfeasiblePlans());
  }
Пример #2
0
 /**
  * @param facilitiesFile
  * @return
  */
 @Deprecated // use centralized infrastructure
 public static ActivityFacilities readActivityFacilities(String facilitiesFile) {
   MutableScenario scenario =
       (MutableScenario) ScenarioUtils.createScenario(ConfigUtils.createConfig());
   ActivityFacilities facilities = scenario.getActivityFacilities();
   new MatsimFacilitiesReader(scenario).readFile(facilitiesFile);
   return facilities;
 }