Admissible heuristic
In computer science, specifically in algorithms related to pathfinding, a heuristic function is said to be admissible if it never overestimates the cost of reaching the goal, i.e. the cost it estimates to reach the goal is not higher than the lowest possible cost from the current point in the path.[1]
It is related to the concept of consistent heuristics. While all consistent heuristics are admissible, not all admissible heuristics are consistent.
Search algorithms
An admissible heuristic is used to estimate the cost of reaching the goal state in an informed search algorithm. In order for a heuristic to be admissible to the search problem, the estimated cost must always be lower than or equal to the actual cost of reaching the goal state. The search algorithm uses the admissible heuristic to find an estimated optimal path to the goal state from the current node. For example, in A* search the evaluation function (where [math]\displaystyle{ n }[/math] is the current node) is:
[math]\displaystyle{ f(n) = g(n) + h(n) }[/math]
where
- [math]\displaystyle{ f(n) }[/math] = the evaluation function.
- [math]\displaystyle{ g(n) }[/math] = the cost from the start node to the current node
- [math]\displaystyle{ h(n) }[/math] = estimated cost from current node to goal.
[math]\displaystyle{ h(n) }[/math] is calculated using the heuristic function. With a non-admissible heuristic, the A* algorithm could overlook the optimal solution to a search problem due to an overestimation in [math]\displaystyle{ f(n) }[/math].
Formulation
- [math]\displaystyle{ n }[/math] is a node
- [math]\displaystyle{ h }[/math] is a heuristic
- [math]\displaystyle{ h(n) }[/math] is cost indicated by [math]\displaystyle{ h }[/math] to reach a goal from [math]\displaystyle{ n }[/math]
- [math]\displaystyle{ h^*(n) }[/math] is the optimal cost to reach a goal from [math]\displaystyle{ n }[/math]
- [math]\displaystyle{ h(n) }[/math] is admissible if, [math]\displaystyle{ \forall n }[/math]
- [math]\displaystyle{ h(n) \leq h^*(n) }[/math]
Construction
An admissible heuristic can be derived from a relaxed version of the problem, or by information from pattern databases that store exact solutions to subproblems of the problem, or by using inductive learning methods.
Examples
Two different examples of admissible heuristics apply to the fifteen puzzle problem:
- Hamming distance
- Manhattan distance
The Hamming distance is the total number of misplaced tiles. It is clear that this heuristic is admissible since the total number of moves to order the tiles correctly is at least the number of misplaced tiles (each tile not in place must be moved at least once). The cost (number of moves) to the goal (an ordered puzzle) is at least the Hamming distance of the puzzle.
The Manhattan distance of a puzzle is defined as:
- [math]\displaystyle{ h(n)=\sum_\text{all tiles} \mathit{distance}(\text{tile, correct position}) }[/math]
Consider the puzzle below in which the player wishes to move each tile such that the numbers are ordered. The Manhattan distance is an admissible heuristic in this case because every tile will have to be moved at least the number of spots in between itself and its correct position.[2]
43 | 61 | 30 | 81 |
72 | 123 | 93 | 144 |
153 | 132 | 14 | 54 |
24 | 101 | 111 |
The subscripts show the Manhattan distance for each tile. The total Manhattan distance for the shown puzzle is:
- [math]\displaystyle{ h(n)=3+1+0+1+2+3+3+4+3+2+4+4+4+1+1=36 }[/math]
Optimality proof
If an admissible heuristic is used in an algorithm that, per iteration, progresses only the path of lowest evaluation (current cost + heuristic) of several candidate paths, terminates the moment its exploration reaches the goal and, crucially, never closes all optimal paths before terminating (something that's possible with A* search algorithm if special care isn't taken[3]), then this algorithm can only terminate on an optimal path. To see why, consider the following proof by contradiction:
Assume such an algorithm managed to terminate on a path T with a true cost Ttrue greater than the optimal path S with true cost Strue. This means that before terminating, the evaluated cost of T was less than or equal to the evaluated cost of S (or else S would have been picked). Denote these evaluated costs Teval and Seval respectively. The above can be summarized as follows,
- Strue < Ttrue
- Teval ≤ Seval
If our heuristic is admissible it follows that at this penultimate step Teval = Ttrue because any increase on the true cost by the heuristic on T would be inadmissible and the heuristic cannot be negative. On the other hand, an admissible heuristic would require that Seval ≤ Strue which combined with the above inequalities gives us Teval < Ttrue and more specifically Teval ≠ Ttrue. As Teval and Ttrue cannot be both equal and unequal our assumption must have been false and so it must be impossible to terminate on a more costly than optimal path.
As an example,[4] let us say we have costs as follows:(the cost above/below a node is the heuristic, the cost at an edge is the actual cost)
0 10 0 100 0 START ---- O ----- GOAL | | 0| |100 | | O ------- O ------ O 100 1 100 1 100
So clearly we would start off visiting the top middle node, since the expected total cost, i.e. [math]\displaystyle{ f(n) }[/math], is [math]\displaystyle{ 10 + 0 = 10 }[/math]. Then the goal would be a candidate, with [math]\displaystyle{ f(n) }[/math] equal to [math]\displaystyle{ 10+100+0=110 }[/math]. Then we would clearly pick the bottom nodes one after the other, followed by the updated goal, since they all have [math]\displaystyle{ f(n) }[/math] lower than the [math]\displaystyle{ f(n) }[/math] of the current goal, i.e. their [math]\displaystyle{ f(n) }[/math] is [math]\displaystyle{ 100, 101, 102, 102 }[/math]. So even though the goal was a candidate, we could not pick it because there were still better paths out there. This way, an admissible heuristic can ensure optimality.
However, note that although an admissible heuristic can guarantee final optimality, it is not necessarily efficient.
References
- ↑ Russell, S.J.; Norvig, P. (2002). A Modern Approach. Prentice Hall. ISBN 0-13-790395-2.
- ↑ Korf, Richard E. (2000). "Recent progress in the design and analysis of admissible heuristic functions". in Choueiry, Berthe Y.; Walsh, Toby. 1864. Springer. pp. 45–55. doi:10.1007/3-540-44914-0_3. ISBN 978-3-540-67839-7. https://www.aaai.org/Papers/AAAI/2000/AAAI00-212.pdf. Retrieved 2010-04-26.
- ↑ Holte, Robert (2005). "Common Misconceptions Concerning Heuristic Search". Proceedings of the Third Annual Symposium on Combinatorial Search (SoCS). https://aaai.org/ocs/index.php/SOCS/SOCS10/paper/view/2073. Retrieved 2021-07-10.
- ↑ "Why do admissable [sic] heuristics guarantee optimality?". https://stackoverflow.com/questions/23970588/why-do-admissable-heuristics-guarantee-optimality.
See also
- Consistent heuristic
- Heuristic function
- Search algorithm
Original source: https://en.wikipedia.org/wiki/Admissible heuristic.
Read more |