Repository navigation
Conversation
* probably slower preparation, because we now actually do something when we build the queue initially.
Member
Author
|
Btw these two parameters: seem to be a lot less critical for the CH performance than the two new ones. I am still running a few tests changing these, but it seems like they don't make such a big difference at all. |
This was referenced Jan 18, 2022
Merged
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 PR fixes #1810 and improves the node-based CH performance.
So far we were limiting the number of visited nodes for witness path searches based on the (estimated) 'mean degree' of the graph. However, as pointed out in #1810 there were two critical bugs in this calculation. First, the visited nodes limit was zero when building the initial queue (all witness searches were cancelled immediately) and second the cast to an int meant that the limit was also zero if
meanDegree < 1and otherwise it would only ever be a multiple of100. The third bug pointed out in #1810 is obsolete as we removed the 'contracted neighbor' heuristic in the meantime.I did new parameter studies for the node-based CH preparation and found that we get better results using a simpler approach. Instead of adjusting the visited node limit based on the mean degree of the graph I just set it to a fixed number. However, I use a different number for the heuristic calculation for the node ordering and for the actual node contraction. This way we can save time during the witness path searches that are only done to determine the node ordering without skipping too many witness path searches when actually contracting a node. I found that using a value of 30 for the heuristics and a value of 200 for the contraction work quite well. This can depend on the map and exact use-case, so it might be worthwhile to tune these values further, especially when there is a preference for a faster preparation, faster queries or less shortcuts/memory usage.
The other thing I found out is that using (only) neighbor updates, and no periodic and no lazy updates at all works better than what we are currently doing in master. With the set of parameters I use in this PR there are less shortcuts, the preparation is faster and the query times are equal (if not faster). I tested this using maps of different sizes (Bavaria, Germany and planet). To give an example: For master I ran the preparation for planet in 4943s vs. this branch 4556s (-8%), the number of shortcuts decreased from 221mio to 194mio (-14%) and the average query time was around 1.51ms for both. Pretty good, I would say, considering that I only removed code or simplified the algorithm :)
With the new parameters the preparation is faster than before, even when we enable the
GermanyCountryRulethat uses access=destination for all tracks (related to #2375).The only 'downside' to this PR is that now the gap between node- and edge-based CH performance is even bigger. But hopefully some of these ideas will work for edge-based CH as well.