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 use_tunnels option #4318
base: master
Are you sure you want to change the base?
Add use_tunnels option #4318
Conversation
Since this is a soft avoidance of tunnels, there should be a boolean set like has_tunnel in the route summary indicating whether the route uses tunnels. |
* more sustainable way to work with protobuf in cmake * let's piggyback on CMAKE_FIND_PACKAGE_PREFER_CONFIG
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.
IMO it only makes sense to expose a use_tunnel
option. PR looks generally fine, just LOTS of unrelated adverse changes in the test.
Also
- I'd personally like to see a gurka test as well for the costing option, parameterized for all modes that use this. Ideally we'd not create an additional test file, but rather consolidate the other test_use_* into one single file for the sake of compilation speed (i.e.
test_use_lit.cc
,test_use_living_streets.cc
,test_use_tracks.cc
) - an additional edge and check in gurka/test_use_feature.cc
- we should do this for all motorized vehicles I think? for ped (and bike?) we had a discussion before around safety issues, I think that'd need to be differently handled than the rest
test/parse_request.cc
Outdated
@@ -333,7 +334,7 @@ std::string get_request_str(const std::string& parent_key, | |||
return R"({")" + parent_key + R"(":{)" + get_kv_str(key, expected_value) + R"(}})"; | |||
} | |||
|
|||
std::string get_kv_str(const std::string& key, const std::vector<std::string>& values) { | |||
std::string get_kv_str(const std::string& key) { |
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 this change?
test/parse_request.cc
Outdated
@@ -457,8 +458,7 @@ void test_filter_action_parsing(const valhalla::FilterAction expected_value, | |||
validate(key, expected_value, true, request.options().filter_action()); | |||
} | |||
|
|||
void test_filter_attributes_parsing(const std::vector<std::string>& expected_values, | |||
const Options::Action action = Options::trace_attributes) { | |||
void test_filter_attributes_parsing(const Options::Action action = Options::trace_attributes) { |
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.
and why this change?
test/parse_request.cc
Outdated
@@ -1537,7 +1554,6 @@ void test_bicycle_parsing(const Costing::Type costing_type, | |||
|
|||
void test_filter_stop_parsing(const Costing::Type costing_type, | |||
const valhalla::FilterAction filter_action, | |||
const std::vector<std::string>& filter_ids, |
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.
and this?
test/parse_request.cc
Outdated
@@ -1555,7 +1571,6 @@ void test_filter_stop_parsing(const Costing::Type costing_type, | |||
|
|||
void test_filter_route_parsing(const Costing::Type costing_type, | |||
const valhalla::FilterAction filter_action, | |||
const std::vector<std::string>& filter_ids, |
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.
and this?
test/parse_request.cc
Outdated
@@ -1573,7 +1588,6 @@ void test_filter_route_parsing(const Costing::Type costing_type, | |||
|
|||
void test_filter_operator_parsing(const Costing::Type costing_type, | |||
const valhalla::FilterAction filter_action, | |||
const std::vector<std::string>& filter_ids, |
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.
and this?
valhalla/proto_conversions.h
Outdated
@@ -566,4 +566,4 @@ inline void from_ll(valhalla::Location* l, const midgard::PointLL& p) { | |||
l->mutable_ll()->set_lng(p.lng()); | |||
} | |||
|
|||
} // namespace valhalla | |||
} // namespace valhalla |
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.
and this?
src/sif/autocost.cc
Outdated
@@ -399,6 +402,14 @@ AutoCost::AutoCost(const Costing& costing, uint32_t access_mask) | |||
toll_factor_ = use_tolls < 0.5f ? (4.0f - 8 * use_tolls) : // ranges from 4 to 0 | |||
(0.5f - use_tolls) * 0.03f; // ranges from 0 to -0.15 | |||
|
|||
// Preference to use tunnel roads. Sets a tunnel | |||
// factor. A tunnel factor of 0 would indicate no adjustment to weighting for tunnel roads. |
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.
// factor. A tunnel factor of 0 would indicate no adjustment to weighting for tunnel roads. | |
// factor. A tunnel factor of 0.5 would indicate no adjustment to weighting for tunnel roads. |
I'd recommend you go through the Github view of the diff in https://github.com/valhalla/valhalla/pull/4318/files after you commit (ideally in your own IDE before you even push to not needlessly run CI with stuff that'll break for sure). |
Bonus points for adding comments on your own PR to explain non-obvious changes, which saves tons of time for the reviewers. (e.g. here I personally would have noted that the costing change is a 100% copy of |
@nilsnolde for ped and bike then would you suggest to have a seperate PR? |
If you’re interested in the functionality, I’d prefer a separate PR bcs the discussion would be very different and we’d first open an issue for that. But don’t feel obliged to take care of that too. It’s fine to not expose for those modes for the time being. |
there is a slight technical detail here that i thought someone mentioned but i dont see it mentioned here: we create shortcuts overtop of bridges and tunnels which means the costing will not avoid a tunnel if its part of a shortcut that the algorithm is using. given that tunnels arent as prevalant as bridges we could probably get away with adding tunnel as an attribute that has to match during shortcut building. bridges could be a pretty big problem though.. |
i also agree with @nilsnolde that we should consider just adding the rest of the pr looks great! |
3573129
to
5beb6cb
Compare
Just as a note: the only thing missing is a gurka test to verify the behavior of the costing option. Then it’s good to merge. |
@nilsnolde is it not covered in the test_use_feature test? can you give any reference to any other gurka test specific to costing option in case you are talking about something else? |
No, that is only testing that it's flagged in the response, it's not testing that the costing is actually doing anything with it. I already described it: #4318 (review). If you have specific questions, feel free to ask. |
Oh, and an important note: if we use tunnels to break up shortcuts, we'll need to do a thorough perf test and see if it's fine. Ideally that's done by the committer, but it's poorly documented atm. I always wanted to document that a bit better. We might want to add some Switzerland routes for this:) |
Add Tunnel factor to Autocost
Presently valhalla cannot avoid roads if tunnel is present. These changes will add tunnel factor in Edge Cost Calculations.
The program was tested solely for our own use cases, which might differ otherwise. I acknowledge that these changes have the potential to impact other use cases, and it is essential to exercise caution and thorough testing when merging them to the master. Your expert opinion is requested to help us review, test, and adapt these modifications as needed. I am also looking forward to other implementation ideas and discussions about how we can tackle this issue. Aditionally i am trying to learn more about valhalla and need your comments to improve my coding
Tasklist
Adrika Mukherjee adrika.mukherjee@mercedes-benz.com, Mercedes-Benz Tech Innovation GmbH
Provider Information