Skip to content

Include all direct transit trips in search result #6977

@habrahamsson-skanetrafiken

Description

Feature

When searching between two stops/stations, we want to include "all" direct transit connections between the stops even if they are non-optimal. We only want to add the direct transit trips from and to the actual stops, no access/egress.

This would be an opt-in feature that is disabled by default.

Reasons

One of the most common complaints from our commuters is that they know of a specific train/bus they want to take from stop A to stop B, but our search results does not include the trip they are looking for because it is non-optimal. This is most often a regional bus/train that is shadowed by a faster express bus/train. Another example is when it is a faster + cheaper to walk to a nearby stop and take a trip from there.

The reasons that a user would like to take a non-optimal trip could be:

  • They know the regional trains are less crowded than the express trains.
  • They prefer the view from a specific bus.
  • It's raining and they would rather sit on a bus than wait at a bus stop.
  • etc

Example 1

Image

The highlighted slower trains would not be shown by OTP (note that itineraries are sorted by arrival time).

Example 2

Image

The highlighted bus is not shown by OTP because it is suboptimal in relation to the one above with 199m access walk (note that itineraries are sorted by arrival time).

Circular routes etc

It's not always reasonable to show all direct transit. For example a circular route if searching between two adjacent stops we wouldn't want to show the direction that goes the long way. The way we would solve this is by relying on the regular itinerary filter-chain to remove the more costly trips.

In order for this to work correctly we would have to assign costs to the itineraries.

Alternative solutions

  • Transit group priority solves a similar issue. But this would require us to decide upfront which of the slower trains/buses we would like to promote and this would be intractable (and impossible for the realtime cases).
  • Alter the raptor pareto calculation to make this kind of direct transit always be optimal. This would be a more complex solution and it would probably have performance implications.
  • Create a separate endpoint for fetching the trips between two stops. Merge this with our regular search results outside of OTP. This is undesirable since we couldn't use OTPs filtering logic and would be difficult to maintain.
  • The user could try to find the specific trip they are looking for using filters. This would require our users to understand the reason for why their trip doesn't show up. We cannot expect our users to know about OTPs optimality criteria.

Implementation / Architecture

This would be implemented as a separate router DirectTransitRouter that would generate itineraries like the DirectStreetRouter, DirectFlexRouter and the TransitRouter. That way it would be a totally independent module that can easily be enabled/disabled.

We would use the implementation of the search from the AlternativeLegs class by generalizing it a bit. The current implementation has some restrictions and has a lot of duplicate code with the StopTimesHelper. This would be cleaned up as part of the work.

I think this feature would be a good fit in OTP. It wouldn't add a lot of complexity. It follows the general philosophy of generating many itineraries and then filtering them down.

Prerequisites:

This is related to #6227

Metadata

Metadata

Assignees

No one assigned

    Labels

    !New FeatureA functional feature targeting the end user.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions