Skip to content
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

dont build shortcuts across access_restrictions #4326

Merged
merged 24 commits into from
Nov 30, 2023

Conversation

kevinkreiser
Copy link
Member

@kevinkreiser kevinkreiser commented Oct 12, 2023

fixes #4401
fixes #4257

this is a quick check to see if we can fix #4025 based on a hypothesis that we are building shortcuts across truck restrictions and then the bidirectional algorithm is getting screwed up with one search tree using the shortcut and one tree not

@kevinkreiser kevinkreiser marked this pull request as draft October 12, 2023 19:16
@kevinkreiser
Copy link
Member Author

seems to have a runtime error during CI so looks like my code is borked. i'll check it when i have time

@nilsnolde nilsnolde mentioned this pull request Oct 21, 2023
9 tasks
@nilsnolde
Copy link
Member

In case you won't find the time for it in the next weeks, I'd take this over, after fixing some more matrix stuff. @radekvermirovsky and their company are actually a client. They've been funding a lot of my recent efforts and this is big no-go for compliant truck routing.

I'll try to come up with a strategy along your idea to add mode-specific shortcuts @kevinkreiser.

@kevinkreiser
Copy link
Member Author

kevinkreiser commented Nov 22, 2023

i was going to do it yesterday but wanted to finish my chore #4392 first. i will at least get this compiling in the next couple days

@kevinkreiser
Copy link
Member Author

I'll try to come up with a strategy along your idea to add mode-specific shortcuts

that sounds good. i was hoping to finish this simple idea in this pr and then yeah let you do the more complicated shortcut building that accounts for different modes as i suggested (as that will be quite a bit more time consuming) in a separate pr. is that what you are thinking?

@nilsnolde
Copy link
Member

Jep let’s do that.

@nilsnolde
Copy link
Member

Just to give a public update on our thoughts: the planet is currently building with this PR and we'll see how the performance is impacted. If it's not much (1-2%?), we might be fine leaving it as-is.

Personally I'd like to see that we don't break up shortcuts on most access restrictions and rather assign the most restrictive value of all base edges to the entire shortcut. It wouldn't be a lot of code changes, basically tracking those restrictions similar to total edge length etc, and it would restore those 1-2% or whatever almost fully for anything else than truck, and even truck would be less impacted.

@nilsnolde
Copy link
Member

nilsnolde commented Nov 28, 2023

Did some benchmarking on this on the 2 largest test files we have, with a running server and each file 4 complete runs for each branch, both server and client with 8 threads each:

test_requests/de_benchmark_routes.txt:
master: 132 secs
branch: 131 secs

test_requests/random_routes.txt:
master: 658 secs
branch: 659 secs

So it's fair to say, performance doesn't seem to be impacted at all 🎉

@nilsnolde nilsnolde marked this pull request as ready for review November 28, 2023 18:40
@kevinkreiser
Copy link
Member Author

really have to fix that tar index thing on osx

@kevinkreiser
Copy link
Member Author

I'm good to merge this if you are @nilsnolde

@nilsnolde
Copy link
Member

really have to fix that tar index thing on osx

it's on arm too. not ever seen it on x86 linux though!

nilsnolde
nilsnolde previously approved these changes Nov 29, 2023
Comment on lines +304 to +305
{"CD", {{"highway", "motorway"}, {"name", "highway"}, {"maxweight", "3.5"}}},
{"DE", {{"highway", "motorway"}, {"name", "highway"}, {"maxweight", "8"}}},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amended the test so it'll at least once get to the "return false" to prove we're breaking here too

Comment on lines +309 to +310
{"HI", {{"highway", "motorway"}, {"name", "highway"}, {"hazmat", "yes"}}},
{"IJ", {{"highway", "motorway"}, {"name", "highway"}, {"hazmat", "yes"}}},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also that we're building shortcuts over consecutive edges with the same restriction. could've done many more permutations, but this should be ok

Comment on lines +344 to +347
ways["CD"].erase("maxweight");
ways["DE"].erase("maxweight");
ways["HI"].erase("hazmat");
ways["IJ"].erase("hazmat");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do another graph without those restrictions and test that we're only creating 1 shortcut now

@nilsnolde
Copy link
Member

this is done now @kevinkreiser . I added a bit more testing, let me know if it all makes sense to you. I started another planet build and do one more perf test.

@kevinkreiser
Copy link
Member Author

kevinkreiser commented Nov 30, 2023

yep its what i expected, good touch with the checking that matching access restrictions allow shortcuts to be built

@kevinkreiser
Copy link
Member Author

feel free to put a sh ip on it again so we can merge once the testing shows basically no difference 😄

@nilsnolde
Copy link
Member

Naa, thinking again, the last perf test was done on code which should produce more expansion where only the value was checked. That must've broken up shortcuts more than now. So if anything it got even less impacted. I'll merge :)

@nilsnolde
Copy link
Member

Why is codecov doing that? It's a 100% tested and still it reports the whole coverage is decreased.. sometimes I can understand if patch coverage is close to current project coverage and we remove quite a bit of code which might've been 100% tested, the overall coverage decreases, makes sense. But in this case it's clearly bullshit..

@nilsnolde nilsnolde merged commit fe6c47c into master Nov 30, 2023
8 of 9 checks passed
@nilsnolde nilsnolde deleted the kk_shortcut_access_restrictions branch November 30, 2023 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants