Fix rare 'waypoints are not included in points' error occurring for edge-based CH alternatives#3139
Merged
Fix rare 'waypoints are not included in points' error occurring for edge-based CH alternatives#3139
Conversation
easbar
commented
Mar 9, 2025
Comment on lines
-152
to
-167
| @RepeatedTest(value = 1000) | ||
| void testForErrors() { | ||
| // error analysis: | ||
| // * suvPath is found, but uvtPath isn't! | ||
| // * suvPath is some kind of loop leading back close to the start (but not the virtual start node) | ||
| // * the resulting alternative has lower weight than the best path! | ||
| // * the resulting alternative does not even connect the start and target nodes | ||
| long seed = System.nanoTime(); | ||
| System.out.println(seed); | ||
| Random rnd = new Random(seed); | ||
| final BaseGraph graph = new BaseGraph.Builder(em).withTurnCosts(true).create(); | ||
| GHUtility.buildRandomGraph(graph, rnd, 10, 2.0, false, speedEnc, 60.0, 0.5, 0); | ||
| GHUtility.addRandomTurnCosts(graph, seed, null, turnCostEnc, 1, graph.getTurnCostStorage()); | ||
| // GHUtility.printGraphForUnitTest(graph, speedEnc); | ||
| graph.freeze(); | ||
| RoutingCHGraph routingCHGraph = prepareCH(graph); |
Member
Author
There was a problem hiding this comment.
I used this code to produce a simple situation where the error occurs. Just in case we run into a similar problem again.
This was referenced Mar 9, 2025
michaz
approved these changes
Mar 11, 2025
Member
michaz
left a comment
There was a problem hiding this comment.
Super, danke!
Ich glaube, ich vergesse immer, dass es "nicht gefundene Pfade" gibt, die man dann aber trotzdem wie Pfade verwenden kann.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 bug in
AlternativeRouteEdgeCHwas introduced in #2101: If there is a turn restriction at the node where we 'glue together' the s->v and v->t paths the uvt-path might be empty/not found. This can cause alternative routes that end at node v and thus do not even reach the target node t. Sometimes they also have a lower weight than the best path. Paths that do not end at the target node cause an error inPathMergerreading:Whether the error occurs or not strongly depends on the set of nodes where the forward/backward SPTs overlap which in turn strongly depends on the exact structure of the CH. Therefore the error often cannot be reproduced on a smaller map extract.
The fix is quite simple: We just need to filter out these alternative path candidates.
Related: #2850