From 3a9aba025b582fb23b61cabd04a934a820d48287 Mon Sep 17 00:00:00 2001 From: rakow Date: Thu, 7 Dec 2023 14:30:02 +0100 Subject: [PATCH] fix optimistic estimator --- .../java/org/matsim/run/drt/OptimisticDrtEstimator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/matsim/run/drt/OptimisticDrtEstimator.java b/src/main/java/org/matsim/run/drt/OptimisticDrtEstimator.java index de3f03b3..4380e76c 100644 --- a/src/main/java/org/matsim/run/drt/OptimisticDrtEstimator.java +++ b/src/main/java/org/matsim/run/drt/OptimisticDrtEstimator.java @@ -33,18 +33,20 @@ public OptimisticDrtEstimator(DrtConfigGroup drtConfig, double proportion, doubl public Estimate estimate(DrtRoute route, OptionalTime departureTime) { double distance = route.getDistance(); - double travelTime = Math.max(route.getDirectRideTime(), route.getMaxTravelTime() * proportion); + + double maxTravelTime = Math.min(route.getDirectRideTime() + this.drtConfig.maxAbsoluteDetour, + route.getDirectRideTime() * this.drtConfig.maxTravelTimeAlpha + this.drtConfig.maxTravelTimeBeta); double fare = 0; if (drtConfig.getDrtFareParams().isPresent()) { DrtFareParams fareParams = drtConfig.getDrtFareParams().get(); fare = fareParams.distanceFare_m * distance - + fareParams.timeFare_h * travelTime / 3600.0 + + fareParams.timeFare_h * route.getDirectRideTime() / 3600.0 + fareParams.baseFare; fare = Math.max(fare, fareParams.minFarePerTrip); } - return new Estimate(distance, travelTime, waitingTime, fare, 0); + return new Estimate(distance, proportion * maxTravelTime, waitingTime, fare, 0); } }