Jump to content

Consistent heuristic: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Rewrite lead sentence in the style of the admissible heuristic article (which is easier to parse)
No edit summary
 
(34 intermediate revisions by 27 users not shown)
Line 1: Line 1:
{{Short description|Type of heuristic in path-finding problems}}
In the study of [[shortest path problem|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.
In the study of [[shortest path problem|path-finding problems]] in [[artificial intelligence]], a [[heuristic function]] is said to be '''consistent''', or '''monotone''', if its estimate is always less than or equal to the estimated distance from any neighbouring vertex to the goal, plus the cost of reaching that neighbour.


Formally, for every node ''N'' and each [[Successor_(graph_theory)#Direction|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''. In other words:
Formally, for every node ''N'' and each [[Successor_(graph_theory)#Direction|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:
: <math>h(N) \leq c(N,P) + h(P)</math> and
:<math>h(N) \leq c(N,P) + h(P)</math> and
: <math>h(G) = 0.\,</math>
: <math>h(G) = 0.\,</math>
where
where
Line 11: Line 12:
:* c(N,P) is the cost of reaching node P from N
:* c(N,P) is the cost of reaching node P from N


Informally, every node ''i'' will give an estimate that, accounting for the cost to reach the next node, is always lesser than or equal to the estimate at node ''i+1''.
A consistent heuristic is also [[admissible heuristic|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 <math>m</math>, the length of the best path from node to goal. By assumption, <math>h(N_m) \leq h^*(N_m)</math>, where <math>h^*(n)</math> denotes the cost of the shortest path from ''n'' to the goal. Therefore,
:<math>h(N_{m+1}) \leq c(N_{m+1}, N_m) + h(N_m) \leq c(N_{m+1}, N_m) + h^*(N_m) = h^*(N_{m+1})</math>,
making it admissible. (<math>N_{m+1}</math> is any node whose best path to the goal, of length m+1, goes through some immediate child <math>N_{m}</math> whose best path to the goal is of length m.)


A consistent heuristic is also [[admissible heuristic|admissible]], i.e. it never overestimates the cost of reaching the goal (the [[Converse (logic)|converse]], however, is not always true). Assuming non negative edges, this can be easily proved by [[mathematical induction | induction]].<ref>{{ cite web |url=https://www.cs.cmu.edu/~15381-s19/recitations/rec2/rec2_sol.pdf |title=Designing & Understanding Heuristics }}</ref>
However, an admissible heuristic <math>h</math>, can be made into a consistent heuristic, <math>h'</math>, through the following adjustment:

: <math> h'(P) \gets \max(h(P), h(N) - c(N,P)) </math>
Let <math>h(N_{0}) = 0</math> be the estimated cost for the goal node. This implies that the base condition is trivially true as 0 ≤ 0. Since the heuristic is consistent, <math>h(N_{i+1}) \leq c(N_{i+1}, N_{i}) + h(N_{i}) \leq c(N_{i+1}, N_{i}) + c(N_{i}, N_{i-1}) + ... + c(N_{1}, N_{0}) + h(N_{0})</math> by expansion of each term. The given terms are equal to the true cost, <math>\sum_{i=1}^n c(N_{i}, N_{i-1})</math>, so any consistent heuristic is also admissible since it is upperbounded by the true cost.
(Known as the pathmax<ref name="Russell 1995">{{cite book

| first = Stuart
The converse is clearly not true as we can always construct a heuristic that is always below the true cost but is nevertheless inconsistent by, for instance, increasing the heuristic estimate from the farthest node as we get closer and, when the estimate <math>h(N_{i})</math> becomes at most the true cost <math>h^*(N_{i})</math>, we make <math>h(N_{i-1}) = h(N_{i}) - c(N_{i}, N_{i-1})</math>.
| last = Russell
|author2=Peter Norvig
| title = Artificial intelligence: a modern approach
| publisher = Prentice-Hall
| year = 1995
| isbn = 0-13-103805-2
}}</ref> equation.)


==Consequences of monotonicity==
==Consequences of monotonicity==
[[File:Heuristics Comparison.png|thumb|250px|Comparison of an admissible but inconsistent and a consistent heuristic evaluation function.]]
[[File:Heuristics Comparison.png|thumb|250px|Comparison of an admissible but inconsistent and a consistent heuristic evaluation function.]]
Consistent heuristics are called monotone because the estimated final cost of a partial solution, <math>f(N_j)=g(N_j)+h(N_j)</math> is monotonically non-decreasing along the best path to the goal, where <math>g(N_j)=\sum_{i=2}^j c(N_{i-1},N_i)</math> is the cost of the best path from start node <math>N_1</math> to <math>N_j</math>. It's necessary and sufficient for a heuristic to obey the [[triangle inequality]] in order to be consistent.<ref>{{cite book
Consistent heuristics are called monotone because the estimated final cost of a partial solution, <math>f(N_j)=g(N_j)+h(N_j)</math> is monotonically non-decreasing along any path, where <math>g(N_j)=\sum_{i=2}^j c(N_{i-1},N_i)</math> is the cost of the best path from start node <math>N_1</math> to <math>N_j</math>. It's necessary and sufficient for a heuristic to obey the [[triangle inequality]] in order to be consistent.<ref>{{cite book
| first = Judea
| first = Judea
| last = Pearl
| last = Pearl
Line 36: Line 29:
| year = 1984
| year = 1984
| isbn = 0-201-05594-5
| isbn = 0-201-05594-5
| url-access = registration
| url = https://archive.org/details/heuristicsintell00pear
}}</ref>
}}</ref>


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 <math>c'(N,P)=c(N,P)+h(P)-h(N)</math> for a consistent <math>h</math>, then A* is equivalent to best-first search on that graph using Dijkstra's algorithm.<ref name="Russell 1995"/> 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.
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 edges). In fact, if the search graph is given cost <math>c'(N,P)=c(N,P)+h(P)-h(N)</math> for a consistent <math>h</math>, then A* is equivalent to best-first search on that graph using Dijkstra's algorithm.<ref name="Edelkamp book">{{cite book
| first1 = Stefan
| last1 = Edelkamp
| first2 = Stefan
| last2 = Schrödl
| title = Heuristic Search: Theory and Applications
| publisher = Morgan Kaufmann
| year = 2012
| isbn = 978-0-12-372512-7
}} </ref> 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.

If the given heuristic <math>h</math> is admissible but not consistent, one can artificially force the heuristic values along a path to be monotonically non-decreasing
by using
: <math> h'(P) \gets \max(h(P), h'(N) - c(N,P)) </math>
as the heuristic value for <math> P </math> instead of <math> h(P) </math>, where <math> N </math> is the node immediately preceding <math> P </math> on the path and <math> h'(start)=h(start) </math>. This idea is due to László Mérō<ref name="Mero">{{Cite journal|
last=Mérō|
first=László|
date=1984|
title=A Heuristic Search Algorithm with Modifiable Estimate|
journal=Artificial Intelligence|
volume=23|
pages=13–27|
doi=10.1016/0004-3702(84)90003-1}}</ref>
and is now known as pathmax.
Contrary to common belief, pathmax does not turn an admissible heuristic into a consistent heuristic. For example, if A* uses pathmax and a heuristic that is admissible but not consistent, it is not guaranteed to have an optimal path to a node when it is first expanded.<ref name="Misconceptions">{{cite journal|
last=Holte|
first=Robert|
date=2005|
title=Common Misconceptions Concerning Heuristic Search|
url=https://aaai.org/ocs/index.php/SOCS/SOCS10/paper/view/2073|
journal=Proceedings of the Third Annual Symposium on Combinatorial Search (SoCS)|
access-date=2019-07-10|
archive-date=2022-08-01|
archive-url=https://web.archive.org/web/20220801183131/https://aaai.org/ocs/index.php/SOCS/SOCS10/paper/view/2073|
url-status=dead}}</ref>


== See also ==
== See also ==

Latest revision as of 06:58, 23 April 2024

In the study of path-finding problems in artificial intelligence, a heuristic function is said to be consistent, or monotone, if its estimate is always less than or equal to the estimated distance from any neighbouring vertex to the goal, plus the cost of reaching that neighbour.

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

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

Informally, every node i will give an estimate that, accounting for the cost to reach the next node, is always lesser than or equal to the estimate at node i+1.

A consistent heuristic is also admissible, i.e. it never overestimates the cost of reaching the goal (the converse, however, is not always true). Assuming non negative edges, this can be easily proved by induction.[1]

Let be the estimated cost for the goal node. This implies that the base condition is trivially true as 0 ≤ 0. Since the heuristic is consistent, by expansion of each term. The given terms are equal to the true cost, , so any consistent heuristic is also admissible since it is upperbounded by the true cost.

The converse is clearly not true as we can always construct a heuristic that is always below the true cost but is nevertheless inconsistent by, for instance, increasing the heuristic estimate from the farthest node as we get closer and, when the estimate becomes at most the true cost , we make .

Consequences of monotonicity

[edit]
Comparison of an admissible but inconsistent and a consistent heuristic evaluation function.

Consistent heuristics are called monotone because the estimated final cost of a partial solution, is monotonically non-decreasing along any path, where is the cost of the best path from start node to . 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 edges). In fact, if the search graph is given cost for a consistent , then A* is equivalent to best-first search on that graph using Dijkstra's algorithm.[3] 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.

If the given heuristic is admissible but not consistent, one can artificially force the heuristic values along a path to be monotonically non-decreasing by using

as the heuristic value for instead of , where is the node immediately preceding on the path and . This idea is due to László Mérō[4] and is now known as pathmax. Contrary to common belief, pathmax does not turn an admissible heuristic into a consistent heuristic. For example, if A* uses pathmax and a heuristic that is admissible but not consistent, it is not guaranteed to have an optimal path to a node when it is first expanded.[5]

See also

[edit]

References

[edit]
  1. ^ "Designing & Understanding Heuristics" (PDF).
  2. ^ Pearl, Judea (1984). Heuristics: Intelligent Search Strategies for Computer Problem Solving. Addison-Wesley. ISBN 0-201-05594-5.
  3. ^ Edelkamp, Stefan; Schrödl, Stefan (2012). Heuristic Search: Theory and Applications. Morgan Kaufmann. ISBN 978-0-12-372512-7.
  4. ^ Mérō, László (1984). "A Heuristic Search Algorithm with Modifiable Estimate". Artificial Intelligence. 23: 13–27. doi:10.1016/0004-3702(84)90003-1.
  5. ^ Holte, Robert (2005). "Common Misconceptions Concerning Heuristic Search". Proceedings of the Third Annual Symposium on Combinatorial Search (SoCS). Archived from the original on 2022-08-01. Retrieved 2019-07-10.