Beispiel #1
0
 @Override
 public void notifyIterationStarts(IterationStartsEvent event) {
   Population pop = event.getControler().getScenario().getPopulation();
   for (Person p : pop.getPersons().values()) {
     PersonUtils.setAge(p, 100);
   }
 }
    @Override
    public void notifyIterationStarts(IterationStartsEvent event) {
      if (event.getIteration() == 0) {
        Controler controler = event.getControler();

        // initialize the social costs calculator
        SocialCostCalculatorV2 scc =
            new SocialCostCalculatorV2(
                controler.getScenario().getNetwork(),
                controler.getEvents(),
                controler.getLinkTravelTimes(),
                controler,
                blendFactor);

        controler.addControlerListener(scc);
        controler.getEvents().addHandler(scc);

        // initialize the social costs disutility calculator
        final SocialCostTravelDisutilityFactory factory =
            new SocialCostTravelDisutilityFactory(scc);
        controler.addOverridingModule(
            new AbstractModule() {
              @Override
              public void install() {
                bindCarTravelDisutilityFactory().toInstance(factory);
              }
            });

        // create a plot containing the mean travel times
        Set<String> transportModes = new HashSet<String>();
        transportModes.add(TransportMode.car);
        transportModes.add(TransportMode.pt);
        transportModes.add(TransportMode.walk);
        MeanTravelTimeCalculator mttc =
            new MeanTravelTimeCalculator(controler.getScenario(), transportModes);
        controler.addControlerListener(mttc);
        controler.getEvents().addHandler(mttc);
      }
    }