-
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
Add logic to penalize certain roads in the car profile #3636
Conversation
4fd41a7
to
9cb880b
Compare
profiles/lib/handlers.lua
Outdated
sideroad_penalty = side_road_multipler; | ||
end | ||
|
||
local penalty = service_penalty * width_penalty * alternating_penalty * sideroad_penalty |
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.
i haven't worked with weights yet, but for speed reductions my experience is that multiplying penalites doesn't give good results. it's better to use mininimum. the problem is at a modest reduction for all parameters results in a a very low speed, effectually causing the way to be unroutable.
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.
👍 Updated to use the minimum of all set penalties
5ac07bc
to
9600ae8
Compare
f29a173
to
95f494c
Compare
95f494c
to
a039549
Compare
a039549
to
95f494c
Compare
95f494c
to
85d330d
Compare
@@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(test_tile) | |||
const auto rc = osrm.Tile(params, result); | |||
BOOST_CHECK(rc == Status::Ok); | |||
|
|||
BOOST_CHECK_EQUAL(result.size(), 114033); | |||
BOOST_CHECK_EQUAL(result.size(), 113824); |
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.
Why does this change?
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.
I think it's because the duration values encoded in the vector tiles changed. It uses a delta encoding so the size is heavily data dependent.
@@ -31,6 +59,8 @@ module.exports = function () { | |||
usingShortcut = row[direction]; | |||
} | |||
|
|||
// TODO split out accessible/not accessible value from forw/backw headers | |||
// rename forw/backw to forw/backw_speed |
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.
Can you ticket this
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.
if (result[direction].rate) { | ||
outputRow[rate] = !isNaN(result[direction].rate) ? | ||
result[direction].rate.toString() : | ||
result[direction].rate.toString() || ''; |
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.
Looks strange, is line 39 required?
profiles/lib/handlers.lua
Outdated
sideroad_penalty = side_road_multiplier; | ||
end | ||
|
||
local penalty = math.min(service_penalty, width_penalty, alternating_penalty, sideroad_penalty, hov_penalty) |
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.
Not sure if this is semantically correct - e.g. a narrow alternating oneway should have a higher penalty than a narrow street, right?
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.
One of Emil's concerns was that this usually leads to roads becoming unroutable instead of penalized.
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 should be based on considering the nature of the inputs.
regarding speed: if a way is narrow and has a bad surface, it's probably not going to be slower than if it's just narrow. on the other hand, alternating directions means you're going to spend time standing still, so it might make sense to multiple that factor, e.g speed = speed*min(width,surface)*alternating
| service | parking | 5 km/h +-1 | 5 km/h +-1 | | ||
| highway | service | forw | backw | forw_rate | | ||
| service | alley | 15 km/h +-1 | 15 km/h +-1 | 2 | | ||
| service | emergency_access | | | | |
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.
Now that we have the ability to penalize access-limited ways, should emergency_access
just become like all the others (i.e. allow routing if a pin is dropped) ?
On second thought, I guess not - cut-off roads on freeways that are emergency-only should never be routed over, and because they're short, even heavily penalizing them is not sufficient to prevent access. We would need to implement turn-based penalties for that to work.
So, nevermind, but I've written all this stuff now, so I'm going to post it anyway for perpetuity.
4e7bccc
to
5b783ba
Compare
Continuation of #3276 against the right branch.
Issue
In the past we have used penalties on the speed to make routing over certain types of roads less appealing to the routing engine. However this screws with the ETAs when you actually need to go over those penalized roads.
This PR changes this speed penalties to weight penalties which was unlocked by fixing #77.
This means certain tests that test for applying the penalties in the car profile will fail now. They need to be adapted to test if the speed is unchanged while the rate/weight is adjusted for the penalty.
Tasklist
rate
andweight