[OSRM-talk] profile.lua car.lua tuning

Michael Chesterton michael at chesterton.id.au
Thu Nov 5 14:35:37 UTC 2015


A bit of a long one.

I've read a few messages from this list about tuning car.lua,
not all of them yet, but the ones i have read were different
problems, my problem is it's too fast. If a trip would take 30
minutes in real life, osrm might say it takes 20 minutes.
primarily because of congestion in the city.

Firstly I can lower the speed of roads, and that works in the city,
but now trips 30+km outside the city are too slow.

If I penalise traffic lights more (the default is 2, and I think that
is 2 seconds based on a comment in another lua file, which to me
is surprisingly short) osrm starts going to great lengths to avoid them,
with lots of turns. So I penalise turns more, then i mess up the
penalise right hand turns more than left hand turns algorithm,
and the trip api plans a route with more right hand turns than

with a default profile.lua with one change

local turn_bias                 = 0.7

everything is good except it's to fast in the city.
If I make one extra change,

local turn_penalty              = 40

which is too expensive, but i'm just testing, it starts favouring
right hand turns.

Can someone make sense of this and offer a fix or a suggestion?
Maths and computer science algorithms aren't my strong point.

If I do the turn calculations by hand for a 90 degree turn,

right hand turns cost 57
left hand turns cost 28

further testing

local turn_penalty              = 20

favours left hand turns, good. then I make one more change

traffic_signal_penalty          = 20

and it starts favouring right hand turns again :(

another question, assuming 3 left hand turns around the block cost
more than 1 right hand turn, does the turn bias affect viaroute, or is
it mainly only trip?

More information about the OSRM-talk mailing list