2

Consider you use A* algorithm in which heuristic can overestimate the remaining distance by a few meters. Can it happen that the final path is several kilometres longer than the really shortest path? Can you give an example of graph in which this happens, what kind of graph is it? A scenario in which Euclidean (straight line) distance can overestimate the remaining distance is:

  • The graph vertices are situated in (x, y) coordinates on a plane, where x and y are floating-point
  • There are arcs of some floating-point lengths between some vertices of the graph. The length of an arc is no smaller than the Euclidean distance between its vertices (but can be greater for bended/non-straight arcs)
  • However, while running A* algorithm you use integer arithmetic with rounding down, while A* estimate is rounded up (this is unreasonable, but just an example of how small the differences are): so you round the length of each arc down to integer number of meters, and you round A* estimate up to integer number of meters

Is there a formula which says the upper bound on suboptimality of the final path given the upper bound on how much A* heuristic overestimates the remaining distance?

Serge Rogatch
  • 13,865
  • 7
  • 86
  • 158
  • It is an algorithm question, and there are related questions: http://stackoverflow.com/questions/1012691/a-heuristic-overestimation-underestimation – Serge Rogatch Oct 24 '14 at 15:43
  • Interesting question! I have no idea why this was downvoted. – templatetypedef Oct 24 '14 at 16:32
  • 1
    This *is* an interesting question, but: (1) I don't see how the error in the final path could be larger than the amount the heuristic overestimates the distance, otherwise the path with the erroneous estimate would checked anyway (assuming that the measurement of the actual distance is accurate), and (2) this does seem to be off topic for SO and would perhaps be better suited to http://cs.stackexchange.com/ or even http://datascience.stackexchange.com/. – beaker Oct 24 '14 at 17:03
  • [Wikipedia has the answer.](http://en.wikipedia.org/wiki/A*_search_algorithm#Bounded_relaxation) – Timothy Shields Oct 24 '14 at 17:53
  • 1
    http://cs.stackexchange.com/ is in beta version, while Stackoverflow is not, and Stackoverflow has tags "algorithm", "graph", "shortest-path" and "a-star". Wikipedia has something, but I think that it doesn't make everything clear: "The path hence found by the search algorithm can have a cost of at most ε times that of the least cost path in the graph". – Serge Rogatch Oct 24 '14 at 20:15

1 Answers1

3

A* returns when the partial answer it retrieves (which is the partial answer with smallest estimated total distance to reach the goal) has in fact reached the goal. Standard A* guarantees to find the correct answer because, by the definition of the heuristic, all the estimated total distances to reach the goal are lower bounds, so none of the other answers can do better.

Suppose the heuristic for an answer which in fact will end up with total distance T can be up to KT, where K > 1. If A* retrieves an answer with cost KT and thinks it has succeeded because the answer reaches the goal, then it might not be the best answer. We know that every partial answer still in the pool has cost at least KT, but because of the heuristic, an answer with heuristic KT might actually turn into an answer with total cost T < KT (but cannot turn into an answer with any cheaper cost). So with this sort of heuristic, you the answer returned by A* can be up to K times as expensive as the best answer, but no more.

This is actually summarized in the Wikipedia entry at http://en.wikipedia.org/wiki/A_search_algorithm#Bounded_relaxation - using such heuristics deliberately is one way to speed up A at the cost of returning worse answers.

mcdowella
  • 19,301
  • 2
  • 19
  • 25
  • I have thought on this explanation for a while. Does it also imply that if A* heuristic overestimates the remaining distance by no more than 1 meter, then the resulting path found by A* can be no more than 1 meter longer than the shortest path? – Serge Rogatch Oct 27 '14 at 10:01
  • I would expect that to be true for much the same reason - when you return with an answer of cost K, everything still in the pool has heuristic at least K, and so leads to full answers with cost at least K-1. – mcdowella Oct 27 '14 at 18:46