feat(srr): transit routing by transport mode utilities #3141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a relatively simple PR that adds a new option to
RaptorParameters
calleduseTransportModeUtilities
. If it is set totrue
(default isfalse
), SwsissRailRaptor will calculate the utility of a leg while routing based on thetransportMode
that is defined in the schedule for the respectiveTransitRoute
, rather than using the genericpt
.Such a behavior could already be achieved by defining "mode mappings", but this forces the user to introduce many individual leg modes, which means that one needs to deal with them in analysis. Plus, the mode mapping approach doesn't allow distinguishing between scoring generic transit trip vs. deciding which path to take while routing (which is not the same).
Another alternative would be to use
RaptorInVehicleCostCalculator
, but the interface, currently, does not pass theTransitRoute
or anything else intogetInVehicleCost
that would allow returning atransportMode
dependent cost. We could discuss extending the interface instead of the present PR, but I think it would have additional implications for other places such as theOccupancyTracker
, etc.See the new unit test for an example.