From 52fdd8c7dd21285015b2310312cfae87692ec2ef Mon Sep 17 00:00:00 2001 From: nkuehnel Date: Fri, 10 May 2024 10:38:03 +0200 Subject: [PATCH] merge latest changes --- .../drt/estimator/impl/PessimisticDrtEstimator.java | 9 +++++---- .../org/matsim/contrib/drt/run/DrtModeRoutingModule.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/estimator/impl/PessimisticDrtEstimator.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/estimator/impl/PessimisticDrtEstimator.java index d703067324a..f78186135e0 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/estimator/impl/PessimisticDrtEstimator.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/estimator/impl/PessimisticDrtEstimator.java @@ -1,9 +1,9 @@ package org.matsim.contrib.drt.estimator.impl; import org.matsim.contrib.drt.estimator.DrtEstimator; -import org.matsim.contrib.drt.fare.DrtFareParams; import org.matsim.contrib.drt.routing.DrtRoute; import org.matsim.contrib.drt.run.DrtConfigGroup; +import org.matsim.contrib.drt.run.DrtOptimizationConstraintsParams; import org.matsim.core.utils.misc.OptionalTime; /** @@ -20,11 +20,12 @@ public PessimisticDrtEstimator(DrtConfigGroup drtConfig) { public Estimate estimate(DrtRoute route, OptionalTime departureTime) { // If not estimates are present, use travel time alpha as detour // beta is not used, because estimates are supposed to be minimums and not worst cases - double travelTime = Math.min(route.getDirectRideTime() + drtConfig.getDrtOptimizationConstraintsParam().maxAbsoluteDetour, - route.getDirectRideTime() * drtConfig.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha); + DrtOptimizationConstraintsParams constraints = drtConfig.getDrtOptimizationConstraintsParam(); + double travelTime = Math.min(route.getDirectRideTime() + constraints.maxAbsoluteDetour, + route.getDirectRideTime() * constraints.maxTravelTimeAlpha); // for distance, also use the max travel time alpha - return new Estimate(route.getDistance() * drtConfig.maxTravelTimeAlpha, travelTime, drtConfig.maxWaitTime, 0); + return new Estimate(route.getDistance() * constraints.maxTravelTimeAlpha, travelTime, constraints.maxWaitTime, 0); } } diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtModeRoutingModule.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtModeRoutingModule.java index 8d037b171dc..af5916d028a 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtModeRoutingModule.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtModeRoutingModule.java @@ -104,7 +104,7 @@ public void install() { .asEagerSingleton(); case stopbased, serviceAreaBased -> { bindModal( AccessEgressFacilityFinder.class ).toProvider( modalProvider( - getter -> new ClosestAccessEgressFacilityFinder( drtCfg.maxWalkDistance, + getter -> new ClosestAccessEgressFacilityFinder( drtCfg.getDrtOptimizationConstraintsParam().maxWalkDistance, getter.get( Network.class ), QuadTrees.createQuadTree( getter.getModal( DrtStopNetwork.class ).getDrtStops().values() ) ) ) ) .asEagerSingleton();