@Override public void notifyStartup(StartupEvent event) { String outFilename = event.getServices().getControlerIO().getOutputPath() + PConstants.statsOutputFolder; new File(outFilename).mkdir(); } });
@Override public void notifyStartup(StartupEvent event) { MatsimServices controler = event.getServices(); if (autoConfig) { // use all activity types defined in the config Set<String> activityTypes = new TreeSet<String>(event.getServices().getConfig().planCalcScore().getActivityTypes()); for (String activityType : activityTypes) { this.activityCountData.put(activityType, new LinkedList<ActivityData>()); } controler.getEvents().addHandler(this); } }
@Override public void notifyStartup(StartupEvent event) { this.calcLegTimes = new KNAnalysisEventsHandler( event.getServices().getScenario() ) ; event.getServices().getEvents().addHandler( this.calcLegTimes ) ; }
@Override public void notifyStartup(StartupEvent event) { if (this.getWriteGexfStatsInterval > 0) { this.addNetworkAsLayer(event.getServices().getScenario().getNetwork(), 0); this.createAttValues(); this.globalPaxHandler = new CountPPaxHandler(this.pIdentifier); event.getServices().getEvents().addHandler(this.globalPaxHandler); this.linkId2TotalCountsFromLastIteration = new HashMap<>(); this.operatorHandler = new CountPOperatorHandler(this.pIdentifier); event.getServices().getEvents().addHandler(this.operatorHandler); this.vehHandler = new CountPVehHandler(this.pIdentifier); event.getServices().getEvents().addHandler(this.vehHandler); this.linkId2OperatorIdsFromLastIteration = new HashMap<>(); this.linkId2LineId2CountsFromLastIteration = new HashMap<>(); this.linkId2VehCountsFromLastIteration = new HashMap<>(); } }
@Override public void notifyStartup(StartupEvent event) { if (this.getWriteGexfStatsInterval > 0) { this.addNetworkAsLayer(event.getServices().getScenario().getNetwork(), 0); this.createAttValues(); this.eventsHandler = new CountPOperatorHandler(this.pIdentifier); event.getServices().getEvents().addHandler(this.eventsHandler); this.linkId2OperatorIdsFromLastIteration = new HashMap<>(); } }
@Override public void notifyStartup(StartupEvent event) { if (this.getWriteGexfStatsInterval > 0) { this.addNetworkAsLayer(event.getServices().getScenario().getNetwork(), 0); this.createAttValues(); this.globalPaxHandler = new CountPPaxHandler(this.pIdentifier); event.getServices().getEvents().addHandler(this.globalPaxHandler); this.linkId2TotalCountsFromLastIteration = new HashMap<>(); this.vehHandler = new CountPVehHandler(this.pIdentifier); event.getServices().getEvents().addHandler(this.vehHandler); this.linkId2VehCountsFromLastIteration = new HashMap<>(); } }
@Override public void notifyStartup(StartupEvent event) { if (this.getWriteGexfStatsInterval > 0) { this.addNetworkAsLayer(event.getServices().getScenario().getNetwork(), 0); this.createAttValues(); this.eventsHandler = new CountPPaxHandler(this.pIdentifier); event.getServices().getEvents().addHandler(this.eventsHandler); this.linkId2CountsFromLastIteration = new HashMap<>(); } }
@Override public void notifyStartup(StartupEvent event) { // yy could probably move all of this method into the constructor, and then get rid of this method. But should // be debugged and a test case written before. kai, oct'15 Scenario scenario = event.getServices().getScenario(); Config config = scenario.getConfig(); // 1st major Cadyts method is "calibrator.addMesurement" // in this implementation it is called by the "CadytsBuilderImpl", dz 09/15 this.calibrator = new CadytsBuilderImpl().buildCalibratorAndAddMeasurements(config, this.counts, measurements, Measurement.class) ; this.measurementListener = new MeasurementListener(scenario, measurements ); event.getServices().getEvents().addHandler(measurementListener); }
@Override public void notifyStartup(final StartupEvent event) { MatsimServices controler = event.getServices(); if(this.pConfig.getLogOperators()){ log.info("enabled"); this.pOperatorLoggerWriter = IOUtils.getBufferedWriter(controler.getControlerIO().getOutputFilename(FILESUFFIX)); try { this.pOperatorLoggerWriter.write(LogElement.getHeaderLine()); } catch (IOException e) { throw new UncheckedIOException(e); } } else { this.pOperatorLoggerWriter = null; } }
@Override public void notifyStartup(final StartupEvent event) { if (fileName.toLowerCase(Locale.ROOT).endsWith(".txt")) { this.out = IOUtils.getBufferedWriter(fileName); } else { this.out = IOUtils.getBufferedWriter(fileName + ".txt"); } try { this.out.write("ITERATION\tavg. EXECUTED\tavg. WORST\tavg. AVG\tavg. BEST\n"); } catch (IOException e) { throw new UncheckedIOException(e); } this.minIteration = event.getServices().getConfig().controler().getFirstIteration(); int maxIter = event.getServices().getConfig().controler().getLastIteration(); int iterations = maxIter - this.minIteration; if (iterations > 5000) iterations = 5000; // limit the history size this.history = new double[4][iterations+1]; }
@Override public void notifyStartup(StartupEvent event) { PBox pBox = (PBox) operators ; pBox.notifyStartup(event); addPTransitScheduleToOriginalOne(event.getServices().getScenario().getTransitSchedule(), pBox.getpTransitSchedule()); addPVehiclesToOriginalOnes(event.getServices().getScenario().getTransitVehicles(), this.pVehiclesFactory.createVehicles(pBox.getpTransitSchedule())); event.getServices().getEvents().processEvent(new TransitScheduleChangedEvent(0.0)); if(this.agentsStuckHandler != null){ event.getServices().getEvents().addHandler(this.agentsStuckHandler); } }
@Override public void notifyStartup(StartupEvent event) { // create all analyzes this.pAnalyzesList.add(new CountTripsPerMode()); this.pAnalyzesList.add(new CountVehPerMode()); this.pAnalyzesList.add(new CountVehicleMeterPerMode(event.getServices().getScenario().getNetwork())); this.pAnalyzesList.add(new AverageTripDistanceMeterPerMode(event.getServices().getScenario().getNetwork())); this.pAnalyzesList.add(new AverageInVehicleTripTravelTimeSecondsPerMode()); this.pAnalyzesList.add(new AverageWaitingTimeSecondsPerMode()); this.pAnalyzesList.add(new AverageNumberOfStopsPerMode()); this.pAnalyzesList.add(new CountTransfersPerModeModeCombination()); this.pAnalyzesList.add(new CountTripsPerPtModeCombination()); this.pAnalyzesList.add(new AverageLoadPerDeparturePerMode()); this.pAnalyzesList.add(new CountDeparturesWithNoCapacityLeftPerMode()); this.pAnalyzesList.add(new CountDeparturesPerMode()); CountPassengerMeterPerMode countPassengerMeterPerMode = new CountPassengerMeterPerMode(event.getServices().getScenario().getNetwork()); this.pAnalyzesList.add(countPassengerMeterPerMode); CountCapacityMeterPerMode countCapacityMeterPerMode = new CountCapacityMeterPerMode(event.getServices().getScenario().getNetwork()); this.pAnalyzesList.add(countCapacityMeterPerMode); this.pAnalyzesList.add(new AverageLoadPerDistancePerMode(countPassengerMeterPerMode, countCapacityMeterPerMode)); // register all analyzes for (PAnalysisModule ana : this.pAnalyzesList) { event.getServices().getEvents().addHandler(ana); } }
@Override public void notifyStartup(StartupEvent event) { NoiseWriter.writeReceiverPoints(noiseContext, event.getServices().getConfig().controler().getOutputDirectory() + "/receiverPoints/", false); }
@Override public void notifyStartup(StartupEvent event) { if (this.pConfig.getGexfInterval() > 0) { this.globalPaxHandler = new CountPPaxHandler(this.pConfig.getPIdentifier()); event.getServices().getEvents().addHandler(this.globalPaxHandler); this.vehHandler = new CountPVehHandler(this.pConfig.getPIdentifier()); event.getServices().getEvents().addHandler(this.vehHandler); } }
@Override public void notifyStartup(StartupEvent event) { event.getServices().getEvents().addHandler(testHandler); } });
@Override public void notifyStartup(StartupEvent event) { event.getServices().getEvents().addHandler(testHandler); } });
@Override public void notifyStartup(StartupEvent event) { event.getServices().getEvents().addHandler(testHandler); } });
@Override public void notifyStartup(final StartupEvent event) { MatsimServices controler = event.getServices(); /* * Scales the load of the facilities (for e.g. 10 % runs), assuming that only integers * can be used to scale a x% scenario ((100 MOD x == 0) runs e.g. x=10%) */ DestinationChoiceConfigGroup dccg = (DestinationChoiceConfigGroup) controler.getConfig().getModule(DestinationChoiceConfigGroup.GROUP_NAME); double scaleNumberOfPersons = dccg.getScaleFactor(); this.eventsToFacilityLoad = new EventsToFacilityLoad( controler.getScenario().getActivityFacilities(), scaleNumberOfPersons, this.facilityPenalties, ((DestinationChoiceConfigGroup)controler.getConfig().getModule("locationchoice")) ); event.getServices().getEvents().addHandler(this.eventsToFacilityLoad); }
@Override public void notifyStartup(final StartupEvent event) { MatsimServices controler = event.getServices(); if(this.pConfig.getWriteStatsInterval() > 0){ log.info("enabled"); this.pStatsWriter = IOUtils.getBufferedWriter(controler.getControlerIO().getOutputFilename("pStats.txt")); try { this.pStatsWriter.write(PStatsOverviewDataContainer.getHeaderLine()); this.pStatsWriter.newLine(); } catch (IOException e) { throw new UncheckedIOException(e); } } else { this.pStatsWriter = null; } this.minIteration = controler.getConfig().controler().getFirstIteration(); int maxIter = controler.getConfig().controler().getLastIteration(); int iterations = maxIter - this.minIteration; if (iterations > 10000) iterations = 10000; // limit the history size this.history = new double[29][iterations+1]; this.statsContainer = new RecursiveStatsContainer(); this.statsApproxContainer = new RecursiveStatsApproxContainer(0.1, 10); }
@Override public void notifyStartup(StartupEvent event) { MatsimServices controler = event.getServices(); // compute or read maxDCScore but do not add it to the context: // context can then be given to scoring classes both during regular scoring and in pre-processing ReadOrComputeMaxDCScore computer = new ReadOrComputeMaxDCScore(dcContext); computer.readOrCreateMaxDCScore(controler.getConfig(), dcContext.kValsAreRead()); ObjectAttributes personsMaxDCScoreUnscaled = computer.getPersonsMaxEpsUnscaled(); for (String actType : this.dcContext.getFlexibleTypes()) { controler.addControlerListener(new DistanceStats(controler.getConfig(), "best", actType, dcContext.getConverter(), TransportMode.car)); controler.addControlerListener(new DistanceStats(controler.getConfig(), "best", actType, dcContext.getConverter(), TransportMode.pt)); controler.addControlerListener(new DistanceStats(controler.getConfig(), "best", actType, dcContext.getConverter(), TransportMode.bike)); controler.addControlerListener(new DistanceStats(controler.getConfig(), "best", actType, dcContext.getConverter(), TransportMode.walk)); controler.addControlerListener(new DistanceStats(controler.getConfig(), "best", actType, dcContext.getConverter(), TransportMode.other)); controler.addControlerListener(new DistanceStats(controler.getConfig(), "best", actType, dcContext.getConverter(), TransportMode.ride)); controler.addControlerListener(new DistanceStats(controler.getConfig(), "best", actType, dcContext.getConverter(), TransportMode.transit_walk)); } MaxDCScoreWrapper dcScore = new MaxDCScoreWrapper(); dcScore.setPersonsMaxDCScoreUnscaled(personsMaxDCScoreUnscaled); controler.getScenario().addScenarioElement(DestinationChoiceContext.ELEMENT_NAME, dcContext); controler.getScenario().addScenarioElement(MaxDCScoreWrapper.ELEMENT_NAME, dcScore); log.info("dc initialized"); } }