diff --git a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java index 72144a8d440..4379075dc79 100644 --- a/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java +++ b/contribs/commercialTrafficApplications/src/main/java/org/matsim/contrib/commercialTrafficApplications/jointDemand/examples/RunJointDemandDRTExample.java @@ -141,9 +141,9 @@ private static void loadConfigGroups(Config config) { MultiModeDrtConfigGroup multiModeDrtConfigGroup = ConfigUtils.addOrGetModule(config, MultiModeDrtConfigGroup.class); DrtConfigGroup drtCfg = new DrtConfigGroup(); - drtCfg.maxWaitTime = 2 * 3600; - drtCfg.maxTravelTimeAlpha = 5; - drtCfg.maxTravelTimeBeta = 15 * 60; + drtCfg.getDrtOptimizationConstraintsParam().maxWaitTime = 2 * 3600; + drtCfg.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 5; + drtCfg.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 15 * 60; drtCfg.stopDuration = 60; drtCfg.vehiclesFile = "jointDemand_vehicles.xml"; multiModeDrtConfigGroup.addParameterSet(drtCfg); diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/run/EDrtModeOptimizerQSimModule.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/run/EDrtModeOptimizerQSimModule.java index b617a93a0d3..5333231bd6a 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/run/EDrtModeOptimizerQSimModule.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/run/EDrtModeOptimizerQSimModule.java @@ -147,7 +147,7 @@ public EmptyVehicleChargingScheduler get() { bindModal(VehicleEntry.EntryFactory.class).toProvider( EDrtVehicleDataEntryFactory.EDrtVehicleDataEntryFactoryProvider.class).asEagerSingleton(); - bindModal(CostCalculationStrategy.class).to(drtCfg.rejectRequestIfMaxWaitOrTravelTimeViolated ? + bindModal(CostCalculationStrategy.class).to(drtCfg.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated ? CostCalculationStrategy.RejectSoftConstraintViolations.class : CostCalculationStrategy.DiscourageSoftConstraintViolations.class).asEagerSingleton(); @@ -179,7 +179,7 @@ public EmptyVehicleRelocator get() { getter.getModal(StopTimeCalculator.class), scheduleWaitBeforeDrive))) .asEagerSingleton(); - bindModal(DefaultOfferAcceptor.class).toProvider(modalProvider(getter -> new DefaultOfferAcceptor(drtCfg.maxAllowedPickupDelay))); + bindModal(DefaultOfferAcceptor.class).toProvider(modalProvider(getter -> new DefaultOfferAcceptor(drtCfg.getDrtOptimizationConstraintsParam().maxAllowedPickupDelay))); bindModal(DrtOfferAcceptor.class).to(modalKey(DefaultOfferAcceptor.class)); bindModal(ScheduleTimingUpdater.class).toProvider(modalProvider( diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/estimator/impl/PessimisticDrtEstimator.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/estimator/impl/PessimisticDrtEstimator.java index d26a318c635..92c0d8feb81 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/estimator/impl/PessimisticDrtEstimator.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/estimator/impl/PessimisticDrtEstimator.java @@ -20,8 +20,8 @@ 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.maxAbsoluteDetour, - route.getDirectRideTime() * drtConfig.maxTravelTimeAlpha); + double travelTime = Math.min(route.getDirectRideTime() + drtConfig.getDrtOptimizationConstraintsParam().maxAbsoluteDetour, + route.getDirectRideTime() * drtConfig.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha); double fare = 0; if (drtConfig.getDrtFareParams().isPresent()) { @@ -34,7 +34,7 @@ public Estimate estimate(DrtRoute route, OptionalTime departureTime) { } // for distance, also use the max travel time alpha - return new Estimate(route.getDistance() * drtConfig.maxTravelTimeAlpha, travelTime, drtConfig.maxWaitTime, fare, 0); + return new Estimate(route.getDistance() * drtConfig.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha, travelTime, drtConfig.getDrtOptimizationConstraintsParam().maxWaitTime, fare, 0); } } diff --git a/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/fiss/RunFissDrtScenarioIT.java b/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/fiss/RunFissDrtScenarioIT.java index d9eda86cc8b..29f2a9b006d 100644 --- a/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/fiss/RunFissDrtScenarioIT.java +++ b/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/fiss/RunFissDrtScenarioIT.java @@ -53,16 +53,16 @@ void test() { DrtConfigGroup drtConfigGroup = drtWithShiftsConfigGroup; drtConfigGroup.mode = TransportMode.drt; - drtConfigGroup.maxTravelTimeAlpha = 1.5; - drtConfigGroup.maxTravelTimeBeta = 10. * 60.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.5; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 10. * 60.; drtConfigGroup.stopDuration = 30.; - drtConfigGroup.maxWaitTime = 600.; - drtConfigGroup.rejectRequestIfMaxWaitOrTravelTimeViolated = true; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWaitTime = 600.; + drtConfigGroup.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = true; drtConfigGroup.useModeFilteredSubnetwork = false; drtConfigGroup.vehiclesFile = fleetFile; drtConfigGroup.operationalScheme = DrtConfigGroup.OperationalScheme.door2door; drtConfigGroup.plotDetailedCustomerStats = true; - drtConfigGroup.maxWalkDistance = 1000.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWalkDistance = 1000.; drtConfigGroup.idleVehiclesReturnToDepots = false; drtConfigGroup.addParameterSet(new ExtensiveInsertionSearchParams()); diff --git a/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/eshifts/run/RunEShiftDrtScenarioIT.java b/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/eshifts/run/RunEShiftDrtScenarioIT.java index 2bd5fdffc27..c634e4f7fad 100644 --- a/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/eshifts/run/RunEShiftDrtScenarioIT.java +++ b/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/eshifts/run/RunEShiftDrtScenarioIT.java @@ -56,16 +56,16 @@ void test() { DrtConfigGroup drtConfigGroup = drtWithShiftsConfigGroup; drtConfigGroup.mode = TransportMode.drt; - drtConfigGroup.maxTravelTimeAlpha = 1.5; - drtConfigGroup.maxTravelTimeBeta = 10. * 60.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.5; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 10. * 60.; drtConfigGroup.stopDuration = 30.; - drtConfigGroup.maxWaitTime = 600.; - drtConfigGroup.rejectRequestIfMaxWaitOrTravelTimeViolated = true; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWaitTime = 600.; + drtConfigGroup.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = true; drtConfigGroup.useModeFilteredSubnetwork = false; drtConfigGroup.vehiclesFile = fleetFile; drtConfigGroup.operationalScheme = DrtConfigGroup.OperationalScheme.door2door; drtConfigGroup.plotDetailedCustomerStats = true; - drtConfigGroup.maxWalkDistance = 1000.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWalkDistance = 1000.; drtConfigGroup.idleVehiclesReturnToDepots = false; drtConfigGroup.addParameterSet(new ExtensiveInsertionSearchParams()); diff --git a/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/shifts/run/RunMultiHubShiftDrtScenarioIT.java b/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/shifts/run/RunMultiHubShiftDrtScenarioIT.java index b0b5089b81e..e708353c388 100644 --- a/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/shifts/run/RunMultiHubShiftDrtScenarioIT.java +++ b/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/shifts/run/RunMultiHubShiftDrtScenarioIT.java @@ -45,16 +45,16 @@ void test() { DrtConfigGroup drtConfigGroup = drtWithShiftsConfigGroup; drtConfigGroup.mode = TransportMode.drt; - drtConfigGroup.maxTravelTimeAlpha = 1.5; - drtConfigGroup.maxTravelTimeBeta = 10. * 60.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.5; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 10. * 60.; drtConfigGroup.stopDuration = 30.; - drtConfigGroup.maxWaitTime = 600.; - drtConfigGroup.rejectRequestIfMaxWaitOrTravelTimeViolated = true; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWaitTime = 600.; + drtConfigGroup.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = true; drtConfigGroup.useModeFilteredSubnetwork = false; drtConfigGroup.vehiclesFile = fleetFile; drtConfigGroup.operationalScheme = DrtConfigGroup.OperationalScheme.door2door; drtConfigGroup.plotDetailedCustomerStats = true; - drtConfigGroup.maxWalkDistance = 1000.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWalkDistance = 1000.; drtConfigGroup.idleVehiclesReturnToDepots = false; drtConfigGroup.addParameterSet(new ExtensiveInsertionSearchParams()); diff --git a/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/shifts/run/RunShiftDrtScenarioIT.java b/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/shifts/run/RunShiftDrtScenarioIT.java index 1d85910ebec..41e5a630461 100644 --- a/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/shifts/run/RunShiftDrtScenarioIT.java +++ b/contribs/drt-extensions/src/test/java/org/matsim/contrib/drt/extension/operations/shifts/run/RunShiftDrtScenarioIT.java @@ -46,16 +46,16 @@ void test() { DrtConfigGroup drtConfigGroup = drtWithShiftsConfigGroup; drtConfigGroup.mode = TransportMode.drt; - drtConfigGroup.maxTravelTimeAlpha = 1.5; - drtConfigGroup.maxTravelTimeBeta = 10. * 60.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.5; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 10. * 60.; drtConfigGroup.stopDuration = 30.; - drtConfigGroup.maxWaitTime = 600.; - drtConfigGroup.rejectRequestIfMaxWaitOrTravelTimeViolated = true; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWaitTime = 600.; + drtConfigGroup.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = true; drtConfigGroup.useModeFilteredSubnetwork = false; drtConfigGroup.vehiclesFile = fleetFile; drtConfigGroup.operationalScheme = DrtConfigGroup.OperationalScheme.door2door; drtConfigGroup.plotDetailedCustomerStats = true; - drtConfigGroup.maxWalkDistance = 1000.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWalkDistance = 1000.; drtConfigGroup.idleVehiclesReturnToDepots = false; drtConfigGroup.addParameterSet(new ExtensiveInsertionSearchParams()); diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/DrtAnalysisControlerListener.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/DrtAnalysisControlerListener.java index edc20fb87b7..3cc19b7a938 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/DrtAnalysisControlerListener.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/DrtAnalysisControlerListener.java @@ -400,7 +400,7 @@ private void writeAndPlotWaitTimeEstimateComparison(Collection pe if (createChart) { final JFreeChart chart2 = DensityScatterPlots.createPlot("Wait times", "Actual wait time [s]", "Initially planned wait time [s]", - times, Pair.of(0., drtCfg.maxWaitTime)); + times, Pair.of(0., drtCfg.getDrtOptimizationConstraintsParam().maxWaitTime)); // xAxis.setLowerBound(0); // yAxis.setLowerBound(0); ChartUtils.writeChartAsPNG(new FileOutputStream(plotFileName), chart2, 1500, 1500); @@ -664,11 +664,11 @@ private static void analyseDetours(Network network, List legs, Map new DefaultOfferAcceptor(drtCfg.maxAllowedPickupDelay))); + bindModal(DefaultOfferAcceptor.class).toProvider(modalProvider(getter -> new DefaultOfferAcceptor(drtCfg.getDrtOptimizationConstraintsParam().maxAllowedPickupDelay))); bindModal(DrtOfferAcceptor.class).to(modalKey(DefaultOfferAcceptor.class)); bindModal(ScheduleTimingUpdater.class).toProvider(modalProvider( diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/routing/DrtRouteCreator.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/routing/DrtRouteCreator.java index 15f9bb77530..c19a631ac44 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/routing/DrtRouteCreator.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/routing/DrtRouteCreator.java @@ -61,7 +61,7 @@ public DrtRouteCreator(DrtConfigGroup drtCfg, Network modalNetwork, * @return maximum travel time */ static double getMaxTravelTime(DrtConfigGroup drtCfg, double unsharedRideTime) { - return drtCfg.maxTravelTimeAlpha * unsharedRideTime + drtCfg.maxTravelTimeBeta; + return drtCfg.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha * unsharedRideTime + drtCfg.getDrtOptimizationConstraintsParam().maxTravelTimeBeta; } /** @@ -72,7 +72,7 @@ static double getMaxTravelTime(DrtConfigGroup drtCfg, double unsharedRideTime) { * @return maximum ride time */ static double getMaxRideTime(DrtConfigGroup drtCfg, double unsharedRideTime) { - return Math.min(unsharedRideTime + drtCfg.maxAbsoluteDetour, drtCfg.maxDetourAlpha * unsharedRideTime + drtCfg.maxDetourBeta); + return Math.min(unsharedRideTime + drtCfg.getDrtOptimizationConstraintsParam().maxAbsoluteDetour, drtCfg.getDrtOptimizationConstraintsParam().maxDetourAlpha * unsharedRideTime + drtCfg.getDrtOptimizationConstraintsParam().maxDetourBeta); } public Route createRoute(double departureTime, Link accessActLink, Link egressActLink, Person person, @@ -89,7 +89,7 @@ public Route createRoute(double departureTime, Link accessActLink, Link egressAc route.setTravelTime(maxTravelTime); route.setMaxRideTime(maxRideDuration); route.setDirectRideTime(unsharedRideTime); - route.setMaxWaitTime(drtCfg.maxWaitTime); + route.setMaxWaitTime(drtCfg.getDrtOptimizationConstraintsParam().maxWaitTime); if (this.drtCfg.storeUnsharedPath) { route.setUnsharedPath(unsharedPath); diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtConfigGroup.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtConfigGroup.java index 7d6f0b9cef4..f277a2d1908 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtConfigGroup.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtConfigGroup.java @@ -50,11 +50,9 @@ import com.google.common.base.Preconditions; import com.google.common.base.Verify; -import jakarta.validation.constraints.DecimalMin; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; -import jakarta.validation.constraints.PositiveOrZero; public class DrtConfigGroup extends ReflectiveConfigGroupWithConfigurableParameterSets implements Modal { private static final Logger log = LogManager.getLogger(DrtConfigGroup.class); @@ -68,6 +66,9 @@ public static DrtConfigGroup getSingleModeDrtConfig(Config config) { return drtConfigGroups.iterator().next(); } + @NotNull + private DrtOptimizationConstraintsParams drtOptimizationConstraintsParams; + @Parameter @Comment("Mode which will be handled by PassengerEngine and VrpOptimizer (passengers'/customers' perspective)") @NotBlank @@ -86,66 +87,6 @@ public static DrtConfigGroup getSingleModeDrtConfig(Config config) { @Positive public double stopDuration = Double.NaN;// seconds - @Parameter - @Comment("Max wait time for the bus to come (optimisation constraint).") - @PositiveOrZero - public double maxWaitTime = Double.NaN;// seconds - - @Parameter - @Comment("Defines the slope of the maxTravelTime estimation function (optimisation constraint), i.e. " - + "min(unsharedRideTime + maxAbsoluteDetour, maxTravelTimeAlpha * unsharedRideTime + maxTravelTimeBeta). " - + "Alpha should not be smaller than 1.") - @DecimalMin("1.0") - public double maxTravelTimeAlpha = Double.NaN;// [-] - - @Parameter - @Comment("Defines the shift of the maxTravelTime estimation function (optimisation constraint), i.e. " - + "min(unsharedRideTime + maxAbsoluteDetour, maxTravelTimeAlpha * unsharedRideTime + maxTravelTimeBeta). " - + "Beta should not be smaller than 0.") - @PositiveOrZero - public double maxTravelTimeBeta = Double.NaN;// [s] - - @Parameter - @Comment( - "Defines the maximum allowed absolute detour in seconds. Note that the detour is computed from the latest promised pickup time. " + - "To enable the max detour constraint, maxAllowedPickupDelay has to be specified. maxAbsoluteDetour should not be smaller than 0, " - + "and should be higher than the offset maxDetourBeta. By default, this limit is disabled (i.e. set to Inf)") - @PositiveOrZero - public double maxAbsoluteDetour = Double.POSITIVE_INFINITY;// [s] - - @Parameter - @Comment( - "Defines the maximum allowed absolute detour based on the unsharedRideTime. Note that the detour is computed from the latest promised " - + "pickup time. To enable the max detour constraint, maxAllowedPickupDelay has to be specified. A linear combination similar to travel " - + "time constrain is used. This is the ratio part. By default, this limit is disabled (i.e. set to Inf, together with maxDetourBeta).") - @DecimalMin("1.0") - public double maxDetourAlpha = Double.POSITIVE_INFINITY; - - @Parameter - @Comment( - "Defines the maximum allowed absolute detour based on the unsharedRideTime. Note that the detour is computed from the latest promised " - + "pickup time. To enable the max detour constraint, maxAllowedPickupDelay has to be specified. A linear combination similar to travel " - + "time constrain is used. This is the constant part. By default, this limit is disabled (i.e. set to Inf, together with maxDetourAlpha).") - @PositiveOrZero - public double maxDetourBeta = Double.POSITIVE_INFINITY;// [s] - - @Parameter - @Comment( - "Defines the maximum delay allowed from the initial scheduled pick up time. Once the initial pickup time is offered, the latest promised" - + "pickup time is calculated based on initial scheduled pickup time + maxAllowedPickupDelay. " - + "By default, this limit is disabled. If enabled, a value between 0 and 240 is a good choice.") - @PositiveOrZero - public double maxAllowedPickupDelay = Double.POSITIVE_INFINITY;// [s] - - @Parameter - @Comment("If true, the max travel and wait times of a submitted request" - + " are considered hard constraints (the request gets rejected if one of the constraints is violated)." - + " If false, the max travel and wait times are considered soft constraints (insertion of a request that" - + " violates one of the constraints is allowed, but its cost is increased by additional penalty to make" - + " it relatively less attractive). Penalisation of insertions can be customised by injecting a customised" - + " InsertionCostCalculator.PenaltyCalculator") - public boolean rejectRequestIfMaxWaitOrTravelTimeViolated = true; - @Parameter @Comment("If true, the startLink is changed to last link in the current schedule, so the taxi starts the next " + "day at the link where it stopped operating the day before. False by default.") @@ -173,14 +114,6 @@ public enum OperationalScheme { @NotNull public OperationalScheme operationalScheme = OperationalScheme.door2door; - //TODO consider renaming maxWalkDistance to max access/egress distance (or even have 2 separate params) - @Parameter - @Comment( - "Maximum beeline distance (in meters) to next stop location in stopbased system for access/egress walk leg to/from drt." - + " If no stop can be found within this maximum distance will return null (in most cases caught by fallback routing module).") - @PositiveOrZero // used only for stopbased DRT scheme - public double maxWalkDistance = Double.MAX_VALUE;// [m]; - @Parameter @Comment("An XML file specifying the vehicle fleet." + " The file format according to dvrp_vehicles_v1.dtd" @@ -243,6 +176,10 @@ public DrtConfigGroup() { } private void initSingletonParameterSets() { + //drt optimization constraints + addDefinition(DrtOptimizationConstraintsParams.SET_NAME, DrtOptimizationConstraintsParams::new, + () -> drtOptimizationConstraintsParams, params -> drtOptimizationConstraintsParams = (DrtOptimizationConstraintsParams) params); + //rebalancing (optional) addDefinition(RebalancingParams.SET_NAME, RebalancingParams::new, () -> rebalancingParams, params -> rebalancingParams = (RebalancingParams)params); @@ -295,7 +232,7 @@ protected void checkConsistency(Config config) { + "attempting to travel without vehicles being available."); } - Verify.verify(maxWaitTime >= stopDuration, "maxWaitTime must not be smaller than stopDuration"); + Verify.verify(drtOptimizationConstraintsParams.maxWaitTime >= stopDuration, "maxWaitTime must not be smaller than stopDuration"); Verify.verify(operationalScheme != OperationalScheme.stopbased || transitStopFile != null, "transitStopFile must not be null when operationalScheme is " + OperationalScheme.stopbased); @@ -323,12 +260,6 @@ protected void checkConsistency(Config config) { if (useModeFilteredSubnetwork) { DvrpModeRoutingNetworkModule.checkUseModeFilteredSubnetworkAllowed(config, mode); } - - if ((maxDetourAlpha != Double.POSITIVE_INFINITY && maxDetourBeta != Double.POSITIVE_INFINITY) || maxAbsoluteDetour != Double.POSITIVE_INFINITY) { - Verify.verify(maxAllowedPickupDelay != Double.POSITIVE_INFINITY, "Detour constraints are activated, " + - "maxAllowedPickupDelay must be specified! A value between 0 and 240 seconds can be a good choice for maxAllowedPickupDelay."); - } - } @Override @@ -336,6 +267,13 @@ public String getMode() { return mode; } + public DrtOptimizationConstraintsParams getDrtOptimizationConstraintsParam() { + if (drtOptimizationConstraintsParams == null) { + addParameterSet(new DrtOptimizationConstraintsParams()); + } + return drtOptimizationConstraintsParams; + } + public DrtInsertionSearchParams getDrtInsertionSearchParams() { return drtInsertionSearchParams; } 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 c83a66d072d..e4ca0e4d5e3 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 @@ -91,7 +91,7 @@ public void install() { .asEagerSingleton(); } else { 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(); diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtOptimizationConstraintsParams.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtOptimizationConstraintsParams.java new file mode 100644 index 00000000000..f3f1e1ed5f2 --- /dev/null +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/run/DrtOptimizationConstraintsParams.java @@ -0,0 +1,96 @@ +package org.matsim.contrib.drt.run; + +import com.google.common.base.Verify; +import jakarta.validation.constraints.DecimalMin; +import jakarta.validation.constraints.PositiveOrZero; +import org.matsim.core.config.Config; +import org.matsim.core.config.ReflectiveConfigGroup; + +/** + * @author nkuehnel / MOIA + */ +public class DrtOptimizationConstraintsParams extends ReflectiveConfigGroup { + + public final static String SET_NAME = "drtOptimizationConstraints"; + + + @Parameter + @Comment("Max wait time for the bus to come (optimisation constraint).") + @PositiveOrZero + public double maxWaitTime = Double.NaN;// seconds + + @Parameter + @Comment("Defines the slope of the maxTravelTime estimation function (optimisation constraint), i.e. " + + "min(unsharedRideTime + maxAbsoluteDetour, maxTravelTimeAlpha * unsharedRideTime + maxTravelTimeBeta). " + + "Alpha should not be smaller than 1.") + @DecimalMin("1.0") + public double maxTravelTimeAlpha = Double.NaN;// [-] + + @Parameter + @Comment("Defines the shift of the maxTravelTime estimation function (optimisation constraint), i.e. " + + "min(unsharedRideTime + maxAbsoluteDetour, maxTravelTimeAlpha * unsharedRideTime + maxTravelTimeBeta). " + + "Beta should not be smaller than 0.") + @PositiveOrZero + public double maxTravelTimeBeta = Double.NaN;// [s] + + @Parameter + @Comment( + "Defines the maximum allowed absolute detour in seconds. Note that the detour is computed from the latest promised pickup time. " + + "To enable the max detour constraint, maxAllowedPickupDelay has to be specified. maxAbsoluteDetour should not be smaller than 0, " + + "and should be higher than the offset maxDetourBeta. By default, this limit is disabled (i.e. set to Inf)") + @PositiveOrZero + public double maxAbsoluteDetour = Double.POSITIVE_INFINITY;// [s] + + @Parameter + @Comment( + "Defines the maximum allowed absolute detour based on the unsharedRideTime. Note that the detour is computed from the latest promised " + + "pickup time. To enable the max detour constraint, maxAllowedPickupDelay has to be specified. A linear combination similar to travel " + + "time constrain is used. This is the ratio part. By default, this limit is disabled (i.e. set to Inf, together with maxDetourBeta).") + @DecimalMin("1.0") + public double maxDetourAlpha = Double.POSITIVE_INFINITY; + + @Parameter + @Comment( + "Defines the maximum allowed absolute detour based on the unsharedRideTime. Note that the detour is computed from the latest promised " + + "pickup time. To enable the max detour constraint, maxAllowedPickupDelay has to be specified. A linear combination similar to travel " + + "time constrain is used. This is the constant part. By default, this limit is disabled (i.e. set to Inf, together with maxDetourAlpha).") + @PositiveOrZero + public double maxDetourBeta = Double.POSITIVE_INFINITY;// [s] + + @Parameter + @Comment( + "Defines the maximum delay allowed from the initial scheduled pick up time. Once the initial pickup time is offered, the latest promised" + + "pickup time is calculated based on initial scheduled pickup time + maxAllowedPickupDelay. " + + "By default, this limit is disabled. If enabled, a value between 0 and 240 is a good choice.") + @PositiveOrZero + public double maxAllowedPickupDelay = Double.POSITIVE_INFINITY;// [s] + + @Parameter + @Comment("If true, the max travel and wait times of a submitted request" + + " are considered hard constraints (the request gets rejected if one of the constraints is violated)." + + " If false, the max travel and wait times are considered soft constraints (insertion of a request that" + + " violates one of the constraints is allowed, but its cost is increased by additional penalty to make" + + " it relatively less attractive). Penalisation of insertions can be customised by injecting a customised" + + " InsertionCostCalculator.PenaltyCalculator") + public boolean rejectRequestIfMaxWaitOrTravelTimeViolated = true;//TODO consider renaming maxWalkDistance to max access/egress distance (or even have 2 separate params) + + @Parameter + @Comment( + "Maximum beeline distance (in meters) to next stop location in stopbased system for access/egress walk leg to/from drt." + + " If no stop can be found within this maximum distance will return null (in most cases caught by fallback routing module).") + @PositiveOrZero // used only for stopbased DRT scheme + public double maxWalkDistance = Double.MAX_VALUE;// [m]; + + public DrtOptimizationConstraintsParams() { + super(SET_NAME); + } + + @Override + protected void checkConsistency(Config config) { + super.checkConsistency(config); + if ((maxDetourAlpha != Double.POSITIVE_INFINITY && maxDetourBeta != Double.POSITIVE_INFINITY) || maxAbsoluteDetour != Double.POSITIVE_INFINITY) { + Verify.verify(maxAllowedPickupDelay != Double.POSITIVE_INFINITY, "Detour constraints are activated, " + + "maxAllowedPickupDelay must be specified! A value between 0 and 240 seconds can be a good choice for maxAllowedPickupDelay."); + } + } +} \ No newline at end of file diff --git a/contribs/drt/src/test/java/org/matsim/contrib/drt/optimizer/MaxDetourConstraintTest.java b/contribs/drt/src/test/java/org/matsim/contrib/drt/optimizer/MaxDetourConstraintTest.java index ec0e2a1f030..8722cc9e657 100644 --- a/contribs/drt/src/test/java/org/matsim/contrib/drt/optimizer/MaxDetourConstraintTest.java +++ b/contribs/drt/src/test/java/org/matsim/contrib/drt/optimizer/MaxDetourConstraintTest.java @@ -36,17 +36,17 @@ public void testMaxDetourConstraint() { DrtConfigGroup drtConfigGroup = DrtConfigGroup.getSingleModeDrtConfig(config); // Max wait time - drtConfigGroup.maxWaitTime = 300; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWaitTime = 300; // Turn on the max detour constraint - drtConfigGroup.maxDetourAlpha = 1.5; - drtConfigGroup.maxDetourBeta = 300; - drtConfigGroup.maxAllowedPickupDelay = 180; - drtConfigGroup.maxAbsoluteDetour = 1200; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxDetourAlpha = 1.5; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxDetourBeta = 300; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxAllowedPickupDelay = 180; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxAbsoluteDetour = 1200; // Make the max total travel time constraints very loose (i.e., make it not active) - drtConfigGroup.maxTravelTimeAlpha = 10; - drtConfigGroup.maxTravelTimeBeta = 7200; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 10; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 7200; config.controller().setOverwriteFileSetting(OutputDirectoryHierarchy.OverwriteFileSetting.deleteDirectoryIfExists); config.controller().setOutputDirectory(utils.getOutputDirectory()); diff --git a/contribs/drt/src/test/java/org/matsim/contrib/drt/optimizer/insertion/DrtPoolingParameterTest.java b/contribs/drt/src/test/java/org/matsim/contrib/drt/optimizer/insertion/DrtPoolingParameterTest.java index 8451f93b1e2..dfff04e67da 100644 --- a/contribs/drt/src/test/java/org/matsim/contrib/drt/optimizer/insertion/DrtPoolingParameterTest.java +++ b/contribs/drt/src/test/java/org/matsim/contrib/drt/optimizer/insertion/DrtPoolingParameterTest.java @@ -225,9 +225,9 @@ private PersonEnterDrtVehicleEventHandler setupAndRunScenario(double maxWaitTime MultiModeDrtConfigGroup mm = ConfigUtils.addOrGetModule(config, MultiModeDrtConfigGroup.class); mm.getModalElements().forEach(x -> { - x.maxWaitTime = maxWaitTime; - x.maxTravelTimeAlpha = maxTravelTimeAlpha; - x.maxTravelTimeBeta = maxTravelTimeBeta; + x.getDrtOptimizationConstraintsParam().maxWaitTime = maxWaitTime; + x.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = maxTravelTimeAlpha; + x.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = maxTravelTimeBeta; x.stopDuration = 1.; }); diff --git a/contribs/drt/src/test/java/org/matsim/contrib/drt/prebooking/ComplexUnschedulerTest.java b/contribs/drt/src/test/java/org/matsim/contrib/drt/prebooking/ComplexUnschedulerTest.java index 93a59a769bd..9f6b424da09 100644 --- a/contribs/drt/src/test/java/org/matsim/contrib/drt/prebooking/ComplexUnschedulerTest.java +++ b/contribs/drt/src/test/java/org/matsim/contrib/drt/prebooking/ComplexUnschedulerTest.java @@ -626,7 +626,7 @@ private class Fixture { DrtConfigGroup drtConfig = new DrtConfigGroup(); drtConfig.stopDuration = 30.0; - drtConfig.maxWaitTime = 600.0; + drtConfig.getDrtOptimizationConstraintsParam().maxWaitTime = 600.0; this.entryFactory = new VehicleDataEntryFactoryImpl(); diff --git a/contribs/drt/src/test/java/org/matsim/contrib/drt/prebooking/PrebookingTestEnvironment.java b/contribs/drt/src/test/java/org/matsim/contrib/drt/prebooking/PrebookingTestEnvironment.java index c97f2c34a81..e4cece58765 100644 --- a/contribs/drt/src/test/java/org/matsim/contrib/drt/prebooking/PrebookingTestEnvironment.java +++ b/contribs/drt/src/test/java/org/matsim/contrib/drt/prebooking/PrebookingTestEnvironment.java @@ -226,9 +226,9 @@ private void buildConfig(Config config) { DrtConfigGroup modeConfig = new DrtConfigGroup(); drtConfig.addParameterSet(modeConfig); modeConfig.mode = "drt"; - modeConfig.maxWaitTime = maximumWaitTime; - modeConfig.maxTravelTimeAlpha = detourRelative; - modeConfig.maxTravelTimeBeta = detourAbsolute; + modeConfig.getDrtOptimizationConstraintsParam().maxWaitTime = maximumWaitTime; + modeConfig.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = detourRelative; + modeConfig.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = detourAbsolute; modeConfig.stopDuration = stopDuration; modeConfig.idleVehiclesReturnToDepots = false; modeConfig.vehiclesFile = null; diff --git a/contribs/drt/src/test/java/org/matsim/contrib/drt/routing/DrtRoutingModuleTest.java b/contribs/drt/src/test/java/org/matsim/contrib/drt/routing/DrtRoutingModuleTest.java index e4d242dabcf..f86bbeb7215 100644 --- a/contribs/drt/src/test/java/org/matsim/contrib/drt/routing/DrtRoutingModuleTest.java +++ b/contribs/drt/src/test/java/org/matsim/contrib/drt/routing/DrtRoutingModuleTest.java @@ -80,9 +80,9 @@ void testCottbusClosestAccessEgressStopFinder() { DrtConfigGroup drtCfg = DrtConfigGroup.getSingleModeDrtConfig(scenario.getConfig()); String drtMode = "DrtX"; drtCfg.mode = drtMode; - drtCfg.maxTravelTimeAlpha = 1.5; - drtCfg.maxTravelTimeBeta = 5 * 60; - drtCfg.maxWaitTime = 5 * 60; + drtCfg.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.5; + drtCfg.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 5 * 60; + drtCfg.getDrtOptimizationConstraintsParam().maxWaitTime = 5 * 60; ImmutableMap, DrtStopFacility> drtStops = scenario.getTransitSchedule() .getFacilities() @@ -91,7 +91,7 @@ void testCottbusClosestAccessEgressStopFinder() { .map(DrtStopFacilityImpl::createFromFacility) .collect(ImmutableMap.toImmutableMap(DrtStopFacility::getId, f -> f)); - AccessEgressFacilityFinder stopFinder = new ClosestAccessEgressFacilityFinder(drtCfg.maxWalkDistance, + AccessEgressFacilityFinder stopFinder = new ClosestAccessEgressFacilityFinder(drtCfg.getDrtOptimizationConstraintsParam().maxWalkDistance, scenario.getNetwork(), QuadTrees.createQuadTree(drtStops.values())); DrtRouteCreator drtRouteCreator = new DrtRouteCreator(drtCfg, scenario.getNetwork(), new SpeedyDijkstraFactory(), new FreeSpeedTravelTime(), TimeAsTravelDisutility::new); @@ -259,7 +259,7 @@ void testRouteDescriptionHandling() { private Scenario createTestScenario() { Config config = ConfigUtils.createConfig(); DrtConfigGroup drtConfigGroup = new DrtConfigGroup(); - drtConfigGroup.maxWalkDistance = 200; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWalkDistance = 200; drtConfigGroup.transitStopFile = utils.getClassInputDirectory() + "testCottbus/drtstops.xml.gz"; MultiModeDrtConfigGroup multiModeDrtConfigGroup = new MultiModeDrtConfigGroup(); multiModeDrtConfigGroup.addParameterSet(drtConfigGroup); diff --git a/contribs/drt/src/test/java/org/matsim/contrib/drt/run/examples/RunDrtExampleIT.java b/contribs/drt/src/test/java/org/matsim/contrib/drt/run/examples/RunDrtExampleIT.java index 9a75670e909..89ef6e8f522 100644 --- a/contribs/drt/src/test/java/org/matsim/contrib/drt/run/examples/RunDrtExampleIT.java +++ b/contribs/drt/src/test/java/org/matsim/contrib/drt/run/examples/RunDrtExampleIT.java @@ -90,7 +90,7 @@ void testRunDrtExampleWithNoRejections_ExtensiveSearch() { for (var drtCfg : MultiModeDrtConfigGroup.get(config).getModalElements()) { //disable rejections - drtCfg.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtCfg.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; } config.controller().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); @@ -129,7 +129,7 @@ void testRunDrtExampleWithNoRejections_SelectiveSearch() { drtCfg.addParameterSet(selectiveInsertionSearchParams); //disable rejections - drtCfg.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtCfg.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; } config.controller().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists); @@ -168,7 +168,7 @@ void testRunDrtExampleWithNoRejections_RepeatedSelectiveSearch() { drtCfg.addParameterSet(repeatedSelectiveInsertionSearchParams); //disable rejections - drtCfg.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtCfg.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; } config.controller().setLastIteration(3); diff --git a/contribs/taxi/src/main/java/org/matsim/contrib/taxi/run/MultiModeTaxiModule.java b/contribs/taxi/src/main/java/org/matsim/contrib/taxi/run/MultiModeTaxiModule.java index 31bf3440150..b4aa67762e0 100644 --- a/contribs/taxi/src/main/java/org/matsim/contrib/taxi/run/MultiModeTaxiModule.java +++ b/contribs/taxi/src/main/java/org/matsim/contrib/taxi/run/MultiModeTaxiModule.java @@ -66,16 +66,16 @@ public static DrtConfigGroup convertTaxiToDrtCfg(TaxiConfigGroup taxiCfg) { // Taxi optimisers do not reject, so time constraints are only used for routing plans (DrtRouteCreator). // Using some (relatively high) values as we do not know what values should be there. They can be adjusted // manually after the TaxiAsDrtConfigGroup config is created. - drtCfg.maxWaitTime = 3600; - drtCfg.maxTravelTimeAlpha = 2; - drtCfg.maxTravelTimeBeta = 3600; - drtCfg.maxAbsoluteDetour = Double.MAX_VALUE; + drtCfg.getDrtOptimizationConstraintsParam().maxWaitTime = 3600; + drtCfg.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 2; + drtCfg.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 3600; + drtCfg.getDrtOptimizationConstraintsParam().maxAbsoluteDetour = Double.MAX_VALUE; - drtCfg.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtCfg.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; drtCfg.changeStartLinkToLastLinkInSchedule = taxiCfg.changeStartLinkToLastLinkInSchedule; drtCfg.idleVehiclesReturnToDepots = false; drtCfg.operationalScheme = DrtConfigGroup.OperationalScheme.door2door; - drtCfg.maxWalkDistance = Double.MAX_VALUE; + drtCfg.getDrtOptimizationConstraintsParam().maxWalkDistance = Double.MAX_VALUE; drtCfg.vehiclesFile = taxiCfg.taxisFile; drtCfg.transitStopFile = null; drtCfg.drtServiceAreaShapeFile = null; diff --git a/contribs/vsp/src/test/java/org/matsim/integration/drtAndPt/PtAlongALine2Test.java b/contribs/vsp/src/test/java/org/matsim/integration/drtAndPt/PtAlongALine2Test.java index 3e00dd03d50..f99512782ef 100644 --- a/contribs/vsp/src/test/java/org/matsim/integration/drtAndPt/PtAlongALine2Test.java +++ b/contribs/vsp/src/test/java/org/matsim/integration/drtAndPt/PtAlongALine2Test.java @@ -229,11 +229,11 @@ void testPtAlongALineWithRaptorAndDrtServiceArea() { { DrtConfigGroup drtConfigGroup = new DrtConfigGroup(); drtConfigGroup.mode = TransportMode.drt; - drtConfigGroup.maxTravelTimeAlpha = 2.0; - drtConfigGroup.maxTravelTimeBeta = 5. * 60.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 2.0; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 5. * 60.; drtConfigGroup.stopDuration = 60.; - drtConfigGroup.maxWaitTime = Double.MAX_VALUE; - drtConfigGroup.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWaitTime = Double.MAX_VALUE; + drtConfigGroup.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; drtConfigGroup.useModeFilteredSubnetwork = true; drtConfigGroup.addParameterSet(new ExtensiveInsertionSearchParams()); @@ -243,11 +243,11 @@ void testPtAlongALineWithRaptorAndDrtServiceArea() { if (drt2) { DrtConfigGroup drtConfigGroup = new DrtConfigGroup(); drtConfigGroup.mode = "drt2"; - drtConfigGroup.maxTravelTimeAlpha = 1.3; - drtConfigGroup.maxTravelTimeBeta = 5. * 60.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.3; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 5. * 60.; drtConfigGroup.stopDuration = 60.; - drtConfigGroup.maxWaitTime = Double.MAX_VALUE; - drtConfigGroup.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWaitTime = Double.MAX_VALUE; + drtConfigGroup.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; drtConfigGroup.useModeFilteredSubnetwork = true; drtConfigGroup.addParameterSet(new ExtensiveInsertionSearchParams()); @@ -256,11 +256,11 @@ void testPtAlongALineWithRaptorAndDrtServiceArea() { if (drt3) { DrtConfigGroup drtConfigGroup = new DrtConfigGroup(); drtConfigGroup.mode = "drt3"; - drtConfigGroup.maxTravelTimeAlpha = 1.3; - drtConfigGroup.maxTravelTimeBeta = 5. * 60.; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.3; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 5. * 60.; drtConfigGroup.stopDuration = 60.; - drtConfigGroup.maxWaitTime = Double.MAX_VALUE; - drtConfigGroup.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtConfigGroup.getDrtOptimizationConstraintsParam().maxWaitTime = Double.MAX_VALUE; + drtConfigGroup.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; drtConfigGroup.useModeFilteredSubnetwork = true; drtConfigGroup.addParameterSet(new ExtensiveInsertionSearchParams()); diff --git a/contribs/vsp/src/test/java/org/matsim/integration/drtAndPt/PtAlongALineTest.java b/contribs/vsp/src/test/java/org/matsim/integration/drtAndPt/PtAlongALineTest.java index 00c908721c0..fd92aafff84 100644 --- a/contribs/vsp/src/test/java/org/matsim/integration/drtAndPt/PtAlongALineTest.java +++ b/contribs/vsp/src/test/java/org/matsim/integration/drtAndPt/PtAlongALineTest.java @@ -110,10 +110,10 @@ void testDrtAlongALine() { DrtConfigGroup drtConfig = new DrtConfigGroup(); drtConfig.mode = "drt_A"; drtConfig.stopDuration = 60.; - drtConfig.maxWaitTime = 900.; - drtConfig.maxTravelTimeAlpha = 1.3; - drtConfig.maxTravelTimeBeta = 10. * 60.; - drtConfig.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtConfig.getDrtOptimizationConstraintsParam().maxWaitTime = 900.; + drtConfig.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.3; + drtConfig.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 10. * 60.; + drtConfig.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; drtConfig.changeStartLinkToLastLinkInSchedule = true; multiModeDrtCfg.addParameterSet(drtConfig); } @@ -247,11 +247,11 @@ void testPtAlongALineWithRaptorAndDrtStopFilterAttribute() { MultiModeDrtConfigGroup mm = ConfigUtils.addOrGetModule(config, MultiModeDrtConfigGroup.class); { DrtConfigGroup drtConfig = new DrtConfigGroup(); - drtConfig.maxTravelTimeAlpha = 1.3; - drtConfig.maxTravelTimeBeta = 5. * 60.; + drtConfig.getDrtOptimizationConstraintsParam().maxTravelTimeAlpha = 1.3; + drtConfig.getDrtOptimizationConstraintsParam().maxTravelTimeBeta = 5. * 60.; drtConfig.stopDuration = 60.; - drtConfig.maxWaitTime = Double.MAX_VALUE; - drtConfig.rejectRequestIfMaxWaitOrTravelTimeViolated = false; + drtConfig.getDrtOptimizationConstraintsParam().maxWaitTime = Double.MAX_VALUE; + drtConfig.getDrtOptimizationConstraintsParam().rejectRequestIfMaxWaitOrTravelTimeViolated = false; drtConfig.mode = TransportMode.drt; mm.addParameterSet(drtConfig); }