Is A* an optimal search algorithm (ie. will it find the best solution) even if it is non-monotonic? Why or Why not?
-
1What do you mean by "monotonic" and "non-monotonic?" – templatetypedef Jan 16 '14 at 22:48
-
@templatetypedef [Monotonic](http://en.wikipedia.org/wiki/Monotonic_function), [monotone/consistent](http://en.wikipedia.org/wiki/Consistent_heuristic)? (Not necessarily directed at you, of course.) – user2864740 Jan 25 '14 at 02:49
-
IIRC (and it's been awhile), A* only needs an admissible heuristic. – user2864740 Jan 25 '14 at 02:54
2 Answers
A* is an optimal search algorithm as long as the heuristic is admissible.
But, if the heuristic is inconsistent, you will need to re-expand nodes to ensure optimality. (That is, if you find a shorter path to a node on the closed list, you need to update the g-cost and put it back on the open list.)
This re-expansion can introduce exponential overhead in state spaces with exponentially growing edge costs. There are variants of A* which reduce this to polynomial overhead by essentially interleaving a dijkstra search in between each A* node expansion.
This paper has an overview of recent work, and particularly citations of other work by Martelli and Mero who detail these worst-case graphs and suggest optimizations to improve A*.

- 5,244
- 3
- 45
- 55
A* is an optimal search algorithm if and only if the heuristic is both admissible and monotonic (also referred to as consistent). For a discussion of the distinction between these criteria, see this question. Effectively, the consistency requirement means that the heuristic cannot overestimate the distance between any pair of nodes in the graph being searched. This is the necessary because any overestimate could result in the search ignoring a good path in favor of a path that is actually worse.
Let's walk through an example of why this is true. Consider two nodes, A and B, with heuristic estimates of 5 and 6, respectively. If the heuristic is admissible and consistent, the shortest path that could possibly exist goes through A and is no shorter than 5. But what if the heuristic isn't consistent? In order for a heuristic to be admissible but inconsistent, it must always underestimate the distance to the goal but not result in there being a clear relationship between heuristic estimates at nodes within the graph. For a concrete example, see my answer to this question. In this example, the heuristic function randomly chooses between two other functions. If the heuristic estimates at A and B were not calculated based on the same function, we don't actually know which one of them currently has the potential to lead to a shorter path. In effect, we aren't using the same scale to measure them. So we could choose A when B was actually the better option. This might result in us finding the goal through a sub-optimal path.

- 1
- 1

- 6,298
- 2
- 47
- 58
-
This isn't correct if you allow A* to perform node re-expansions when it finds a shorter path to an already expanded node. – Nathan S. Oct 26 '14 at 06:19
-
That's really interesting! But doesn't it only work if you happen to come across a path from a different branch of the tree to the node that you already expanded? In my example above, say A leads to C and B leads to D and both C and D lead to the goal. You would expand A and then C and then the goal before having a chance to re-expand anything. – seaotternerd Oct 26 '14 at 06:32
-
Oh, okay, I see now. An admissible heuristic would not allow that to happen. So basically giving up consistency removes a lot of the guarantees of A* (although not optimality, if you allow node re-expansions), but in practice often yields better results. – seaotternerd Oct 26 '14 at 16:17
-
Exactly. An inconsistent heuristic can have much larger values at runtime, especially if its composed of several independent heuristics put together. – Nathan S. Oct 27 '14 at 05:27