Consistent heuristic
In the study of path-finding problems in artificial intelligence, a heuristic function is said to be consistent, or monotone, if it is always at most equal to the estimated distance from any neighboring vertex plus the step cost of reaching that neighbor.
Formally, for every node N and each successor P of N, the estimated cost of reaching the goal from N is no greater than the step cost of getting to P plus the estimated cost of reaching the goal from P. That is:
-   and and
-   
where
- h is the consistent heuristic function
- N is any node in the graph
- P is any descendant of N
- G is any goal node
- c(N,P) is the cost of reaching node P from N
 
A consistent heuristic is also admissible, i.e. it never overestimates the cost of reaching the goal (the opposite however is not always true!). This is proved by induction on  , the length of the best path from node to goal. By assumption,
, the length of the best path from node to goal. By assumption,  , where
, where  denotes the cost of the shortest path from n to the goal. Therefore,
 denotes the cost of the shortest path from n to the goal. Therefore,
 , ,
making it admissible. ( is any node whose best path to the goal, of length m+1, goes through some immediate child
 is any node whose best path to the goal, of length m+1, goes through some immediate child  whose best path to the goal is of length m.)
 whose best path to the goal is of length m.)
However, an admissible heuristic  , can be made into a consistent heuristic,
, can be made into a consistent heuristic,  , through the following adjustment:
, through the following adjustment:
(Known as the pathmax[1] equation.)
Consequences of monotonicity

Consistent heuristics are called monotone because the estimated final cost of a partial solution,  is monotonically non-decreasing along the best path to the goal, where
 is monotonically non-decreasing along the best path to the goal, where  is the cost of the best path from start node
 is the cost of the best path from start node  to
 to  .  It's necessary and sufficient for a heuristic to obey the triangle inequality in order to be consistent.[2]
.  It's necessary and sufficient for a heuristic to obey the triangle inequality in order to be consistent.[2]
In the A* search algorithm, using a consistent heuristic means that once a node is expanded, the cost by which it was reached is the lowest possible, under the same conditions that Dijkstra's algorithm requires in solving the shortest path problem (no negative cost cycles).  In fact, if the search graph is given cost  for a consistent
 for a consistent  , then A* is equivalent to best-first search on that graph using Dijkstra's algorithm.[1]  In the unusual event that an admissible heuristic is not consistent, a node will need repeated expansion every time a new best (so-far) cost is achieved for it.
, then A* is equivalent to best-first search on that graph using Dijkstra's algorithm.[1]  In the unusual event that an admissible heuristic is not consistent, a node will need repeated expansion every time a new best (so-far) cost is achieved for it.
See also
References
- 1 2 Russell, Stuart; Peter Norvig (1995). Artificial intelligence: a modern approach. Prentice-Hall. ISBN 0-13-103805-2.
- ↑ Pearl, Judea (1984). Heuristics: Intelligent Search Strategies for Computer Problem Solving. Addison-Wesley. ISBN 0-201-05594-5.
