You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should we start with one global value for u-turns (the same for all road-types, junctions, dead end streets etc.) ?
If yes, should it be possible to use different values for the u-turn costs for each profile (probably makes sense, e.g. bike is certainly not the same as car) ?
So far the u-turn costs 'live' inside TurnWeighting, but in the configuration file we would probably configure it with the encoder(s) ? Something like car|turn_costs=true|u_turn_cost=40 ? Maybe we should move the u-turn-cost into the (turn cost)encoder ? If we ever add more options like different u-turn costs for different road types etc. this configuration might become lengthy...
Once we have this configuration we definitely need to store the u-turn cost with each CH profile, because it will be fixed after the CH preparation. I think we should store it as an int in (units of seconds ?), so we do not run into floating point comparison problems when loading a profile. We could use -1 as special value indicating the u-turn costs shall be infinite (this is the default at the moment).
As a start a global U-turn cost per profile makes sense. (Later on it should be at least dependent on road_class and dead end. But let's focus in this issue just on making it "possible" not especially "configurable")
If we ever add more options like different u-turn costs for different road types etc. this configuration might become lengthy...
Yeah, before we do this it will be time to push forward the development of a yaml config per profile. Like I have done in a branch. See #193 (comment)
Do we need to allow different u-turn-costs for the same vehicle/weighting (now or in the long run) ? related: #493
Yes, I think this would be good. Like for different trucks. But probably also related to a different issue.
But let's focus in this issue just on making it "possible" not especially "configurable")
Ok, so the most 'possible and not configurable' way would be to hard-code it somewhere in the FlagEncoder then we do not even need to add it to the current config.
Ok, so the most 'possible and not configurable' way would be to hard-code it somewhere in the FlagEncoder then we do not even need to add it to the current config.
Ok first the good news: I got edge-based CH running with finite u-turn costs and most of the required changes were already done in #1640. What is even better is that according to my measurements on the Germany map it seems that the finite u-turn costs lead to less shortcuts. The routing and preparation is even the faster the smaller the u-turn costs are (right now they are infinite, so introducing finite u-turn costs should make everything faster and most importantly not slower), related #1565!
However, the more I am thinking about it the more I am asking myself where the u-turn costs should be stored. For now I put them into FlagEncoder, but this is clearly not what we want in my opinion:
Just hard-coding the u-turn costs into the different FlagEncoders does not work, because we need at least two options: infinite u-turn costs and finite (fixed value) u-turn costs. Or should we take the even simpler option here where we always use (fixed value) finite u-turn costs (I do not think this is such a good idea). Hard-coding also does not allow changing the value in unit-tests and of course we cannot really 'experiment' with the value without recompiling the code.
Overall FlagEncoder seems to be the wrong place for u-turn costs, because this class's purpose is to interpret the edge flags, but the u-turn costs are not stored within the edge-flags. Also in principle the u-turn costs can even change on a per-request basis for flexible routing algorithms, but we cannot change the u-turn costs in FlagEncoder because it is not recreated for every request (opposed to Weighting).
So I think keeping the u-turn costs in TurnWeighting makes sense for now, but we need a way to associate the u-turn costs with the CH graphs, because they can not change after the CH preparation. So far we 'identify' the CH graphs only via the Weighting, but now we need to take also into account the u-turn costs. I do not want to go too far, but I think the best way to do this would be to use something like this:
I would keep the config.yml unchanged here, except that it will be possible to specify u-turn costs like this:
# use finite u-turn costs of 40sprepare.ch.weightings: fastest|u_turn_costs=40# if nothing is specified u-turns are forbidden as beforeprepare.ch.weightings: fastest# explicitly deny u-turnsprepare.ch.weightings: fastest|u_turn_costs=-1
So I think keeping the u-turn costs in TurnWeighting makes sense for now, but we need a way to associate the u-turn costs with the CH graphs, because they can not change after the CH preparation
Isn't the association already done as TurnWeighting is still a Weighting?
Isn't the association already done as TurnWeighting is still a Weighting?
No, the CHGraphs are only identified by the Weighting and once the CH preparation is chosen based on the request parameters the weighting is wrapped with a TurnWeighting. I think this is also the reason why we separate edge/node-based Weightings in CHAlgoFactoryDecorator.
Activity
easbar commentedon Jul 16, 2019
Doing this raises several questions.
TurnWeighting, but in the configuration file we would probably configure it with the encoder(s) ? Something likecar|turn_costs=true|u_turn_cost=40? Maybe we should move the u-turn-cost into the (turn cost)encoder ? If we ever add more options like different u-turn costs for different road types etc. this configuration might become lengthy...karussell commentedon Jul 18, 2019
As a start a global U-turn cost per profile makes sense. (Later on it should be at least dependent on road_class and dead end. But let's focus in this issue just on making it "possible" not especially "configurable")
Yeah, before we do this it will be time to push forward the development of a yaml config per profile. Like I have done in a branch. See #193 (comment)
Yes, I think this would be good. Like for different trucks. But probably also related to a different issue.
easbar commentedon Jul 19, 2019
Ok, sounds like a plan!
Ok, so the most 'possible and not configurable' way would be to hard-code it somewhere in the FlagEncoder then we do not even need to add it to the current config.
karussell commentedon Jul 21, 2019
Sure!
easbar commentedon Jul 25, 2019
Ok first the good news: I got edge-based CH running with finite u-turn costs and most of the required changes were already done in #1640. What is even better is that according to my measurements on the Germany map it seems that the finite u-turn costs lead to less shortcuts. The routing and preparation is even the faster the smaller the u-turn costs are (right now they are infinite, so introducing finite u-turn costs should make everything faster and most importantly not slower), related #1565!
However, the more I am thinking about it the more I am asking myself where the u-turn costs should be stored. For now I put them into
FlagEncoder, but this is clearly not what we want in my opinion:Just hard-coding the u-turn costs into the different
FlagEncoders does not work, because we need at least two options: infinite u-turn costs and finite (fixed value) u-turn costs. Or should we take the even simpler option here where we always use (fixed value) finite u-turn costs (I do not think this is such a good idea). Hard-coding also does not allow changing the value in unit-tests and of course we cannot really 'experiment' with the value without recompiling the code.Overall
FlagEncoderseems to be the wrong place for u-turn costs, because this class's purpose is to interpret the edge flags, but the u-turn costs are not stored within the edge-flags. Also in principle the u-turn costs can even change on a per-request basis for flexible routing algorithms, but we cannot change the u-turn costs inFlagEncoderbecause it is not recreated for every request (opposed toWeighting).So I think keeping the u-turn costs in
TurnWeightingmakes sense for now, but we need a way to associate the u-turn costs with the CH graphs, because they can not change after the CH preparation. So far we 'identify' the CH graphs only via theWeighting, but now we need to take also into account the u-turn costs. I do not want to go too far, but I think the best way to do this would be to use something like this:to identify the CH graphs within
GraphHopperStorage. InCHAlgoFactoryDecoratorwe will haveinstead of:
I would keep the
config.ymlunchanged here, except that it will be possible to specify u-turn costs like this:Does this make sense ?
karussell commentedon Jul 26, 2019
Cool 👍 !
Isn't the association already done as TurnWeighting is still a Weighting?
easbar commentedon Jul 26, 2019
No, the
CHGraphs are only identified by theWeightingand once the CH preparation is chosen based on the request parameters the weighting is wrapped with aTurnWeighting. I think this is also the reason why we separate edge/node-based Weightings inCHAlgoFactoryDecorator.