What are Admissible heuristics?
Admissible heuristics are used to estimate the cost of reaching the goal state in a search algorithm. Admissible heuristics never overestimate the cost of reaching the goal state. The use of admissible heuristics also results in optimal solutions as they always find the cheapest path solution.
For a heuristic to be admissible to a search problem, needs to be lower than or equal to the actual cost of reaching the goal.
β
Here is an example:
In the A* search algorithm, the evaluation function (where {\displaystyle n}n is the current node) is:
f(n)=g(n)+h(n)
where
f(n) = evaluation function.
g(n) = cost from start node to current node
h(n) = estimated cost from current node to goal
Here, h(n) gets calculated with the use of the heuristic function. If a non-admissible heuristic was used, it is possible that the algorithm would not reach the optimal solution because of an overestimation in the evaluation function.
β
What is non-admissible heuristic?
Non-admissible heuristics may overestimate the cost of reaching the goal state. There is no guarantee that they will reach an optimal solution.
What happens when a heuristic is not admissible?
When a non-admissible heuristic is used in an algorithm, it may or may not result in an optimal solution.Β
But, sometimes non-admissible heuristics expand a smaller amount of nodes. As a result, it is possible that the total cost (search cost + path cost) could end up being lower than an optimal solution that would be found by using an admissible heuristic.
β
What is the difference between admissible heuristics & consistent heuristics?
A heuristic is considered to be consistent if the estimated cost from one node to the successor node, added to the estimated cost from the successor node to the goal is less than or equal to the estimated cost from the current node to the goal state.
In an admissible heuristic, the estimated cost from the current node to the goal state is never greater than the actual cost.
All consistent heuristics are admissible heuristics, however, all admissible heuristics are not necessarily consistent heuristics.
How does an admissible heuristic ensure an optimal solution?
If the heuristic function isnβt admissible, then it is possible to have an estimation that is larger than the actual path cost from some node to a goal node. If this higher path cost estimation is on the least cost path (that you are trying to find), the algorithm will not explore it and it may find another (not the cheapest) path to the goal.Β
Consider this example:
Say π΄Β and πΊ are the starting and goal nodes respectively. Now let β(π) be an estimate of the path's length from node π to πΊ, βπ in the graph. Say π(π,ππ) is the step cost function from node π to its neighbor ππ, βπ and π=1..π, where π is the number of neighbors of π (i.e., a function that returns the cost of the edge between node π and one of its neighbors).
Let the heuristics be
- β(π΅)=3
- β(πΆ)=4
This heuristics function π» will not be admissible, because
β(πΆ)=4>π(πΆ,πΊ)=2
If the π΄β algorithm starts from node π΄, it will then select the node π΅ for the purpose of expansion and, after this, it will proceed to node πΊ from there. And the path will be π΄βπ΅βπΊ with cost 4, instead of π΄βπΆβπΊ with cost 3. If the heuristic function was admissible this would not have happened.
if the heuristic had been admissible A->B could be chosen for the next node to expand, but after that, the A* would select A->C instead of A->B->G. And in the end, it would end up with A->C->G.
This is because of the way in whichΒ A* works. It expands the node that has the least sum of the distance to that node + heuristic estimation from that node. d(A,G) + h(G) = 4 + 0 = 4 and d(A,C) + h(C) = 1 + something<=2 (because it is admissible). C has the lower sum and hence A* will pick it. In the same way, it will then expand G and identify the least path.
Admissible heuristics make sure to find the shortest path with the least cost. The solution itself will be optimal if the heuristic is consistent.
Here is an alternative explanation:
The fact that the heuristic is admissible means that it does not overestimate the effort to reach the goal. i.e., β(π)β€ββ(π) for all π in the state space (in the 8-puzzle, which means is that just for any permutation of the tiles and the goal you are currently considering) where ββ(π) is the optimal cost to reach the target.
The most logical reason why π΄β offers optimal solutions if β(π) is admissible is due to the fact that it sorts all nodes in OPEN in ascending order of π(π)=π(π)+β(π) and, also, because it does not stop when generating the goal but when expanding it.
Due to the fact that nodes are expanded in ascending order of π(π) you know that no other node is more promising than the current one. β(π)Β is admissible so that having the lowest π(π) means that it has an opportunity to reach the goal via a cheaper path that the other nodes in OPEN have not. This holds true unless you can manage to prove the opposite, i.e., by expanding the current node.
Because π΄β will only stop when it proceeds to expand the goal node (instead of stopping when generating it) you can be absolutely sure that no other node leads to it via a cheaper path.