kb/data/en.wikipedia.org/wiki/Consistent_heuristic-1.md

5.5 KiB
Raw Blame History

title chunk source category tags date_saved instance
Consistent heuristic 2/2 https://en.wikipedia.org/wiki/Consistent_heuristic reference science, encyclopedia 2026-05-05T09:57:25.369916+00:00 kb-cron

hence

    f
    (
    P
    )
    ≥
    f
    (
    N
    )
  

{\displaystyle f(P)\geq f(N)}

. 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

      c
      
    
    (
    N
    ,
    P
    )
    =
    c
    (
    N
    ,
    P
    )
    +
    h
    (
    P
    )
    
    h
    (
    N
    )
  

{\displaystyle c'(N,P)=c(N,P)+h(P)-h(N)}

for a consistent

    h
  

{\displaystyle h}

, then A* is equivalent to best-first search on that graph using Dijkstra's algorithm. With a non-decreasing

    f
    (
    N
    )
  

{\displaystyle f(N)}

under consistent heuristics, one can show that A* achieves optimality with cycle-checking, that is, when A* expands a node

    n
  

{\displaystyle n}

, the optimal path to

    n
  

{\displaystyle n}

has already been found. Suppose for the sake of contradiction that when A* expands

    n
  

{\displaystyle n}

, the optimal path has not been found. Then, by the graph separation property, there must exist another node

      n
      
    
  

{\displaystyle n'}

on the optimal path to

    n
  

{\displaystyle n}

on the frontier. Since

    n
  

{\displaystyle n}

was selected for expansion instead of

      n
      
    
  

{\displaystyle n'}

, this would mean that

    f
    (
    n
    )
    <
    f
    (
    
      n
      
    
    )
  

{\displaystyle f(n)<f(n')}

. But since f-values are monotonically non-decreasing along any path under the consistent heuristic function

    f
  

{\displaystyle f}

, we know that

    f
    (
    n
    )
    ≥
    f
    (
    
      n
      
    
    )
  

{\displaystyle f(n)\geq f(n')}

since

      n
      
    
  

{\displaystyle n'}

is on the path to

    n
  

{\displaystyle n}

. This is a contradiction, meaning that

      n
      
    
  

{\displaystyle n'}

should have been selected for expansion first instead of

    n
  

{\displaystyle n}

. 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

    h
  

{\displaystyle h}

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

      h
      
    
    (
    P
    )
    ←
    max
    (
    h
    (
    P
    )
    ,
    
      h
      
    
    (
    N
    )
    
    c
    (
    N
    ,
    P
    )
    )
  

{\displaystyle h'(P)\gets \max(h(P),h'(N)-c(N,P))}

as the heuristic value for

    P
  

{\displaystyle P}

instead of

    h
    (
    P
    )
  

{\displaystyle h(P)}

, where

    N
  

{\displaystyle N}

is the node immediately preceding

    P
  

{\displaystyle P}

on the path and

      h
      
    
    (
    s
    t
    a
    r
    t
    )
    =
    h
    (
    s
    t
    a
    r
    t
    )
  

{\displaystyle h'(start)=h(start)}

. This idea is due to László Mérō 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.

=== Relation to Local Admissibility === Modifying the consistency condition to h(N)h(P) ≤ c(N,P) establishes a connection to local admissibility, where the heuristic estimate to a specific node remains less than or equal to the actual step cost. This ensures optimality when selecting local nodes, akin to how admissible heuristics ensure global optimality. By maintaining this property, the search process improves efficiency by making locally optimal decisions that contribute to the globally optimal solution.

== See also == Admissible heuristic

== References ==