Skip to content

Entry lost when paging with arrivedBy: true #5431

@jtorin

Description

@jtorin

Expected behavior

When searching with arriveBy: true and paging to the next page, trips should not be lost on boundaries.

Observed behavior

One entry is lost on the paging boundary.

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

OTP STARTING UP (version: 2.5.0-SNAPSHOT, ser.ver.id: 121, commit: dcc40371bd1f97ba7cbeb82445a7352de7365499, branch: dev-2.x) using Java 17.0.8.1

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

Let me know if the NeTEx data would be of use.

Command line used to start OTP

java -Duser.timezone=UTC -Xmx4G -jar target/otp-2.5.0-SNAPSHOT-shaded.jar --load ../../data/OTP --serve

Router config and graph build config JSON

build-config.json:

{
    "areaVisibility": true,
    "parentStopLinking": true,
    "platformEntriesLinking": true,
    "osmWayPropertySet": "norway",
    "islandWithoutStopsMaxSize": 5,
    "islandWithStopsMaxSize": 5,
    "dataImportReport": true,
    "maxTransferDistance": 5000,
    "maxStopToShapeSnapDistance": 500,
    "transitModelTimeZone": "Europe/Stockholm",
    "timeZone": "Europe/Stockholm",
    "netexDefaults" : {
        "feedId": "ST",
        "sharedFilePattern" : "ST_stops.xml",
        "sharedGroupFilePattern" : "(\\w{2})_shared_data.xml",
        "groupFilePattern" : "(\\w{2})_line.*\\.xml",
        "netexFeedId": "ST",
        "noTransfersOnIsolatedStops": false
    },
    "netex" : {
        "sharedFilePattern" : "ST_stops.xml",
        "sharedGroupFilePattern" : "(\\w{2})_shared_data.xml",
        "groupFilePattern" : "(\\w{2})_line.*\\.xml",
        "netexFeedId": "ST"
    }
}

router-config.json:

{
  "routingDefaults": {
    "itineraryFilters": {
      "filterItinerariesWithSameFirstOrLastTrip": true,
      "transitGeneralizedCostLimit" : {
        "costLimitFunction" : "3600 + 2.0 x",
        "intervalRelaxFactor" : 0.4
      }
    },
    "transferSlack": 180,
    "waitReluctance": 0.175,
    "walkReluctance": 11,
    "maxDirectStreetDuration": "3800s",
    "boardSlackForMode": {
      "RAIL": "PT720S"
    }
  },
  "transit": {
    "pagingSearchWindowAdjustments": ["12h", "0h"],
    "dynamicSearchWindow" : {
        "maxWindow": "PT3H"
    },
    "stopTransferCost": {
        "DISCOURAGED" : 3000,
        "ALLOWED" : 150,
        "RECOMMENDED" : 60,
        "PREFERRED" : 0
    }
  }
}

Steps to reproduce the problem

Let's first establish some facts.

In our model, a search of:

{
  trip(
    from: {
        name: "Helsingborg C"
        place: "ST:SE:276:StopPlace:9021012083241000"
    }
    to: {
        name: "Malmö Triangeln"
        place: "ST:SE:276:StopPlace:9021012080140000"
    }
    dateTime: "2023-08-28T09:25+02:00"
    arriveBy: true
    searchWindow: 60
    #pageCursor: ""
[...]

will give the result:

{
  "data": {
    "trip": {
      "fromPlace": {
        "name": "Helsingborg C"
      },
      "toPlace": {
        "name": "Malmö Triangeln"
      },
      "previousPageCursor": "rO0ABXc3AQANUFJFVklPVVNfUEFHRQbgQRQG4GrMAAAOEAAZU1RSRUVUX0FORF9ERVBBUlRVUkVfVElNRQ==",
      "tripPatterns": [
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T08:23:00+02:00",
              "aimedEndTime": "2023-08-28T09:23:00+02:00"
            }
          ]
        },
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T08:13:00+02:00",
              "aimedEndTime": "2023-08-28T09:02:00+02:00"
            }
          ]
        },
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T08:10:00+02:00",
              "aimedEndTime": "2023-08-28T08:56:00+02:00"
            }
          ]
        },
[...]

We can see that there are travel alternatives arriving at the destination 09:23, 09:02, 08:56

Modifying the search to arrive 9:00:

{
  trip(
    from: {
        name: "Helsingborg C"
        place: "ST:SE:276:StopPlace:9021012083241000"
    }
    to: {
        name: "Malmö Triangeln"
        place: "ST:SE:276:StopPlace:9021012080140000"
    }
    dateTime: "2023-08-28T09:00+02:00"
    arriveBy: true
    searchWindow: 60
    #pageCursor: ""
[...]    

This gives the result:

{
  "data": {
    "trip": {
      "fromPlace": {
        "name": "Helsingborg C"
      },
      "toPlace": {
        "name": "Malmö Triangeln"
      },
      "nextPageCursor": "rO0ABXczAQAJTkVYVF9QQUdFBuBXWIAAAAAAAA4QABlTVFJFRVRfQU5EX0RFUEFSVFVSRV9USU1F",
      "tripPatterns": [
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T08:10:00+02:00",
              "aimedEndTime": "2023-08-28T08:56:00+02:00"
            }
          ]
        },
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T07:50:00+02:00",
              "aimedEndTime": "2023-08-28T08:50:00+02:00"
            }
          ]
        },
[...]

As expected the 08:13 - 09:02 (and beyond) is not included since it arrives after 9:00.

Use the cursor to step later in time:

{
  trip(
    from: {
        name: "Helsingborg C"
        place: "ST:SE:276:StopPlace:9021012083241000"
    }
    to: {
        name: "Malmö Triangeln"
        place: "ST:SE:276:StopPlace:9021012080140000"
    }
    dateTime: "2023-08-28T09:00+02:00"
    arriveBy: true
    searchWindow: 60
    pageCursor: "rO0ABXczAQAJTkVYVF9QQUdFBuBXWIAAAAAAAA4QABlTVFJFRVRfQU5EX0RFUEFSVFVSRV9USU1F"
[...]

Here however the alternative of 08:13 - 09:02 is missing:

{
  "data": {
    "trip": {
      "fromPlace": {
        "name": "Helsingborg C"
      },
      "toPlace": {
        "name": "Malmö Triangeln"
      },
      "nextPageCursor": "rO0ABXczAQAJTkVYVF9QQUdFBuBlaIAAAAAAAA4QABlTVFJFRVRfQU5EX0RFUEFSVFVSRV9USU1F",
      "tripPatterns": [
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T08:50:00+02:00",
              "aimedEndTime": "2023-08-28T09:50:00+02:00"
            }
          ]
        },
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T08:38:00+02:00",
              "aimedEndTime": "2023-08-28T09:29:00+02:00"
            }
          ]
        },
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T08:35:00+02:00",
              "aimedEndTime": "2023-08-28T09:26:00+02:00"
            }
          ]
        },
        {
          "legs": [
            {
              "aimedStartTime": "2023-08-28T08:23:00+02:00",
              "aimedEndTime": "2023-08-28T09:23:00+02:00"
            }
          ]
        }
      ]
    }
  }

(output not cut)

Seems like one entry in between is lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    !BugApply to issues describing a bug and PRs witch fixes it.EnturOn Entur RoadmapSkanetrafikenOn skanetrafikens roadmap

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions