-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent routes when snapping endpoints to same way, with traffic updates #5969
Comments
Hello ! I encouter the first problem (asymetry between source and target) since I invalidate some parts of some way of my graph with --segment-speed-file option (but I'm working with MLD here) This problem lies in this part of the code I think : osrm-backend/include/engine/geospatial_query.hpp Lines 528 to 539 in 31e31a6
When snapping, it only check if the selected section has valid edge weight but according to your post, source is not valid if one section in the same way is invalid, and target is not valid if previous section of the same way are invalid. Then, I propose the folliwing code to fix snapping logic and avoid snapping to valid but invalid edge :
|
This issue seems to be stale. It will be closed in 30 days if no further activity occurs. |
Documenting a quirk I found when writing tests for #5953. It touches on some OSRM implementation details which might be relevant in other scenarios.
Issue
Given a way and traffic updates that invalidate a segment of the way, routes between two endpoints snapped to this way are inconsistent.
N.B. This only affects the contraction hierarchy algorithm.
The problem can be summarised in this test feature:
In an ideal scenario, all four queries would be routable. Furthermore, for the symmetric scenarios
from a to b
andfrom d to c
, only one is routable, and the latter is only finds a path via a u-turn (see the additional weight).In Detail
Input Snapping
A way can consist of multiple segments. Traffic updates can change the edge weights/speeds for individual segments. Segments can also be invalidated, indicating that it can not be used in a route.
Input locations are snapped to a position along a way, i.e. a position on one of the segments.
The current behaviour for snapping locations to ways with invalid segments is as follows:
Targets: The snapped location is a valid target, as long as all segments before the snapped position are valid.
Sources: The snapped location is invalid if any of the segments are invalid, regardless of their relative position to the snapped location.
This asymmetry is due to the way in which route weights are calculated. Without going into the details, all segment weights of the first way are used in the search, so they all must be valid.
Graph Contraction
Scenario 1
Take the first scenario from the test feature. Here we invalidate segment
c->d
The transformation from original graph to edge-based contraction hierarchy graph is as follows:
It's worth noting the graph is so trivial that none of the contraction hierarchy ranking criteria apply, so the order between the two nodes is randomly selected. This is deterministic, so we always have
rank(reverse(abcd)) > rank(forward(abcd))
.Applying the route search...
from b to a
from a to b
Scenario 2
Take the second scenario from the test feature. Here we invalidate segment
b->a
The transformation from original graph to edge-based contraction hierarchy graph is as follows:
Applying the route search...
from c to d
from d to c
Summary
This issue has two characteristics.
The asymmetry between target and source phantoms. Traffic updates to segments behind a source location can invalidate a route even if the path from the source to the first turn is valid. Is there a way to alter the route weight calculation to accommodate this?
Given the source/target asymmetry, the CH contraction order - and in this case the randomness of the rank selection - determines which routes are found. If the contraction node ranks are flipped, the no-route/u-turn results would also flip for the symmetric cases. I also noticed differences between results caused by CH contraction randomness in another test. Are there assumptions needed for CH to work that are not being adhered to in OSRM due to various real-life complexities (snapping, traffic updates, endpoints on same edge, etc)? Or are these test cases not representative of real-world graphs?
The text was updated successfully, but these errors were encountered: