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

2015-11-06 Thread Michael Chesterton


On 06/11/15 04:18, Daniel Hofmann wrote:
> Depending on your use case (maybe only a few larger cities?) and if it
> has to scale, you could do the following (disclaimer: a bit hacky).
>
> Take a look here: this is what gets exposed to the profiles for ways:
>
> https://github.com/Project-OSRM/osrm-backend/blob/a62c10321c0a269e218ab4164c4ccd132048f271/extractor/scripting_environment.cpp#L131-L148
>
> If your use case allows for it, you might as well do distance
> calculations based on the coordinates against the nearest city center
> (that you somehow obtain and store, e.g. querying the largest n cities
> and hardcoding their coordinates, maybe borders as well).
>
> This would allow you to heuristically fine tune a correction
> coefficient, influencing the speed values depending on city center
> proximity.

Sweet, thanks Daniel, this might just work well enough for me. I only
have at the most 10 cities
to worry about. Time to experiment.

and many thanks to the other Daniel who replied, opentraffic.io looks
awesome.
I should be able to contribute data to them.

I must say this osm and related projects and the people behind them are
unbelievably
awesome.

___
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk


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

2015-11-05 Thread Michael Chesterton
Hello,

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
left.

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?
 



___
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk


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

2015-11-05 Thread Daniel Patterson
Michael,

  This is not an easy problem to solve.  Overall, car.lua represents a model of 
the world, our best guess at travel speeds based on OSM road type tags.  There 
are three problems with this:

1) Our guesses might be off
2) OSM tagging is not consistent everywhere
3) OSM might not have enough data granularity to assign different speeds to 
roads of the same class (i.e. unique speed limits)

  Here at Mapbox, we're doing a lot of work internally trying to use real-world 
measurement data to get the road model more realistic.  The results are 
promising, but unfortunately, it depends on huge boatloads of private data 
(in-vehicle GPS measurements, traffic data vendors, etc) that we're unlikely 
going to be able to share.  opentraffic.io is working towards open data to do 
this, it's pretty awesome.

  Generally, the car profile works pretty well in places like Germany where OSM 
tagging is extensive and fairly consistent.  In other areas, YMMV.  There's 
probably no real answer other than to keep experimenting with things to suit 
the OSM tagging in the area you're interested in.  As you've observed, small 
changes can have somewhat chaotic large scale effects.

daniel

> On Nov 5, 2015, at 6:35 AM, Michael Chesterton  
> wrote:
> 
> Hello,
> 
> 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
> left.
> 
> 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?
> 
> 
> 
> 
> ___
> OSRM-talk mailing list
> OSRM-talk@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk


___
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk


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

2015-11-05 Thread Daniel Hofmann
Depending on your use case (maybe only a few larger cities?) and if it has
to scale, you could do the following (disclaimer: a bit hacky).

Take a look here: this is what gets exposed to the profiles for ways:

https://github.com/Project-OSRM/osrm-backend/blob/a62c10321c0a269e218ab4164c4ccd132048f271/extractor/scripting_environment.cpp#L131-L148

If your use case allows for it, you might as well do distance calculations
based on the coordinates against the nearest city center (that you somehow
obtain and store, e.g. querying the largest n cities and hardcoding their
coordinates, maybe borders as well).

This would allow you to heuristically fine tune a correction coefficient,
influencing the speed values depending on city center proximity.

On Thu, Nov 5, 2015 at 3:35 PM, Michael Chesterton  wrote:

> Hello,
>
> 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
> left.
>
> 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?
>
>
>
>
> ___
> OSRM-talk mailing list
> OSRM-talk@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
___
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk