Skip to content

feat(drt): check for maxWaitTime being lower than maxTravelTimeBeta#4625

Open
marecabo wants to merge 7 commits intomatsim-org:mainfrom
marecabo:feat/travel-time-greater-than-maxwaittime
Open

feat(drt): check for maxWaitTime being lower than maxTravelTimeBeta#4625
marecabo wants to merge 7 commits intomatsim-org:mainfrom
marecabo:feat/travel-time-greater-than-maxwaittime

Conversation

@marecabo
Copy link
Contributor

@marecabo marecabo commented Jan 14, 2026

I would suggest to add a constraint "DrtOptimizationConstraintsSetImpl.maxTravelTimeBeta > DrtOptimizationConstraintsSet.maxWaitTime" in DrtOptimizationConstraintsSetImpl.

  • DrtOptimizationConstraintsSetImpl defines an upper bound for the travel time of a DRT trip with its maxTravelTimeAlpha and maxTravelTimeBeta values.

    @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")
    private 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
    private double maxTravelTimeBeta = Double.NaN;// [s]

  • These are used to compute a max travel time:

    double maxTravelTime = defaultSet.getMaxTravelTimeAlpha() * unsharedRideTime + defaultSet.getMaxTravelTimeBeta();

  • The resulting DrtRouteConstraint.maxTravelDuration is then used in the DrtRequest as follows:

    latestStartTime = earliestStartTime + builder.constraints.maxWaitDuration();
    latestArrivalTime = earliestStartTime + builder.constraints.maxTravelDuration();

    Obviously, it must hold that latestStartTime < latestArrivalTime.

  • Tracking this back, I would guess, that maxTravelTimeBeta must be always greater or equal to maxWaitTime.

Do you have any thoughts on this? Maybe I am missing something?

Edit: The first commit is the actual change, all subsequent commits are the necessary adaption of tests.

@marecabo marecabo force-pushed the feat/travel-time-greater-than-maxwaittime branch 3 times, most recently from bc62f28 to 1a354e7 Compare January 15, 2026 14:20
@marecabo marecabo force-pushed the feat/travel-time-greater-than-maxwaittime branch from 1a354e7 to be294aa Compare January 26, 2026 16:35
@marecabo marecabo force-pushed the feat/travel-time-greater-than-maxwaittime branch from be294aa to 13e3739 Compare January 26, 2026 17:30
@marecabo marecabo marked this pull request as ready for review January 26, 2026 23:11
Copy link
Collaborator

@steffenaxer steffenaxer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nkuehnel
Copy link
Member

I'm not sure I agree. There can be scenarios where one would have max wait > beta travel time. In these cases, the max wait time may only come into effect for long distances, compare the following:

image

In the right graph max wait is higher than beta, however, it can only come into effect for long trips (when alpha >1). In this case, a trip can be picked up late, but must be quite direct.

As such, latest start and latest arrival can be defined independently, only insertions that comply with both are valid.

@nkuehnel
Copy link
Member

nkuehnel commented Jan 29, 2026

Sorry the above graph assumed a minimum allowed detour, without that there is no shift to the right, but the argument is the same:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make it a warning that waiting time may not always be fully effective only.

@nkuehnel
Copy link
Member

nkuehnel commented Feb 2, 2026

Simple example for the argument above:

given max wait of 10 mins and beta = 5min and alpha = 1.3 (30% detour)

Given a trip with a direct ride time of 30 min.
Then max travel time is 5 + 1.3 * 30 = 44 min.

This means latest arrival at departure time = 0:00 is 0:44.

This means, a direct ride without further detours lasting 30 mins does still have room for 14 mins of waiting time, which would then be capped by 10 mins max waiting time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants