Skip to content

Don't penalize gates that have allowed access#3078

Merged
CuriOusQuOkka merged 2 commits intomasterfrom
penalize_barriers_817
May 19, 2021
Merged

Don't penalize gates that have allowed access#3078
CuriOusQuOkka merged 2 commits intomasterfrom
penalize_barriers_817

Conversation

@CuriOusQuOkka
Copy link
Copy Markdown
Contributor

@CuriOusQuOkka CuriOusQuOkka commented May 18, 2021

Issue

Gates that have specified access information should not be penalised.

  • In case any access info was specified, consider the data correct. Don't penalise the node when access is allowed.
  • Otherwise the gates can be either closed or opened, add penalty for such nodes.

The solution takes 1 spare bit from NodeInfo and OSMNode. But the collected info can also be used for other node types like bollard, sump buster and etc.

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

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

@CuriOusQuOkka CuriOusQuOkka force-pushed the penalize_barriers_817 branch 2 times, most recently from 2a2b6a9 to 078ebcb Compare May 19, 2021 11:06
@CuriOusQuOkka CuriOusQuOkka marked this pull request as ready for review May 19, 2021 11:13
@CuriOusQuOkka CuriOusQuOkka requested review from genadz and gknisely May 19, 2021 11:13
Comment thread valhalla/sif/dynamiccost.h Outdated
sif::Cost c;
c += country_crossing_cost_ * (node->type() == baldr::NodeType::kBorderControl);
c += gate_cost_ * (node->type() == baldr::NodeType::kGate);
c += gate_cost_ * (node->type() == baldr::NodeType::kGate) * (!InitiallyAllowed(node));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why do you use Allowed method instead of simple access_indication flag ?

Suggested change
c += gate_cost_ * (node->type() == baldr::NodeType::kGate) * (!InitiallyAllowed(node));
c += gate_cost_ * (node->type() == baldr::NodeType::kGate) * (!node->access_indication());

Comment thread valhalla/sif/dynamiccost.h Outdated
* @param node Pointer to node information.
* @return Returns true if access was specified for the node and access is allowed.
*/
virtual bool InitiallyAllowed(const baldr::NodeInfo* node) const {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is the purpose of this method ? how is supposed to be used ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i'll add that we must be very careful when considering expanding the scope of the costing interface and we should consider existing semantics and algorithms that make use of those and if perhaps they already could handle the functionality we are looking to achieve

from the title and a bit of looking at the diff i see that we are basically trying keep track of whether or not access was "tagged" or "inferred" for barrier nodes. i guess the idea is that if its tagged as access yes then we dont need to penalize it. if that is the case it seems to me all we need to do is:

  1. make the changes to nodeinfo to have the extra bit that says the access is tagged (i would consider naming it as such as well since we have the same concept for speeds on ways being "tagged")
  2. modify base_transition_cost to check that flag on the nodeinfo and not penalize if its there

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The main idea was to penalise the gates with no access information and additionally the gates that have restricted access. But since the fine does not affect the restricted nodes I agree that it is clearer to use the flag directly.

@CuriOusQuOkka CuriOusQuOkka force-pushed the penalize_barriers_817 branch from 7b3d6be to acd2f60 Compare May 19, 2021 14:29
@CuriOusQuOkka CuriOusQuOkka force-pushed the penalize_barriers_817 branch from acd2f60 to b84725e Compare May 19, 2021 15:16
@CuriOusQuOkka CuriOusQuOkka requested a review from genadz May 19, 2021 15:18
Comment thread CHANGELOG.md Outdated
* CHANGED: Use std::shared_ptr in case if ENABLE_THREAD_SAFE_TILE_REF_COUNT is ON. [#3067](https://github.com/valhalla/valhalla/pull/3067)
* CHANGED: Reduce stop impact when driving in parking lots [#3051](https://github.com/valhalla/valhalla/pull/3051)
* ADDED: Added another through route test [#3074](https://github.com/valhalla/valhalla/pull/3074)
* ADDED: Do not penalise gates that have allowed access [#3078](https://github.com/valhalla/valhalla/pull/3078)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* ADDED: Do not penalise gates that have allowed access [#3078](https://github.com/valhalla/valhalla/pull/3078)
* ADDED: Do not penalize gates that have allowed access [#3078](https://github.com/valhalla/valhalla/pull/3078)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

genadz
genadz previously approved these changes May 19, 2021
kevinkreiser
kevinkreiser previously approved these changes May 19, 2021
Copy link
Copy Markdown
Member

@kevinkreiser kevinkreiser 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 as well! thank you!

@CuriOusQuOkka CuriOusQuOkka dismissed stale reviews from kevinkreiser and genadz via 596288d May 19, 2021 17:37
@CuriOusQuOkka CuriOusQuOkka changed the title Don't penalise gates that have allowed access Don't penalize gates that have allowed access May 19, 2021
@CuriOusQuOkka CuriOusQuOkka requested a review from genadz May 19, 2021 17:42
@CuriOusQuOkka CuriOusQuOkka merged commit 56788d4 into master May 19, 2021
@CuriOusQuOkka CuriOusQuOkka deleted the penalize_barriers_817 branch December 18, 2021 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants