[Routing] Getting A* to prefer Motorways
Jon Bright
jon at siliconcircus.com
Sun Sep 30 09:59:08 BST 2007
Hi Andreas,
Andreas Leupin wrote:
> 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.
See Frederik's reply - for A*, the heuristic should always be optimistic
about the distance/time to reach the destination - i.e. it should never
over-estimate, always under-estimate. It should therefore give the
straight-line distance (or, better, the haversine distance) between the
point it's at and the destination point.
You can have a play with A* using JSearchDemo, which helps with
understanding the algorithm: http://el-tramo.be/software/jsearchdemo
The closer the heuristic is to the actual distance required, the quicker
you'll find the optimum route.
--
Jon
More information about the Routing
mailing list