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

"soft" ignore restrictions #4606

Merged
merged 20 commits into from Mar 13, 2024

Conversation

chrstnbwnkl
Copy link
Contributor

@chrstnbwnkl chrstnbwnkl commented Feb 24, 2024

Issue

Follow-up to #4574, fixes #4571. ~~ Open to better ideas for a name. I'll list more as well if I come up with any. @nilsnolde's first take was ignore_safe_restrictions. ~~

Edit: sticking with ignore_non_vehicular_restrictions now.

Tasklist

  • Add tests
  • Add #fixes with the issue number that this PR addresses
  • Update the docs with any new request parameters or changes to behavior described
  • Update the changelog

@chrstnbwnkl chrstnbwnkl marked this pull request as ready for review February 24, 2024 09:35
Copy link
Member

@nilsnolde nilsnolde left a comment

Choose a reason for hiding this comment

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

Not sure about another name either (other than ignore_safe_restrictions which is also not very good), possibly only ignore_turn_conditional_restrictions, bit long but describes best what it does.

There's a few more things to do, ideally they'd be tested with a parameterized test somewhere.

Also I know these kind of options weren't documented before, but we really should start documenting them. Would you be up for that? If you feel like including the other ignore_*'s as well, that'd be much appreciated. There's a collection of undocumented options here: #3760. One after the other:)

valhalla/sif/dynamiccost.h Outdated Show resolved Hide resolved
src/sif/truckcost.cc Outdated Show resolved Hide resolved
@chrstnbwnkl
Copy link
Contributor Author

I think ignore_turn_conditional_restrictions does not convey that we are ignoring e.g. maxaxles, so in that regard ignore_safe_restrictions actually describes it better IMO 😄

Anyway just ignore everything around naming in this PR for now, it's a bit all over the place. I'll add some more tests that test some more mode specific cases where ignore_<whatever>_restrictions shouldn't lead to a successful route.

Copy link
Member

@nilsnolde nilsnolde left a comment

Choose a reason for hiding this comment

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

apart from naming: there's still costings missing.. ped not necessary, but why not the rest?

test/gurka/test_ignore_restrictions.cc Outdated Show resolved Hide resolved
Copy link
Member

@nilsnolde nilsnolde left a comment

Choose a reason for hiding this comment

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

looks good to me now!

then we can focus on the naming of it. I don't have a very strong opinion, though the only option I don't really like tbh is the current ignore_common_restrictions.

@@ -605,7 +608,7 @@ class DynamicCost {
if (access_type == baldr::AccessType::kTimedAllowed)
time_allowed = true;

if (current_time == 0) {
if (current_time == 0 || ignore_non_vehicular_restrictions_) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd put this into the if on line 602, so time_allowed will stay false if this option is given and we don't need it in the return below.

gate_cost_{0.f, kDefaultGateCost, kMaxPenalty}, gate_penalty_{0.f, kDefaultGatePenalty,
kMaxPenalty},
gate_cost_{0.f, kDefaultGateCost, kMaxPenalty},
gate_penalty_{0.f, kDefaultGatePenalty, kMaxPenalty},
Copy link
Member

Choose a reason for hiding this comment

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

it doesn't seem like anything changed here. is it possible that you installed clang-format also from pacman rather than mason? looks like a typical "new version" edit

Comment on lines 315 to 317
oneof has_ignore_non_vehicular_restrictions {
bool ignore_non_vehicular_restrictions = 84;
}
Copy link
Member

Choose a reason for hiding this comment

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

no oneof

@nilsnolde
Copy link
Member

I edited the things we talked about @kevinkreiser , should be good now

nilsnolde
nilsnolde previously approved these changes Mar 4, 2024
@nilsnolde
Copy link
Member

oops that broke smth

…more/most of them, should refactor some), similar to the ranged equivalent
Comment on lines +100 to +108
#define JSON_PBF_DEFAULT_V2(costing_options, def, json, json_key, option_name) \
{ \
costing_options->set_##option_name( \
rapidjson::get<std::remove_cv< \
std::remove_reference<decltype(def)>::type>::type>(json, json_key, \
costing_options->option_name() \
? costing_options->option_name() \
: def)); \
}
Copy link
Member

Choose a reason for hiding this comment

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

added one for non-oneof things. most boolean options have false as default, we should refactor some and remove the oneofs where it can be done.

@nilsnolde
Copy link
Member

nilsnolde commented Mar 4, 2024

so the normal release build works, but the arm & x86 lint-debug build fail. that's weird.. they're failing with

2024/03/04 16:17:01.373591 [INFO] Parsing nodes...
terminate called after throwing an instance of 'std::runtime_error'
  what():  test_linguistic_node.bin(open): No such file or directory
make[3]: *** [test/CMakeFiles/run-graphparser.dir/build.make:73: test/graphparser.log] Error 134

does that ring a bell @gknisely? seems related to #4605?

the failing test also seems to be pretty unrelated to this PRs changes, so it seems flaky.

@gknisely
Copy link
Member

gknisely commented Mar 6, 2024

so the normal release build works, but the arm & x86 lint-debug build fail. that's weird.. they're failing with

2024/03/04 16:17:01.373591 [INFO] Parsing nodes...
terminate called after throwing an instance of 'std::runtime_error'
  what():  test_linguistic_node.bin(open): No such file or directory
make[3]: *** [test/CMakeFiles/run-graphparser.dir/build.make:73: test/graphparser.log] Error 134

does that ring a bell @gknisely? seems related to #4605?

the failing test also seems to be pretty unrelated to this PRs changes, so it seems flaky.

Should just be creating a temporary file. Odd that this is failing. Are you sure unrelated?

@nilsnolde
Copy link
Member

Are you sure unrelated?

@gknisely at least this PR doesn't touch any of the graphbuilder logic or the test that fails. Just costings and some of those tests. So I'd say yeah, I'm very sure. Also the release build works. It's "just" the debug and arm build that fail that way. Locally it also doesn't fail.

@nilsnolde
Copy link
Member

hm yeah, now it's the exact opposite! the release build is failing with the same problem, debug & arm builds are fine.. had a quick look at the test, but can't see anything wrong. the only way I'd see this failing would be if gtest would execute tests in parallel which I don't think it does.

@nilsnolde
Copy link
Member

since the flaky test also fails on master's arm workflow currently, this PR should be good to merge.

@nilsnolde
Copy link
Member

we previously looked at this @kevinkreiser and there were just a few things needed to be done before merging (done here), like remove the oneof and formatting the code properly. I also needed to add another "V2" macro for non-oneofs: #4606 (comment).

@nilsnolde nilsnolde self-requested a review March 13, 2024 18:08
nilsnolde
nilsnolde previously approved these changes Mar 13, 2024
@nilsnolde
Copy link
Member

once it passes the master merge, I'd merge this too. it's been reviewed and amended.

@nilsnolde nilsnolde merged commit 28eaf7a into valhalla:master Mar 13, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants