Admissibility & Consistency of Heuristics
Prerequisites
- Heuristic Functions — h(n), h*(n), domain knowledge
- A* Search — f(n) = g(n) + h(n), optimality conditions
🎯 Learning Objectives
- Define admissibility and consistency formally
- Prove that consistency implies admissibility
- Construct a counterexample showing admissibility does not imply consistency
- Explain why consistency is needed for A* graph search
- Verify admissibility/consistency for given heuristics
1. Admissibility
A heuristic h(n) is admissible if it never overestimates the true cost to reach the goal from n:
h(n) ≤ h*(n) for all n
where h*(n) is the true optimal cost from n to the nearest goal.
An admissible heuristic is optimistic — it always thinks the goal is at least as close as (or closer than) it actually is. This optimism guarantees that A* tree search will never prematurely declare a suboptimal path as the solution.
Examples of Admissible Heuristics
- h(n) = 0 — trivially admissible (never overestimates), makes A* behave like UCS
- Straight-line distance for route finding — you can’t drive shorter than a straight line
- Manhattan distance for 8-puzzle — each tile needs at least that many moves
- Misplaced tiles count for 8-puzzle — each misplaced tile needs at least 1 move
2. Consistency (Monotonicity)
A heuristic h is consistent (or monotonic) if for every node n and every successor n′ of n generated by action a:
h(n) ≤ c(n, a, n′) + h(n′)
This is a form of the triangle inequality: the estimated cost from n to the goal should not exceed the cost of one step to n′ plus the estimated cost from n′ to the goal.
Additionally, for any goal state G: h(G) = 0 (which follows from consistency applied at the goal).
Why “Monotonic”?
If h is consistent, then the f-values along any path are non-decreasing:
f(n′) = g(n′) + h(n′) = g(n) + c(n,a,n′) + h(n′) ≥ g(n) + h(n) = f(n)
So f is monotonically non-decreasing along every path. This ensures that A* graph search can safely discard re-visited nodes.
3. Relationship Between Admissibility and Consistency
Every consistent heuristic is admissible. (The converse is NOT true.)
Proof: Consistency Implies Admissibility
Let n0, n1, …, nk be an optimal path from n0 to goal nk.
By consistency: h(ni) ≤ c(ni, ai, ni+1) + h(ni+1) for each step.
Applying this iteratively (telescoping sum):
h(n0) ≤ c(n0,a0,n1) + h(n1) ≤ c(n0,a0,n1) + c(n1,a1,n2) + h(n2) ≤ … ≤ ∑ c(ni,ai,ni+1) + h(nk)
Since nk is the goal, h(nk) = 0. So h(n0) ≤ cost of optimal path = h*(n0). ∎
Counterexample: Admissible but Not Consistent
Graph: A → B (cost 4), B → G (cost 1), A → G (cost 6)
True costs: h*(A) = 5 (A→B→G), h*(B) = 1, h*(G) = 0
Heuristic: h(A) = 4, h(B) = 0, h(G) = 0
Admissible? h(A)=4 ≤ 5=h*(A) ✓, h(B)=0 ≤ 1=h*(B) ✓ → YES
Consistent? Check edge A→B:
h(A) ≤ c(A,B) + h(B)?
4 ≤ 4 + 0 = 4? YES ✓
Check edge B→G:
h(B) ≤ c(B,G) + h(G)?
0 ≤ 1 + 0 = 1? YES ✓
Actually this one IS consistent. Let me construct a real counterexample:
Graph: A → B (cost 1), B → G (cost 3), A → G (cost 5)
h*(A) = 4, h*(B) = 3, h*(G) = 0
h(A) = 4, h(B) = 1, h(G) = 0
Admissible? h(A)=4 ≤ 4 ✓, h(B)=1 ≤ 3 ✓ → YES
Consistent? Check A→B:
h(A) ≤ c(A,B) + h(B)?
4 ≤ 1 + 1 = 2? NO! (4 > 2) → NOT CONSISTENT
This heuristic is admissible (never overestimates true cost) but not consistent (the triangle inequality is violated at edge A→B). Note that f decreases from A to B: f(A) = 0+4=4, but f(B) = 1+1=2 (f dropped!).
4. Why Consistency Matters for Graph Search
In A* graph search, once a node is expanded (moved to the explored/closed set), it is never reconsidered. If h is only admissible (not consistent), a node might first be reached via a suboptimal path and placed in the explored set, while the cheaper path is discovered later but ignored because the node is already explored.
With a consistent heuristic, f-values are non-decreasing along any path. This means the first time A* expands a node, it has found the cheapest path to that node. No re-expansion is ever needed.
Workaround without consistency: Use A* tree search (allow re-visiting nodes) with just an admissible heuristic. This still guarantees optimality but may be slower and use more memory.
5. How to Verify Admissibility / Consistency
Verifying Admissibility
- For each node n, compute h*(n) (true shortest cost to goal).
- Check that h(n) ≤ h*(n) for every n.
Verifying Consistency
- For every edge (n, n′) with cost c, check: h(n) ≤ c + h(n′).
- If all edges satisfy this, h is consistent.
Consistency is a local condition (checked edge by edge), while admissibility is a global condition (checked against true optimal cost). In practice, consistency is easier to verify because you only need edge costs and heuristic values, not h*(n) for every node.
6. Worked Examples
4-connected grid (up/down/left/right moves, cost 1 each). Goal at (3,3).
Heuristic: h(x,y) = |x−3| + |y−3| (Manhattan distance).
Admissible? Manhattan distance is exactly the shortest path distance on a 4-connected grid with no obstacles. So h(n) = h*(n) ≤ h*(n). Yes, admissible.
Consistent? Consider node n=(1,2) with neighbor n′=(1,3) [move right, cost 1]:
- h(1,2) = |1−3| + |2−3| = 3
- c(n,n′) + h(1,3) = 1 + |1−3| + |3−3| = 1 + 2 = 3
- 3 ≤ 3 ✔
For any move in a cardinal direction, Manhattan distance changes by exactly ±1, and the step cost is 1. So |h(n) − h(n′)| ≤ 1 = c(n,n′), which means h(n) ≤ c + h(n′) always holds. Consistent.
Nodes: S, A, B, G
Edges: S→A (cost 2), A→B (cost 1), B→G (cost 3), S→G (cost 10)
h*(S)=6, h*(A)=4, h*(B)=3, h*(G)=0
Heuristic: h(S)=5, h(A)=4, h(B)=1, h(G)=0
Admissible? h(S)=5≤6 ✔, h(A)=4≤4 ✔, h(B)=1≤3 ✔. Yes.
Consistent? Check A→B: h(A) ≤ c(A,B) + h(B) → 4 ≤ 1 + 1 = 2? NO! (4 > 2). Not consistent.
The heuristic “jumps down” too much from A to B, violating the triangle inequality. This can cause A* graph search to find a suboptimal path.
Straight-line distance to Bucharest as h(n). Consider the edge Sibiu → Fagaras (road cost 99 km).
- h(Sibiu) = 253 km (SLD to Bucharest)
- h(Fagaras) = 176 km
- c(Sibiu, Fagaras) = 99 km
Consistency check: h(Sibiu) ≤ c + h(Fagaras)? → 253 ≤ 99 + 176 = 275? Yes ✔
By the geometric triangle inequality, straight-line distance is always consistent for route-finding on a map. The SLD from A to G cannot exceed the SLD from A to B plus SLD from B to G, and road distance ≥ SLD. This makes SLD both admissible and consistent for any map.
Summary
- Admissible: h(n) ≤ h*(n) — never overestimates (optimistic).
- Consistent: h(n) ≤ c(n,a,n′) + h(n′) — triangle inequality.
- Consistency ⇒ Admissibility (but not vice versa).
- A* tree search needs admissibility for optimality.
- A* graph search needs consistency for optimality.
- Most “natural” heuristics (Manhattan, SLD) are both admissible and consistent.
References
- Russell & Norvig, AIMA 4th Ed. — Section 3.5.2, 3.6