📐 Monotone Condition & Pruning in A*
465 words
2 min read
Visual companion
Python
Type and operator map
Python Week 1: the first filter for runtime behavior
View
Revision summary
What this note is really saying
Short form
# 📐 Monotone Condition & Pruning in A* ## 1. 🎯 Learning Objectives - State and prove the monotone (consistency) condition - Explain why consistency ensures A* never re-opens nodes - Describe pruning strategies: OPEN pruning, CLOSED pruning (frontier search) ## 2.

📐 Monotone Condition & Pruning in A*
1. 🎯 Learning Objectives
- State and prove the monotone (consistency) condition
- Explain why consistency ensures A* never re-opens nodes
- Describe pruning strategies: OPEN pruning, CLOSED pruning (frontier search)
2. 📖 Core Content
3.1 Monotone (Consistency) Condition
Definition: A heuristic h is consistent (or monotone) if for all nodes
m and n where n is a successor of m:Where k(m,n) is the cost from
m to n.
This is essentially the triangle inequality: the heuristic drop between adjacent nodes cannot exceed the actual cost between them.3.2 Why Consistency Matters
If h is consistent:
- A* never has to re-open nodes (first expansion is optimal)
- The f values along any path are non-decreasing
- A* behaves like BFS with optimal cost contours
Proof of non-decreasing f: Let
nbe a successor ofm. Then:
By consistency: h(m)−h(n)≤k(m,n) → k(m,n)+h(n)−h(m)≥0 Thus f(n)≥f(m) — f values never decrease!
3.3 Relationship: Consistency → Admissibility
If h is consistent, then h is admissible.
Proof: Apply consistency along the optimal path from N to goal:
Since h(G)=0 and k(N,G)=h∗(N):
3.4 Pruning in A*
Pruning CLOSED (Frontier Search):
- Don't store all CLOSED nodes — only keep a "relay layer" between search frontier and start
- Used when state space is too large for full CLOSED set Pruning OPEN:
- If two nodes have the same state, keep only the one with lower f
- This is already handled by A*'s g-value check
3.5 Sequence Alignment (Needleman-Wunsch)
A* can be applied to sequence alignment (bioinformatics). The Needleman-Wunsch algorithm aligns sequences by dynamic programming, which is related to A* search in the alignment state space.
4. 📝 Practice Questions
Q1: If h violates the consistency condition, what happens in A?*Answer: A* may need to re-open CLOSED nodes when a better path is found. This increases computation but does not affect correctness (A* still finds optimal solution if h is admissible). Q2: Prove that Manhattan distance is consistent for the 8-puzzle.Answer: Moving a tile one step changes its Manhattan distance by at most 1 (it gets one step closer or farther). The actual move cost is 1. So h(m)-h(n) ≤ 1 = k(m,n). Thus Manhattan is consistent. Join Discord PreviousWeighted A* & IDA*NextSMGS & Beam Stack