Repository navigation
Alternative routes with node-based CH - #1722
Conversation
|
Cool! I def. agree that the The method used here is one that (in literature) predates the one used in #1524 ? What are the advantages/disadvantages of the two methods ? |
|
For the path issues I opened #1727 |
|
I was going to merge master but the newly introduced tests fail: Is this a work in progress? It would be cool to have it merged and later cherry pick a few features like the "motorway loop fix" from #1524. |
Ah. Yes. I don't even know what I was trying to do there. I don't have a proper test case yet. Coming up. |
# Conflicts: # core/src/main/java/com/graphhopper/routing/ch/PrepareContractionHierarchies.java
# Conflicts: # core/src/main/java/com/graphhopper/routing/ch/PrepareContractionHierarchies.java
|
I would cautiously call this finished. Merge? |
| return true; | ||
|
|
||
| // This gives us a path s -> v -> t, but since we are using contraction hierarchies, | ||
| // s -> v and v -> t need not be shortest paths. In fact, they can sometimes be pretty strange. |
There was a problem hiding this comment.
IMO it is not something special for CH that s -> v -> t is not a shortest path. Can we instead write something like
The path s -> v -> t is not the shortest way. Only s -> v and v -> t are.
There was a problem hiding this comment.
No, s -> v and v -> t are not shortest paths at that point, and that's the problem.
There was a problem hiding this comment.
Can you explain why this is the case? I do not understand why e.g. s -> v is not shortest although it was fetched from the bestWeightMapFrom.
There was a problem hiding this comment.
Because bestWeightMapFrom is the open set, not the shortest path tree. v is not necessarily closed yet, from either direction. You're right in that's also the case without CH, but with CH, those paths can get arbitrarily ugly because concatenations of shortcuts can be really circuitous routes.
There was a problem hiding this comment.
Not only that. The CH fwd/bwd searches even settle nodes that are not reached via a shortest path. This is because the searches are restricted to only relax edges leading to higher (or equal) level nodes. This is also the reason why we can prune the searches with stall on demand. See e.g. ch. 3.5.2 here: https://algo2.iti.kit.edu/documents/routeplanning/geisberger_dipl.pdf.
There was a problem hiding this comment.
v is not necessarily closed yet, from either direction
...
The CH fwd/bwd searches even settle nodes that are not reached via a shortest path.
Ah, ok - thanks! I need to relearn some basics of GH and CH it seems :)
See e.g. ch. 3.5.2 here: https://algo2.iti.kit.edu/documents/routeplanning/geisberger_dipl.pdf.
Thx! BTW: for firefox this link works :)
There was a problem hiding this comment.
BTW: for firefox this link works :)
>:-(
There was a problem hiding this comment.
>:-(
if this is a sad Emoji I have good news: it works for chrome too ;)
There was a problem hiding this comment.
Currently the query speed is 50 times slower than the ordinary routingCH.mean metric, but there is room for improvement, e.g. this branch: https://github.com/graphhopper/graphhopper/compare/try_alt_ch_faster
For this branch and on our big map the speed up is even 6x and the routingCH_alt.alternative_rateis above 2. So it is basically just faster without "quality reduction" (I have no idea how to measure the real quality here, so I hope the count is a good indicator for the moment to analyze speed :) )
So this is my attempt. Goal was to start with few moving parts, and finish with fewer. :-)
Note that this doesn't even use the existing
AlternativeRoutes. This is really all the code there is.Actually, the most hairy code in this class is stuff for walking backwards and forwards on
Pathbecause we don't have that as a utility.The algorithm seems to be pretty "self-regulating" -- thanks to CH, candidates are already filtered down. So we don't have to check so many candidates. The share-factor is a very good filter criterion, so we don't even seem to really need a maximum number of paths here.