Skip to content

Improve Raptor Heuristics performance - number of transfers #4577

@t2gran

Description

@t2gran

Introduction

When Raptor do a transit search it first does a single criteria, one iteration search to compute the heuristics. This search is slow. So is there a way to improve it?

Related issues: #3748 and #4417
Related research: Fast and Exact Public Transit Routing with Restricted Pareto Sets by Delling, Dibbelt, Pajor.

Goal

The end goal is to support the optimization described in the paper above. OTP do support a variant of this that was developed before we was aware of the paper, but the heuristic we produce is not as "tight" as it could be, so we would like to improve it. This is also to important to be able to support more than one generalized-cost, like a cost emulating price.

To improve the current and future heuristics we can compute the number-of-transfers from origin to each stop, and use this in the reverse search. We could use this together with a max limit on transfers to drop paths.

Todays heuristics

Todays heuristics does a reverse search to compute the least-number-of-transfers and fastest-travel-time (excluding wait-time) for every stop. The time and nTransfers is the amount it takes to travel from that stop to the destination. To compute this we search in reverse - from destination toward the origin. This is then used to compute a minimum value for the cost for every stop to the destination. A single criteria(time) Raptor search is used t do this. The heuristics is then used by the Multi-Criteria Range Raptor for the final search.

Discussion

In #4417 there is a suggestion to do a bi-directional search to compute the heuristics/number-of-stops heuristics. For that to work you would need to keep all paths, witch is not possible. But there are variants that might work.

So this issue is about producing a heuristics witch can be used to limit the stops we need to consider in both the reverse-heuristic raptor search and the mc-multi-criteria range-raptor search. The goal is to produce a byte array containing the number of needed transfers from a stop to reach the origin. We will limit the search by allowing a path to have N extra transfers more than the optimal path(T transfers). We can do this in a simpler way than using raptor, so we will experiment by doing this in a new module inside Raptor. It should use the same input as Raptor does, there should be no need to change it. It might also be that we can modify Raptor to do this, because the only difference is that we do not need to do trip searches.

Outline

  1. Phase 1 - Do a forward search to compute number-of-transfers heuristics for phase-2
  2. Phase 2 - Compute heuristics
  3. Phase 3 - Multi-criteria search

Possible solution

We do not need to compute a complete heuristic in phase 1, only enough data to optimise the phase 2. Then we can compute the number-of-transfers heuristics in phase 2 for phase 3.

I suggest starting with a simple implementation that does a fixed number-of-iterations(I). We should test the to find the optimal I, but I guess it would be around 5-7 rounds for Norway. If we reach the destination before that we can abort.

At this point we have computed the number-of-transfers needed for part of the graph. When this is used in phase 2, it will take effect as soon as the search reaches the first stop with a computed value. We can now calculate the limit. For every stop reached after this point we can drop the result if it is not below the limit.

Version of OTP used

OTP 2.2

Data sets in use

Big datasets like Norway, Nordic Countries or Germany

Metadata

Metadata

Labels

!OptimizationThe feature is to improve performance.StaleThis issue is stale, no activity for 90 days. Remove stale label or comment within 30 days.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions