Open hungerburg opened 3 years ago
You may review the current state of the Hiking profile template developement here.
The purpose of altitude penalization is not to calculate time equivalence of alternative routes, but to prioritize them according some criteria. Some profile modifications may go fore this time equivalence, other ones may go to prefer altitude dynamics and others may prefer conservative flatness,
BRouter itself calculates internally ETA ( estimated time of arrival ) according a built-in formula, independent on profile settings. Not sure now, if by simple values for flat speed and ascend/descend speed like the Naismith's rule(*) , of by more advanced formula like the Tobler function(**).
Note also those 7+3 values are in context of my profile just baseline values of the profile variables [up|down]hill[cost|cutoff]value ). Profile recalculates them according to the used tweaking parameters to the final values of of BRouter internal variables [up|down]hill[cost|cutoff].
Yes, it could be set by your way, but rather by optional turning the altitude penalty tweaking system off ( or bypassing it ) and setting the particular values directly to [up|down]hill[cost|cutoff]. But the ability of tuning the route preference based on other then time criteria would be gone.
(*) Naismith's rule : Allow one hour for every 3 miles (5 km) forward, plus an additional hour for every 2,000 feet (600 m) of ascent.
(**) Tobler's hiking function ( BTW of the Swiss origin too ). An interesting thing would be to set the cutoff values to values equivalent to ascend/descend slopes where the speed goes somewhere below 4-5 5 km/h, perhaps 4.5 km/h.
To follow the Swiss rule, you can change the values for the baseline settings
from the original
assign uphillcostvalue 7
assign uphillcutoffvalue 3
assign downhillcutoffvalue 3
assign downhillcostvalue 7
to
assign uphillcostvalue 10
assign uphillcutoffvalue 0
assign downhillcutoffvalue 0
assign downhillcostvalue 5
I could later implement withing the template a "Swiss switch" to do it automatically,
Notice that the setting the cutoffs to 0 will have the effect it would stop to discriminate shorter but steeper climbs with the same altitude gain. By other words, if there were 2 otherwise identical routes, but 1 climbs 100m in 500m and then going 500 m flat, the second steadily climbs 100m during 1000m.
The original settings would prefer the latter, the new settings mirroring the Swiss rule would take them as equal. Similarly for descends. I may want to experiment with values 1 + 10.5, or 2 + 11, instead of 0 + 10. ( 0.5 + 5.25 or 1.0 + 5.5 for descend. ) to address this a little.
Just some quick thoughts: The swiss rule is mentioned on the Naismith's rule Wiki article at the very end below Langmuir corrections, at least quite close. The difference is mostly that the Swiss are less sportive than the Scots, they only climb 400 instead of 600, and they also walk 4 instead of 5. That is why I wrote, I think I got you, because you seem to be fit as a fiddle, so to say. I consider the Swiss factors more reasonable - hikes in Switzerland go over rough terrain, that slows down, also hikes last several hours havin 1500 or more of ascent, performance will suffer, breaks have to be accounted for. Both formulas score in units of time, not energy or anything else. For Brouter it might seem necessary to convert time to distance, but that can only be done, when a speed is known. Will now toy a little with the profile. Can I use the linked one from above?
Hmm, if uphillcutoffvalue=0, I can change uphillcostvalue to 1000 or 10000 and no change in route selection, only time to calc route will grow (exponentially even?) The shortest path will always win. uphillcutoffvalue must not be 0.
Brouter calculates everything as real or equivalent distance, including all prioritization or penalties. Just after all routing is done, it calculates for the chosen route ETA from the route altitude profile via an internal formula.
It is not a problem to recalculate speeds to equivalent distance penalties if equal time should mean equally good routes, assuming the rest the same.
Yes, you can play with that profile in your link. This is a development version, you can replace develop by master in the URL to get the master version.
Think about the steepness discrimination, as the Swiss rule ignores it.
Just note about Tobler - he was a famous geographer of Swiss origin, and used data of another Swiss geo/cartographer. Still thinking I may implement it in some way ( options are limited ) as one of the altitude penalisation profiles, along with the Swiss rule.
Just out of curiosity, I loaded a gps trace of mine, more or less a random walk, and drew a fit with debug hiking profile, https://brouter.de/brouter-web/#map=15/47.3180/11.4531/osm-mapnik-german_style,route-quality&lonlats=11.457281,47.310162;11.458504,47.313563;11.459641,47.319335;11.46793,47.32111;11.445211,47.325258 - brouter suggests 4h duration, a value quite reasonable for a signpost.
The swiss rule should give: 5/4 + 1200/400 = 4.25h. Naismith would give 5/6+1200/600=2.83h - took me 2:30 including break, So I earned a Scotsman :) Your profile modifies distance, the brouter duration is quite within expectations, so it must do something very right!
Hmm, if uphillcutoffvalue=0, I can change uphillcostvalue to 1000 or 10000 and no change in route selection, only time to calc route will grow (exponentially even?) The shortest path will always win. uphillcutoffvalue must not be 0.
This I am trying to tell you: The Swiss rule assumes the cutoff value 0 and does not discriminate steepness.
Your profile modifies distance, the brouter duration is quite within expectations, so it must do something very right!
The profile modifies distance just as a function to compare routes. For the ETA calculation, Brouter takes real distance, together with altitude profile and possibly (not sure for foot profiles) the way quality.
This I am trying to tell you: The Swiss rule assumes the cutoff value 0 and does not discriminate steepness.
That is, what the Wiki says; But think of it: ascent and distance are independent variables and the sum is just that, a sum. Which means, that in the end, steepness is accounted for! Because it adds the very same elevation penalty to different length trails and therefore not proportionally to length., I thought, that is the essence of steepness. Perhaps, I have to sleep about that.
That is, what the Wiki says; But think of it: ascent and distance are independent variables and the sum is just that, a sum. Which means, that in the end, steepness is accounted for! Because it adds the very same elevation penalty to different length trails and therefore not proportionally to length., I thought, that is the essence of steepness. Perhaps, I have to sleep about that.
No, you are mistaken.
Imagine 2 routes, by quality equal, both 10 km long with 500m elevation gain both.
One steadily climbs by rate 50 m/km.
The other climbs 5 km by rate 100m/km and the rest 5 km is flat.
cutoff=0 would take both routes as equal. cutoff>0 would take the former route as better.
As if the cutoff is e.g. 3% as the default values, 5% steepness of the former route would be calculated just as 2%, while the 10% slope of the latter route would be considered as 7%.
2% on 10km is 200m, giving the penalty 200 7 = 1400m. 7% on 5 km is 350m, giving the penalty 350 7 = 2450m.
So the twice steeper half long slope would be penalized almost twice as much.
Note that this penalization is the extrapolation for long slopes. Penalization of short slopes differs due the way how the BRouter altitude buffer works. Until the buffer is filled, typically 10 m, BRouter pretends there is no slope.
Still awake here: Of course you are right, if length is the same and ascent is the same, steepness is the same too, at least overall. Curiously, the hiking profile prefers route 2, the one with the flat stretch, at least, that's my observation. Will check the math tomorrow.
The point is, the same overall steepness is not the decisive factor, as the nonzero cutoff value causes higher altitude-related penalty for steeper climbing to the same altitude.
But this is valid if both routes are otherwise equal. If they differ in other way than altitude profile, all bets are off. Either of them can be evaluated as better, depending on profile priorites not based on altitude. E.g. if a half steep route is about twice as long, or has less appreciated OSM way or surface, the steeper route may be easily preferred.
Hello poutnikl, taking over from brouter repository: In https://github.com/abrensch/brouter/issues/283 you gave some insight, in how ascent is accounted for:
At 4kmh walking speed, this should take me 1.425 hours (5.7/4)
The swiss formula (acc. to https://de.m.wikipedia.org/wiki/Marschzeitberechnung) goes like this : duration in hours = (ascent in m / 400) + (distance in km / 4). Descent may get a divisor up to 800.
Above walk will take me 1.875 hours (250/400 + 5/4)
Can this be tuned to match? Too lazy now. A thought experiment: When the distance penalty gets larger, the values will get closer. When comparing routes of different length, a bigger penalty will have more influence on the shorter route, than on the longer route. So the router will base its decision less on distance.
Of course this would also work the other way. If you climb 500 m/h, the swiss formula will yield 1.125 hours. I think I got You!