0

I want to make my A-Star fast, by using heuristics. At the moment it is very slow and even slower than my Dijkstra. I thougt A-Star is in the worst case as fast as Dijkstra. I convert my OSM bounding box wiht osm2po to a postgresql database with postgis support and then I do my routing with java on android. Do I have to consider something in the osm2po configuration file to get the right weight? For the heuristics calculation I use the Manhattan distance.

asked Jun 24, 2013 at 11:13
3
  • You should use a different heuristic for the distance otherwise you're overestimating the distance which makes the results inexact - why not use the air distance (which is natural when using OSM data)? And: A* should be faster than Dijkstra otherwise something is wrong. Commented Jun 25, 2013 at 6:43
  • You mean Euclidean distance? Commented Jun 25, 2013 at 7:29
  • yes (necessary fill for SE) Commented Jun 25, 2013 at 10:02

1 Answer 1

1

Mostly an AStar is faster than a Dijkstra. But it's a superstition that it is always faster. Imagine an area shaped like a circle. Routing from the center to a border point lets expand a Dijkstra to the worst case whereby an AStar shows its optimal behavior. Driving the reverse route an AStar will expand to almost the same worst case. But in addition, an AStar has to calculate the distance to the target (using at least the Euclidean Distance calculation) which is a very expensive operation. In this case, it would be indeed slower than a Dijkstra. Nevertheless, you cannot use the Manhattan Distance. The Manhattan Distance is a good filter for expensive Distance calculations, but no alternative.

answered Jun 26, 2013 at 19:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.