[Routing] Getting A* to prefer Motorways

Andreas Leupin a.leupin at hispeed.ch
Sat Sep 29 22:09:18 BST 2007


Hi Marcus, hi Jon,
even for the shortest route the heuristic isn't correct in every  
case. For example, if you are on a peninsula with the target on the  
other side of a bay it may be better to move first away from the  
target instead of searching directly a way in the direction of the  
target.
---
Andreas

Am 29.09.2007 um 18:48 schrieb Jon Bright:

> Hi Marcus,
>
> Marcus Wolschon wrote:
>>
>> The heuristic at each node is to prefer ways that
>> get the router near to the target just by calculating
>> the distance.
>
> That would be correct if you were looking for the shortest route.  If
> you're looking for the fastest route, you need to factor speed-of-road
> in to the calculation.  There's the maxspeed tag on some ways - for
> others, I'd suggest 120km/h for motorway, 100km/h for primary, 70km/h
> for secondary, 50km/h for unclassified and 30km/h for residential.   
> For
> the heuristic (which must always be optimistic), I'd suggest taking  
> the
> haversine distance and using 120km/h (or whatever the top maxspeed  
> is).
>   Then instead of comparing distances, you're comparing times - and  
> the
> motorway gets preferred.
>
> Basically, you need to adapt the heuristic to the type of route you're
> trying to achieve.  If you're trying to achieve a shortest route, your
> heuristic is correct - and so is not taking the motorway...
>
> --
> Jon
>
>
> _______________________________________________
> Routing mailing list
> Routing at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/routing

Andreas Leupin
Kretzgasse 2
CH-5416-Kirchdorf
Tel. P [+41](0)56 282 07 40
        G [+41](0)56 310 39 32
a.leupin at hispeed.ch



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/routing/attachments/20070929/b8158c22/attachment.html>


More information about the Routing mailing list