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

Fix Broken Trivial Unidirectional Routes #3299

Merged
merged 4 commits into from
Sep 1, 2021
Merged

Fix Broken Trivial Unidirectional Routes #3299

merged 4 commits into from
Sep 1, 2021

Conversation

kevinkreiser
Copy link
Member

@kevinkreiser kevinkreiser commented Aug 31, 2021

While I was lending a hand over in #3274 i added a simple test that relied on the results of unidirecitonal path finding (in the forward direction). The route in question is a single edge starting at the beginning of the edge and going 2/3rds along it. The algorithm currently (for this specific ordering of the input data) returns a two edge route starting at the end of the opposing edge and then making its way to the correct edge and ending 2/3rds along. at least from my quick debug session that is what looked like happened.

i thought we removed node snap edge candidates that were the full distance along...

}
}
return false;
return p != destinations_percent_along_.end() && edge.percent_along() == p->second;
Copy link
Member Author

Choose a reason for hiding this comment

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

this here was the fix, the comparison of percent along. see, we need to confirm for the super trivial case that the edge candidates are indeed snapped to the exact same side (node) of the same edge. we can compare floats here because when an edge gets node snapped its percent_along is not the result of arithmetic/trig/etc its forced to either 0 or 1 depending on the direction of the edge.

Copy link
Member

Choose a reason for hiding this comment

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

Awesome find & fix @kevinkreiser!

@kevinkreiser
Copy link
Member Author

... and indeed we do remove node snap edge candidates that are superfluous unless its possible that we need them to find the node snapped destination edge candidate to complete what im now calling a "super trivial route". that is a route which is just routing from a node in the graph to that same node in the graph.

it turned out our check for this case casted too wide of a net and gave false positives, specifically, in the forward direction if you had a node snapped origin that was on the same edge (regular trivial route) of a NOT node snapped destination, it would see the edges were the same (trivial) but not that it wasnt actually both snapped to the same node (missed the super part). the same phenomenon happened in the reverse astar.

@danpat
Copy link
Member

danpat commented Sep 1, 2021

@kevinkreiser Looks like astar_bss.cc also has this bit of logic - what's the backstory for that, and who's maintaining it?

@kevinkreiser
Copy link
Member Author

@danpat i tried the same failure scenario with bss and it doesnt fail because for some reason the expansion happens in a different order, though they of course have different costings (ped vs auto). in both of them they start with the wrong edge, the one we should have rejected because it arrives at the origin with 0 length. but then after that unidirectional astar would keep expanding that path from the useless edge onto the correct one while bss actually starts a new path from the correct one. seems to me that somehow unidirectional astar sorts the uturn path lower than the correct origin edge. i'll write another issue about it.

regarding maintainance i would say that all who are willing are maintainers of the algorithm but @xlqian is the main author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants