-
Notifications
You must be signed in to change notification settings - Fork 704
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
Unpaved roads #3240
Unpaved roads #3240
Conversation
c514e10
to
8a28ebb
Compare
8a28ebb
to
dba9d7b
Compare
The light demo of using the exclude_unpaved option:
|
@maksimandrianov can you please fill out the description of the pr just for book-keeping purposes. just a brief description of the changes. also dont forget to add it to the costing documentation in |
There are two implementations of the exclusion unpaved roads from a route in this PR:
Examples:
|
origin and destination points are usually set intentionally so if one of them gets snapped to the unpaved road - why shouldn't we use it. The second (up-to-date) implementation definitely makes sense to me 👍 Though there's a small pitfall. In this case we don't say "get out of the unpaved road asap" so we can make completely-unpaved route in theory. It doesn't seem like a blocker for this PR imho, just wanted to share |
@kevinkreiser @dnesbitt61 don't we usually have a range(0 to 1) for use_* options? Not sure if the naming (use_unpaved_roads) is correct here. Thoughts? cc @maksimandrianov |
@gknisely yes exactly, use_* options are in the range of 0-1, meaning they are not hard avoids but a soft avoid on a finite scale. if you want to exclude certain types of roads from the start or end of the route, as in its not allowed to use those as candidates, then you should look into how loki does excludes. that is done in a different part of the request using the search filter. here is where it gets applied: https://github.com/valhalla/valhalla/blob/master/src/loki/search.cc#L38-L42 |
@maksimandrianov I think that the above is a better implementation. Thoughts ^ |
I agree that 0 should not be a hard exclusion of unpaved roads in the path but that they should be severely penalized. in the cases where unpaved roads are the only way between two locations we need to allow for that and this is the strategy that the project has followed since we started allowing tweaking costing in this way. we can do hard exclusion on the search candidates as i pointed out above but have yet to add hard exclusion in the path finding phase. not that we couldnt do that, but we need to do a bit of a design process there to make sure it works for all cases where we would want to do that. id argue that is not so useful and not so common that a person will tolerate absolutely no unpaved roads or no highways or not tolls for example. if that is the only way to go, they'd rather have A route than none or than one that makes them drive 2 hours out of their way |
To avoid that we can penalize unpaved roads more than ordinary roads. |
@kevinkreiser I think in this case hard exclusion is more preferable and clear way. There are several reasons for that I see:
P.S. if we treated all |
But we want to see the hard exclusion here. I cannot imagine how the level of avoidance of unpaved roads can help drivers. |
If it is a problem I can rename this variable. |
Unfortunately, if I will fix naming, thank you for the detailed explanation! |
completely agree, we shouldn't put different meanings for two |
@maksimandrianov @genadz yeah i think if we change the name to something else, then we could also migrate the other use_ options to match that naming and depricate as i mentioned in the last part of my previous comment so now the real question is, what is a better name than |
src/sif/autocost.cc
Outdated
@@ -412,7 +412,8 @@ bool AutoCost::Allowed(const baldr::DirectedEdge* edge, | |||
((pred.restrictions() & (1 << edge->localedgeidx())) && !ignore_restrictions_) || | |||
edge->surface() == Surface::kImpassable || IsUserAvoidEdge(edgeid) || | |||
(!allow_destination_only_ && !pred.destonly() && edge->destonly()) || | |||
(pred.closure_pruning() && IsClosed(edge, tile))) { | |||
(pred.closure_pruning() && IsClosed(edge, tile)) || | |||
(!use_unpaved_roads_ && !pred.unpaved() && edge->unpaved())) { |
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 like this trick of using a bit to specify whether the predecessor was or wasnt unpaved instead of keeping track of the pruning state. i think its easier to reason about than setting and unsetting the pruning. we should switch to doing this for closures. cc @mandeepsandhu
The bicycle costing option avoid_bad_surfaces does a hard exclusion when set to a value of 1. Not sure if I like the naming of this option, but it does mix penalties and exclusion. |
@dnesbitt61 i had the same thought, use the term |
May be do we leave |
@kevinkreiser, @genadz the naming was fixed, PTAL |
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.
other than the change to the docs wording, this looks good to me. i would like @gknisely 's opinion on the tagging values though
@maksimandrianov please add an entry to the changelog. a new request parameter certainly deserves an entry in the changelog |
@@ -122,6 +122,7 @@ The following options are available for `auto`, `bus`, `hov`, `taxi`, and `truck | |||
| :-------------------------- | :----------- | | |||
| `height` | The height of the vehicle (in meters). | | |||
| `width` | The width of the vehicle (in meters). | | |||
| `exclude_unpaved` | This value indicates the whether or not the path may include unpaved roads. If `exclude_unpaved` is set to 1, unpaved roads are not allowed to be used in the process of generating the route path, otherwise they are allowed. | |
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.
@maksimandrianov should we mention here that it's allowed to start and end with unpaved roads, but it's not allowed to have them in the middle ?
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 agree. @maksimandrianov can you make the change log more descriptive too?
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.
Yes, I made
3de0474
to
056fb1e
Compare
056fb1e
to
efc744c
Compare
@@ -122,6 +122,7 @@ The following options are available for `auto`, `bus`, `hov`, `taxi`, and `truck | |||
| :-------------------------- | :----------- | | |||
| `height` | The height of the vehicle (in meters). | | |||
| `width` | The width of the vehicle (in meters). | | |||
| `exclude_unpaved` | This value indicates the whether or not the path may include unpaved roads. If `exclude_unpaved` is set to 1, unpaved roads are not allowed to be used in the process of generating the route path, otherwise they are allowed. If `exclude_unpaved` is set to 1 it is allowed to start and end with unpaved roads, but is not allowed to have them in the middle of the route path. | |
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.
there is some contradiction between second and third sentences. @maksimandrianov Could you rewrite 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.
done
Issue
Added the new option
exclude_unpaved
. This value indicates the willingness to take unpaved roads. Ifexclude_unpaved
is set to 1, unpaved roads are excluded from the process of generating the route path, otherwise included.Tasklist
Requirements / Relations
Link any requirements here. Other pull requests this PR is based on?