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

osrm-customize with conditional restrictions multiple times #6117

Open
fubupc opened this issue Sep 4, 2021 · 2 comments · May be fixed by #6399
Open

osrm-customize with conditional restrictions multiple times #6117

fubupc opened this issue Sep 4, 2021 · 2 comments · May be fixed by #6399

Comments

@fubupc
Copy link

fubupc commented Sep 4, 2021

Background: I want to make conditional restriction working, e.g. no_left_turn@12:00-18:00, as far as I know, the method is using following preprocess commands:

osrm-extract --parse-conditional-restrictions ...
osrm-partition ...
osrm-customize --parse-conditionals-from-now <utc timestamp> --time-zone-file <timezone geojson> ...

For now it somehow works: if the first time do osrm-customize with a timestamp at 10:00, the above restriction is inactivated, and then if do osrm-customize with a timestamp at 13:00, then above restriction will become activated.

The problem is: if then we do osrm-customize again with a timestamp at 19:00 the restriction is still activated (should not because 19:00 is not between 12:00-18:00).

I tried to read the source code of related part, this is my understanding:
turn weight stored in .osrm.turn_weight_penalties file, when osrm-customize executed with conditional restriction parameters, it will load .osrm.turn_weight_penalties file and update/overwrite related weight with an max turn weight value (max float or int) if conditional restriction should activate according to passed-in timestamp, and then write it out. So the previous turn weight is lost as long as the restriction become activated once.

My question is: is my understanding correct? If it works by design then how to make conditional restriction switch between activated and inactivated repeatedly with only osrm-customize?

PS: A simple solution maybe:

  1. osrm-cutomized without conditional restriction parameters to make sure no conditional restriction overwrite native turn weight.
  2. backup the .osrm.turn_weight_penalties file
  3. every time do osrm-cutomized again first copy to .osrm.turn_weight_penalties from the backup file

Or is there some better method?

Thanks for reading!

@mjjbell
Copy link
Member

mjjbell commented Sep 6, 2021

This should work as expected. Rerunning osrm-customize with a different timestamp should change the restrictions applied.
@fubupc are you able to provide reproduction steps for what you are seeing?

@NguyenSen
Copy link

I have the same problem
@mjjbell I try it and agree with @fubupc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants