, TransitStopFacility> stopFacilities;
@Inject
- public TransitPerformanceFromEventBasedRouterInterfaces(WaitTime waitTimes, StopStopTime stopStopTimes,
+ public TransitPerformanceFromEventBasedRouterInterfaces(/*WaitTime waitTimes, StopStopTime stopStopTimes,*/
TransitSchedule transitSchedule) {
- this.waitTimes = waitTimes;
- this.stopStopTimes = stopStopTimes;
+// this.waitTimes = waitTimes;
+// this.stopStopTimes = stopStopTimes;
this.transitLines = transitSchedule.getTransitLines();
this.stopFacilities = transitSchedule.getFacilities();
}
@@ -65,8 +65,8 @@ public Trip findTrip(Leg prevLeg, double earliestDepartureTime_s) {
TransitLine line = this.transitLines.get(route.getLineId());
TransitRoute transitRoute = line.getRoutes().get(route.getRouteId());
- final double accessTime_s = earliestDepartureTime_s + this.waitTimes.getRouteStopWaitTime(route.getLineId(),
- transitRoute.getId(), route.getAccessStopId(), earliestDepartureTime_s);
+ final double accessTime_s = earliestDepartureTime_s /*+ this.waitTimes.getRouteStopWaitTime(route.getLineId(),
+ transitRoute.getId(), route.getAccessStopId(), earliestDepartureTime_s)*/;
final double egressTime_s = accessTime_s + this.findTransitTravelTime(route, accessTime_s);
return new Trip(null, accessTime_s, egressTime_s);
}
@@ -99,7 +99,7 @@ private double findTransitTravelTime(TransitPassengerRoute route, double prevEnd
Id fromId = transitRoute.getStops().get(i).getStopFacility().getId();
TransitRouteStop toStop = transitRoute.getStops().get(i + 1);
Id toId = toStop.getStopFacility().getId();
- travelTime += stopStopTimes.getStopStopTime(fromId, toId, prevStopTime);
+// travelTime += stopStopTimes.getStopStopTime(fromId, toId, prevStopTime);
prevStopTime += travelTime;
if (toStop.getStopFacility().getId().equals(dest)) {
destinationFound = true;
diff --git a/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/PSimStopStopTimeCalculator.java b/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/PSimStopStopTimeCalculator.java
deleted file mode 100644
index 4b1a0e49a21..00000000000
--- a/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/PSimStopStopTimeCalculator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.matsim.contrib.pseudosimulation.trafficinfo;
-
-import com.google.inject.Singleton;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.matsim.api.core.v01.Scenario;
-import org.matsim.api.core.v01.events.PersonLeavesVehicleEvent;
-import org.matsim.contrib.eventsBasedPTRouter.stopStopTimes.StopStopTimeCalculatorSerializable;
-import org.matsim.contrib.pseudosimulation.MobSimSwitcher;
-import org.matsim.core.api.experimental.events.EventsManager;
-import org.matsim.core.api.experimental.events.VehicleArrivesAtFacilityEvent;
-import org.matsim.core.config.Config;
-import org.matsim.pt.transitSchedule.api.TransitSchedule;
-
-import jakarta.inject.Inject;
-
-@Singleton
-public class PSimStopStopTimeCalculator extends StopStopTimeCalculatorSerializable {
- private final MobSimSwitcher switcher;
-
- @Inject
- PSimStopStopTimeCalculator(Scenario scenario, MobSimSwitcher switcher, EventsManager eventsManager) {
- super(scenario.getTransitSchedule(),scenario.getConfig() );
- this.switcher = switcher;
- eventsManager.addHandler(this);
- }
-
- @Override
- public void reset(int iteration) {
- if (switcher.isQSimIteration()) {
- LogManager.getLogger(this.getClass()).error(
- "Calling reset on traveltimecalc");
- super.reset(iteration);
- }
- }
-
- @Override
- public void handleEvent(VehicleArrivesAtFacilityEvent event) {
- if (switcher.isQSimIteration())
- super.handleEvent(event);
- }
-
- @Override
- public void handleEvent(PersonLeavesVehicleEvent event) {
- if (switcher.isQSimIteration())
- super.handleEvent(event);
- }
-
-}
diff --git a/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/PSimWaitTimeCalculator.java b/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/PSimWaitTimeCalculator.java
deleted file mode 100644
index f618a5c8a45..00000000000
--- a/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/PSimWaitTimeCalculator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.matsim.contrib.pseudosimulation.trafficinfo;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.matsim.api.core.v01.Scenario;
-import org.matsim.api.core.v01.events.PersonDepartureEvent;
-import org.matsim.api.core.v01.events.PersonEntersVehicleEvent;
-import org.matsim.contrib.eventsBasedPTRouter.waitTimes.WaitTimeCalculatorSerializable;
-import org.matsim.contrib.eventsBasedPTRouter.waitTimes.WaitTimeStuckCalculator;
-import org.matsim.contrib.pseudosimulation.MobSimSwitcher;
-import org.matsim.core.api.experimental.events.EventsManager;
-
-
-/**
- * @author fouriep
- *
- * Extends Ordonez's {@link WaitTimeStuckCalculator} to only handle
- * events during QSim iterations.
- */
-@Singleton
-public class PSimWaitTimeCalculator extends WaitTimeCalculatorSerializable {
- private final MobSimSwitcher switcher;
-
- @Inject
- public PSimWaitTimeCalculator(Scenario scenario,
- MobSimSwitcher switcher, EventsManager eventsManager) {
- super(scenario.getTransitSchedule(),scenario.getConfig());
- this.switcher = switcher;
- eventsManager.addHandler(this);
- }
-
- @Override
- public void reset(int iteration) {
- if (switcher.isQSimIteration()) {
- LogManager.getLogger(this.getClass()).error(
- "Calling reset on traveltimecalc");
- super.reset(iteration);
- }
- }
-
- @Override
- public void handleEvent(PersonDepartureEvent event) {
- if (switcher.isQSimIteration())
- super.handleEvent(event);
- }
-
- @Override
- public void handleEvent(PersonEntersVehicleEvent event) {
- if (switcher.isQSimIteration())
- super.handleEvent(event);
- }
-
-
-
-}
diff --git a/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/deterministic/DeterministicStopStopTimeCalculator.java b/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/deterministic/DeterministicStopStopTimeCalculator.java
deleted file mode 100644
index 567187f053d..00000000000
--- a/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/deterministic/DeterministicStopStopTimeCalculator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.matsim.contrib.pseudosimulation.trafficinfo.deterministic;
-
-import java.util.List;
-
-import org.matsim.api.core.v01.Id;
-import org.matsim.api.core.v01.population.Leg;
-import org.matsim.api.core.v01.population.PlanElement;
-import org.matsim.contrib.eventsBasedPTRouter.stopStopTimes.StopStopTime;
-import org.matsim.contrib.eventsBasedPTRouter.stopStopTimes.StopStopTimeCalculator;
-import org.matsim.core.router.DefaultRoutingRequest;
-import org.matsim.pt.router.TransitRouter;
-import org.matsim.pt.transitSchedule.api.TransitSchedule;
-import org.matsim.pt.transitSchedule.api.TransitStopFacility;
-import org.matsim.utils.objectattributes.attributable.Attributes;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-@Singleton
-public class DeterministicStopStopTimeCalculator implements StopStopTimeCalculator {
- private final TransitRouter transitRouter;
- private final TransitSchedule schedule;
-
- @Inject
- public DeterministicStopStopTimeCalculator(TransitRouter transitRouter, TransitSchedule schedule) {
- this.transitRouter = transitRouter;
- this.schedule = schedule;
- }
-
- @Override
- public double getStopStopTime(Id stopOId, Id stopDId, double time) {
- // ATTENTION! This could be optimized. Basically, we probably don't need to
- // route here. However, finding the travel time even on one route is not a
- // computationally efficient task, because the same transit stop id may occur
- // multiple times on the same route.
-
- TransitStopFacility originFacility = schedule.getFacilities().get(stopOId);
- TransitStopFacility destinationFacility = schedule.getFacilities().get(stopDId);
-
- List extends PlanElement> legs = transitRouter.calcRoute(DefaultRoutingRequest.withoutAttributes(originFacility, destinationFacility, time, null));
- return legs.stream().mapToDouble(l -> ((Leg)l).getTravelTime().seconds()).sum();
- }
-
- @Override
- public double getStopStopTimeVariance(Id stopOId, Id stopDId,
- double time) {
- return 0.0;
- }
-
- @Override
- public StopStopTime get() {
- return new StopStopTime() {
- @Override
- public double getStopStopTimeVariance(Id stopOId, Id stopDId,
- double time) {
- return 0.0;
- }
-
- @Override
- public double getStopStopTime(Id stopOId, Id stopDId,
- double time) {
- return DeterministicStopStopTimeCalculator.this.getStopStopTime(stopOId, stopDId, time);
- }
- };
- }
-}
diff --git a/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/deterministic/DeterministicWaitTimeCalculator.java b/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/deterministic/DeterministicWaitTimeCalculator.java
deleted file mode 100644
index d1aa43ce61b..00000000000
--- a/contribs/pseudosimulation/src/main/java/org/matsim/contrib/pseudosimulation/trafficinfo/deterministic/DeterministicWaitTimeCalculator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.matsim.contrib.pseudosimulation.trafficinfo.deterministic;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.matsim.api.core.v01.Id;
-import org.matsim.contrib.eventsBasedPTRouter.waitTimes.WaitTime;
-import org.matsim.contrib.eventsBasedPTRouter.waitTimes.WaitTimeCalculator;
-import org.matsim.pt.transitSchedule.api.Departure;
-import org.matsim.pt.transitSchedule.api.TransitLine;
-import org.matsim.pt.transitSchedule.api.TransitRoute;
-import org.matsim.pt.transitSchedule.api.TransitRouteStop;
-import org.matsim.pt.transitSchedule.api.TransitSchedule;
-import org.matsim.pt.transitSchedule.api.TransitStopFacility;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-@Singleton
-public class DeterministicWaitTimeCalculator implements WaitTimeCalculator {
- private final TransitSchedule schedule;
-
- @Inject
- public DeterministicWaitTimeCalculator(TransitSchedule schedule) {
- this.schedule = schedule;
- }
-
- @Override
- public double getRouteStopWaitTime(Id lineId, Id routeId, Id stopId,
- double time) {
- TransitRoute route = schedule.getTransitLines().get(lineId).getRoutes().get(routeId);
-
- // First collect all the offsets on the route for a specific transit stop id.
- // Note that a single transit facility may be contained multiple times on a
- // route!
- List facilityOffsets = new LinkedList<>();
-
- for (TransitRouteStop stop : route.getStops()) {
- if (stop.getStopFacility().getId().equals(stopId)) {
- facilityOffsets.add(stop.getDepartureOffset().seconds());
- }
- }
-
- if (facilityOffsets.size() == 0) {
- // The facility is not contained on this route
- throw new IllegalStateException();
- }
-
- // Now loop through all the departures and routes and find the actual stop
- // departure that is right after the given time.
-
- double minimumWaitTime = Double.POSITIVE_INFINITY;
-
- for (double offset : facilityOffsets) {
- for (Departure departure : route.getDepartures().values()) {
- double stopDepartureTime = departure.getDepartureTime() + offset;
-
- while (stopDepartureTime < time) {
- // Consistent with TransitRouterNetworkTravelTimeAndDisutility.MIDNIGHT
- stopDepartureTime += 24.0 * 3600;
- }
-
- double waitTime = time - stopDepartureTime;
-
- if (waitTime < minimumWaitTime) {
- minimumWaitTime = waitTime;
- }
- }
- }
-
- return minimumWaitTime;
- }
-
- @Override
- public WaitTime get() {
- return new WaitTime() {
- @Override
- public double getRouteStopWaitTime(Id lineId, Id routeId,
- Id stopId, double time) {
- return DeterministicWaitTimeCalculator.this.getRouteStopWaitTime(lineId, routeId, stopId, time);
- }
- };
- }
-}
diff --git a/contribs/pseudosimulation/src/test/java/org/matsim/contrib/pseudosimulation/RunPSimTest.java b/contribs/pseudosimulation/src/test/java/org/matsim/contrib/pseudosimulation/RunPSimTest.java
index 994a35e162e..82224f40c4f 100644
--- a/contribs/pseudosimulation/src/test/java/org/matsim/contrib/pseudosimulation/RunPSimTest.java
+++ b/contribs/pseudosimulation/src/test/java/org/matsim/contrib/pseudosimulation/RunPSimTest.java
@@ -109,7 +109,7 @@ public void install() {
Population popActual = PopulationUtils.createPopulation( config );
PopulationUtils.readPopulation( popActual, outDir + "/output_plans.xml.gz" );
new PopulationComparison().compare( popExpected, popActual ) ;
- Assert.assertEquals("RunPsim score changed.", 138.90474624352407, psimScore, MatsimTestUtils.EPSILON);
+ Assert.assertEquals("RunPsim score changed.", 138.88379880881348, psimScore, MatsimTestUtils.EPSILON);
// Assert.assertEquals("RunPsim score changed.", 134.54001491094124d, psimScore, MatsimTestUtils.EPSILON);
// Assert.assertEquals("RunPsim score changed.", 134.52369453719413d, psimScore, MatsimTestUtils.EPSILON);
// Assert.assertEquals("RunPsim score changed.", 132.73129073101293d, psimScore, MatsimTestUtils.EPSILON);