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

Bug Fix for Island Edge Candidates #1835

Merged
merged 2 commits into from
May 31, 2019
Merged

Bug Fix for Island Edge Candidates #1835

merged 2 commits into from
May 31, 2019

Conversation

kevinkreiser
Copy link
Member

@kevinkreiser kevinkreiser commented May 30, 2019

dont use low reachability edge candidates if we ended up rejecting other closer high reachability edge candidates

so we have an issue where we are sometimes using edge candidates that are on disconnected islands and the penalties in thor are not accounting for it (especially for slower modes of travel like pedestrian or bike riders).

heres the before:

broken

the intuition to fixing this is that we shouldnt be using disconnected island edge candidates when we ended up rejecting many other connected edge candidates that were closer to the input location. so the changes in the pr, track the closest of those rejected well-connected edge candidates and then cull any island edges which are further away than those. the result is the following:

fixed

And we get the added benefit that using islands still works:

works

@@ -0,0 +1,4 @@
-j '{"locations":[{"lat":-33.4280388615334,"lon":-70.54088473320007},{"lat":-33.4268390099302,"lon":-70.53765535354614}],"costing":"pedestrian"}'
Copy link
Member Author

Choose a reason for hiding this comment

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

i couldnt find any good island in utrecht so i made a island routes file instead

Copy link
Collaborator

Choose a reason for hiding this comment

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

You won't believe it but there is a Prison Island in Utrecht: http://prisonisland.se/en/utrecht/ -- not disconnected from the road network though 😆.

Anyway I was able to trigger the bug on master with these coordinates in Utrecht with bike costing 5.011605999215277,52.114736949245156;5.020381755701578,52.10586968702347 if that helps.

[&pp](const candidate_t& c) -> bool {
return c.sq_distance > pp.closest_external_reachable;
});
pp.unreachable.erase(new_end, pp.unreachable.end());
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 is where we remove those island candidates that we should have never kept in the first place

@@ -642,16 +650,20 @@ struct bin_handler_t {
// the last one wasnt in the radius so replace it with this one because its better or is
// in the radius
if (!last_in_radius) {
if (closer_external_reachable)
p_itr->closest_external_reachable = batch->back().sq_distance;
Copy link
Member Author

Choose a reason for hiding this comment

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

as we are rejecting reachable candidates we keep track of how close the closest one was

}
} // not in radius or better and reachable and closer than closest one outside of radius
else if (closer_external_reachable)
p_itr->closest_external_reachable = c_itr->sq_distance;
Copy link
Member Author

Choose a reason for hiding this comment

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

same thing, remember how close this rejected one was for later so we can use it to cull low reachability candidates

danpaz
danpaz previously approved these changes May 30, 2019
@@ -0,0 +1,4 @@
-j '{"locations":[{"lat":-33.4280388615334,"lon":-70.54088473320007},{"lat":-33.4268390099302,"lon":-70.53765535354614}],"costing":"pedestrian"}'
Copy link
Collaborator

Choose a reason for hiding this comment

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

You won't believe it but there is a Prison Island in Utrecht: http://prisonisland.se/en/utrecht/ -- not disconnected from the road network though 😆.

Anyway I was able to trigger the bug on master with these coordinates in Utrecht with bike costing 5.011605999215277,52.114736949245156;5.020381755701578,52.10586968702347 if that helps.

@dnesbitt61
Copy link
Member

Curious if this fixes this case: #1575 (auto route). I think I remember looking into this and thinking that edge distance was a factor (there were multiple edge candidates). Strange thing was that this was auto only and not pedestrian and bike that were impacted.

dnesbitt61
dnesbitt61 previously approved these changes May 30, 2019
@kevinkreiser
Copy link
Member Author

@danpaz that is awesome! if its in our extract i can make a unit test, either way Ill add it to the requests file for good measure!

dgearhart
dgearhart previously approved these changes May 31, 2019
Copy link
Member

@dgearhart dgearhart left a comment

Choose a reason for hiding this comment

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

nice improvement 🚢

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

Successfully merging this pull request may close these issues.

None yet

4 participants