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

Fix adding traffic signal penalties during compression #6419

Merged
merged 1 commit into from
Oct 23, 2022

Conversation

mjjbell
Copy link
Member

@mjjbell mjjbell commented Oct 23, 2022

Issue

As detected by @GitBenjamin in b17cbb4#r87212707

Weight and duration penalties are flipped in the lambda function that applies penalties from traffic signals.

Duration is in deciseconds, whilst weight is multiplied by 10^weight_precision, with weight_precision being 1 by default.

Therefore, for default routability profile, the penalties end up being the same, hence why no tests picked this up.

If distance weight is used however, it will incorrectly apply an additional penalty to the weight, and not add the traffic signal delay to the duration in the routing graph.

To confuse things further, in some API responses the values are correct because they use geometry data instead, but it's still possible that a sub-optimal route was selected.

However, given the distance weight is in meters, and the additional penalty per traffic light would be 20, it's unlikely this would have changed the routing results.

In any case, we correct the function to apply the arguments correctly.

Tasklist

Requirements / Relations

I will make a follow-up PR that implements #3601 to stop these types of mistakes, any maybe even detect some others in the codebase.

Weight and duration penalties are flipped in the lambda function
that applies penalties from traffic signals.

Duration is in deciseconds, whilst weight is multipled by
10^weight_precision, with weight_precision being 1 by default.

Therefore, for default routability profile, the penalties end up
being the same, hence why no tests picked this up.

If distance weight is used however, it will incorrectly apply an
additional penalty to the weight, and not add the traffic signal
delay to the duration in the routing graph.

To confuse things further, in some API responses the values are
correct because they use geometry data instead, but it's still
possible that a sub-optimal route was selected.

However, given the distance weight is in meters, and the additional
penalty per traffic light would be 20, it's unlikely this would
have changed the routing results.

In any case, we correct the function to apply the arguments correctly.
@mjjbell mjjbell merged commit 9ad432c into Project-OSRM:master Oct 23, 2022
mattwigway pushed a commit to mattwigway/osrm-backend that referenced this pull request Jul 20, 2023
…6419)

Weight and duration penalties are flipped in the lambda function
that applies penalties from traffic signals.

Duration is in deciseconds, whilst weight is multipled by
10^weight_precision, with weight_precision being 1 by default.

Therefore, for default routability profile, the penalties end up
being the same, hence why no tests picked this up.

If distance weight is used however, it will incorrectly apply an
additional penalty to the weight, and not add the traffic signal
delay to the duration in the routing graph.

To confuse things further, in some API responses the values are
correct because they use geometry data instead, but it's still
possible that a sub-optimal route was selected.

However, given the distance weight is in meters, and the additional
penalty per traffic light would be 20, it's unlikely this would
have changed the routing results.

In any case, we correct the function to apply the arguments correctly.
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.

None yet

2 participants