-
Notifications
You must be signed in to change notification settings - Fork 698
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
Change sharing criterion to avoid artificial detours #3302
Conversation
Before 'sharing' was defined as a part of shared edges of an alternative candidate. Now it's a part of shared edges of already chosen route. It prevents from getting alternatives with artificial detours.
Changed alternative_cost_extend coefficient from 1.1 to 1.2
return 0.65; | ||
} | ||
if (distance < 10000.f) | ||
return 0.6f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed min at_most_shared
coefficient from 0.5
to 0.6
if (distance < 100000.f) { | ||
// Uniformly increase 'at_most_shared' value from 0.6 to 0.75 for routes | ||
// from 10km to 100km | ||
return 0.6f + (kAtMostShared - 0.6f) * (distance - 10000.f) / (100000.f - 10000.f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced piecewise constant function with a continuous one
src/thor/alternates.cc
Outdated
if ((shared_length / total_length) > at_most_shared) { | ||
// throw this alternate away if any of the chosen paths shares more than at_most_shared with it | ||
assert(paths[i].back().path_distance > 0); | ||
if ((shared_length / paths[i].back().path_distance) > at_most_shared) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is important change. What was before:
"sharing value is a part of shared edges of an alternative candidate with some already chosen route"
now is
"sharing value is a part of shared edges of some already chosen route with an alternative candidate".
It should prevent from getting artificial alternatives with unreasonable detours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's consider a particular example:
A------------------------------------B---------C----------------------------------------D
| |
| |
| |
| |
E---------F
here ABCD
is an optimal route and ABEFCD
is an alternative candidate.
Let's assume that len(AB + CD) / len(ABCD) = 0.85
and len(AB + CD) / len(ABEFCD) = 0.75
. Current master will allow ABEFCD
to be an alternative despite the fact that BEFC
detour is obviously unreasonable. This branch will reject this alternative due to the fact that sharing = 0.85 > 0.75 = at_most_shared
value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was what was originally intended actually... good catch! i should also note though that in another pr we are looking into problems with teh path_distance not being set on the last edge label, which is where the pathinfo gets it. it is my h unch that this is in the case that we find a path using only the forward search tree but i havent proven it yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, thanks for the comment, I will check it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kevinkreiser replaced division with multiplication to avoid possible problems
@@ -28,7 +28,7 @@ constexpr float kThresholdDelta = 420.0f; | |||
// an upper bound value cost for alternative routes we're looking for. Due to the fact that | |||
// we can't estimate route cost that goes through some particular edge very precisely, we | |||
// can find alternatives with costs greater than the threshold. | |||
constexpr float kAlternativeCostExtend = 1.1f; | |||
constexpr float kAlternativeCostExtend = 1.2f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't drop performance too much, see "Performance" section in the comment above #3302 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reapprove, looks good
Changes:
Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?