Skip to content

Plans are not deterministic #3580

Closed

Description

@kannes

Are requests for the same parameters not meant to be deterministic? I expected deterministic results but I observe something different. Before I dive in, I thought I'd ask here.

Expected behavior

I query the same plans from the HTTP API several times and get the same itineraries as results every time.

Observed behavior

I query the same plans from the HTTP API several times and sometimes get slightly different itineraries (other leg(s) or even additional/missing itineraries) as results.

Version of OTP used (exact commit hash or JAR name)

Version: 2.0.0
Commit: a645760
Branch: v2.0.0
Build: 2020-11-27T13:02:08+0000

Data sets in use (links to GTFS and OSM PBF files)

Private :\

Command line used to start OTP

java -Xmx8G -jar /mnt/sexyssd/otp/otp-2.0.0-shaded.jar --build --serve

Request parameters

I loop over many origins and destinations, referenced by stopIds:

http://localhost:8080/otp/routers/default/plan?
fromPlace={origin}
&toPlace={destination}
&time=00%3A00
&date=05-01-2021
&mode=TRANSIT%2CWALK
&maxWalkDistance=1
&arriveBy=false
&searchWindow=86400
&numOfItineraries=99999
&keepNumOfItineraries=99999
&showIntermediateStops=true

Router config and graph build config JSON

Using default configuration.

Activity

  1. slvlirnoff commented on Aug 11, 2021

    @slvlirnoff
    Member

    I've been experiencing that as well, the 'middle/end' part of the trip would change while usually keeping similar departure and arrival times. One itinerary more frequent than the other, but from time to time a different one would be selected.

    I couldn't reproduce the case lately but I'd say more due to source data changes, the overall shape of the trip was 'bus' - 'train' (x1/x2) - 'bus', the 'non deterministic' part was on the last train - bus or train - destination part. Changing the arrival coordinates would stop the issue even a few dozen meters away.

  2. flaktack commented on Sep 9, 2021

    @flaktack
    Contributor

    We noticed similar issues in our deployment, which may or may not be caused by the same issue: in places where there could be multiple identical alternatives, than the trip/route in the itinerary would vary with each request.

    This is caused by the alternatives having the same costs and times while planning, and so which one is stored in the ParetoSet while calculating is non-deterministic. The trips depart from the same stop at the same minute and take the same amount of time to arrive at the destination

    Using the same parameters multiple options are returned:

    image

    image

    image

    If the ParetoSet is modified to allow mutually dominating states even if equivalent (link), then all options are returned:
    image

    The ordering of itineraries is also non-deterministic if all the values match (transfers, departure, arrival, generalizedCost), which can also cause the ordering to change between requests:

    super(new CompositeComparator<>(STREET_ONLY_FIRST,
    arriveBy ? DEPARTURE_TIME : ARRIVAL_TIME,
    GENERALIZED_COST,
    NUM_OF_TRANSFERS,
    arriveBy ? ARRIVAL_TIME : DEPARTURE_TIME
    ));

  3. added this to the 2.1 milestone on Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    !ImprovementA functional improvement or micro feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions