abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
507 stars 122 forks source link

Adding penalties averages ratios between roads, so multiplying should be used. #610

Open Stapawe opened 1 year ago

Stapawe commented 1 year ago

Let's assume that with (un)paved paths you want, or take your time, to cycle twice as long on an asphalt path than an unpaved path and you have two routes between A and B

If you say you want to trade off the noise for twice time longer route, then the cost factor should increase twice time, but addition decreases the influence of the penalty with higher starting cost factor. With multiplying it would be:

I'm impressed by the recent addition of noise and forest penalties and so on. Thanks und danke

quaelnix commented 1 year ago

@Stapawe, here is a profile that does it like that: https://github.com/quaelnix/brouter-profiles-db/blob/main/gravel.brf

I haven't had time to try this concept out on the standard profiles. But I agree that it would be worthwhile.

EssBee59 commented 1 year ago
  • So noise on both routes changes your route to CYCLE LONGER time in noise on the unpaved path.

Hello Stapawe,

Thank for your interesting example! Assuming, the cost factor reflects lineary the time the biker needs for a distance, then is your calculation right! But, is this allways the case? As example, replace above the "unpaved path" with a primary highway, and the "paved path" with a track highway plus tracktype=1.. (A profile for racebike + very low traffic would set the basic costfactor in a similar way!)

In that case, considering the noise I would prefer the primary highway, because the speed on primary is higher as on track.

I think, penalties of each kind (example noise") can change (destroy is not the right term) the ration between roads (in the same way as surface, highway type etc...) ?

Last week I also discovered "side effects" by adding costs on the costfactor https://github.com/abrensch/brouter/pull/579#issuecomment-1674315124 That for, I am now prudent by adding penalties..

A better solution as adding is perhaps possible, I think currently each profile should decides.

Regards and thank for your comment about the new tags, it was a hard job to introduce that! Ess Bee

Stapawe commented 1 year ago

Hello Ess Bee I wrote "destroys" because I assumed that other people do like me :) and compare different types of roads with different surface to the most desirable, with cost factor 1, and among each other. But when you add different penalties you will get something different, especially when you add many different penalties, then roads with cost factor 1 become rare. I use hybrid bike and in my profiles I check whether highway is unpaved and what tracktype is. I've checked your profile in linked post and I didn't know one can use surface penalty, what is much cleaner.

As example, replace above the "unpaved path" with a primary highway, and the "paved path" with a track highway plus tracktype=1.. (A profile for racebike + very low traffic would set the basic costfactor in a similar way!)

In noise +3

To have a situation when addition changes route, there must be a shorter way with higher cost factor than longer way, but cost factors above are very similar - 8 % difference and 5 % in noise. Equivalent distance would be 8.2 : 7.8 (cost factors in noise) = 1.051 : 1

Addition Without noise, equally costly distances will be 5.2 : 4.8 = 1.083 : 1 so

So switching to primary because of noise would be only for tracktype 1 1.051 - 1.083 times longer than primary, if I didn't make any error in calculations. Do you prefer this or situation when no river is found at all on the possible routes, the new routing would be the same as the original routing without the consider_river option? Regards

quaelnix commented 1 year ago

Assuming, the cost factor reflects lineary the time the biker needs for a distance, then is your calculation right! But, is this allways the case?

It does not matter whether the cost factor reflects the travel time or not. An unconditional addition or subtraction of weights always destroys the weight ratio between different types of roads and thus the characteristic of the profile.

This effect is especially pronounced with the new forest and river tags, since a) most roads don't carry these tags, and b) the penalty has to be pretty high to get the desired effect.

So switching to primary because of noise would be only for tracktype 1 1.051 - 1.083 times longer than primary

Right, and besides, it would be a simple task to add a special logic of "if it's noisy, you'd better take fast roads".