-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
bug-fix: invalid contract node #7066
base: master
Are you sure you want to change the base?
bug-fix: invalid contract node #7066
Conversation
requires a formatting change for CI to proceed:
|
@DennisOSRM Thanks for your kindly reply, I just fixed the format issue, plz have a look again |
Still failing. Please have a look at the failing test output. |
@DennisOSRM . I've run on ubuntu with docker and passed the pre-push hook. plz check again. sry to bother you again |
@DennisOSRM thank you. all checks passed, could you review this PR? is it ok to merge? |
I plan to review over the weekend. |
@DennisOSRM Hi, may I know whether you have any concerns about this fix? |
could you add a test that covers the changed behaviour? |
* Grand Unified Obstacle Treatment * add changelog * Address comments * fix formatting * fix ci * fix ci * fix ci * simplify ObstacleMap::get
* Bump version to 6.0-RC1 * Revert package-json.lock * Update package.json * Update semver
@DennisOSRM Hi, I've added one, plz check, thank you. |
Should I add a comment in the Changelog 6.0.0 RC1 part? |
@DennisOSRM HI, I saw the test failed on Ubuntu, but I tested it successfully on my Mac. I'm not sure what the difference is, maybe the tbb behaves differently on these two envs? So I set |
Could this be an ordering issue in the input data? |
@DennisOSRM Hi, does the first graph in my test case illustrate the problem? If so, I will delete the graph2 or just remove the failed check to fix it. Or we need to input a specific random seed to std::mt19937 when initialize the generator.
@daniel-j-h Do you have any idea of this? |
Don't know why you tag me here I haven't worked on this code base in 7+ years but here goes. If you want the same pseudo-random number sequence across platforms you need to use the same seed, correct. That said looking at the xor-fast-hash there are more issues with it osrm-backend/include/util/xor_fast_hash.hpp Lines 47 to 51 in 646384a
it is using tabulation hashing incorrectly: Instead of randomly initializing the tables it's initializing the tables with numbers from 0 to n and then shuffles them. This means you won't get the mathmatical properties from correct tabulation hashing. In 2025 I can recommend just using a tried and proven hash function e.g. xxhash. |
Sorry to bother you, and thanks for your explanation. I just saw that you are the author, so I pinned you, haha. |
I just added an initial seed to guarantee the same behavior cross platforms. I think we need another PR to fix the problem Daniel mentioned. |
Yes, I can provide this initialization fix as a separate PR. |
Issue
To fix issue #7054
Currently, in OSRM CH algo, the graph contract node and search routes update the weight of each edge. OSRM uses filters to exclude some specific roads with tags like toll, ferry, etc. In the function
contractExcludableGraph
, if filters are more than 1, OSRM will first contract a non-core graph and contract a corresponding graph of each filter. However, the weight update process uses all edges to search routes and doesn't consider that we can not use edges that should be excluded. This will lead to no route found issue when using theexlclude=toll
, addressed in #7054.In that case, node
3
has 2 alternative routes to node7
, while 3->1->0->6->7 is faster than 3->2->0. When OSRM wants to contract node2
, edge (3,2), (7,2) are deleted and no shortcut is inserted, because 3->1->0->6->7 is the actualshortcut
(shorter than 3->2->0). However, updating the route weight doesn’t consider whether node0
or1
or others are accessible in this filtered graph. So I try to pass the arraycontractable
into functionrelaxNode()
, if a finding node is inaccessible, we shouldn’t insert this node into the searching heap or update the weight.Notice: this change will leave more edges in graph and enlarge the memory usage, but I think it's worth it.
I'm not sure this is the best way to fix it. Waiting for your feedback, and appreciate it in advance.
Please read our documentation on release and version management.
If your PR is still work in progress please attach the relevant label.
Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?