A - algorithm — heuristic, admissibility, consistency — important for GNC
WHY does A* exist?
WHAT are the pieces?
HOW does A* relate to Dijkstra and Greedy? (the 80/20 core)
| Algorithm | Priority key | Behaviour |
|---|---|---|
| Dijkstra | exact, slow, blind | |
| Greedy best-first | fast, not optimal | |
| A* | optimal (if admissible) + fast |

DERIVATION 1 — Why admissibility ⇒ optimal path
Step 1. Let be the true optimal cost. Suppose A* is about to pop a goal node whose path cost is (a suboptimal goal). We show this is impossible. Why this step? If we prove A* can never pop a worse goal first, the first popped goal must be optimal.
Step 2. Because the true optimal path exists, somewhere on the open list (frontier) there is a node lying on an optimal path. Why? Any path from start to goal that hasn't been fully expanded has at least one "boundary" node sitting on the frontier.
Step 3. For that : Why this step? is admissibility, and since is on an optimal path, equals the optimal total cost .
Step 4. But is a goal so , hence . Combining: .
Step 5. A* pops the smallest first, so would be popped before . Contradiction. ∎ Why this matters: the very first goal A* removes from the queue is guaranteed optimal — admissibility is exactly the condition that buys this guarantee.
DERIVATION 2 — Why consistency ⇒ admissibility (and never re-expand)
Step A: consistent ⇒ admissible. Take any path . Apply consistency along it: Sum from to (telescoping the terms), with : Why this step? It holds for every path, in particular the cheapest one, so . Done — consistency is stronger than admissibility.
Step B: is non-decreasing along expansions. For an edge : using consistency . Why this matters: never decreases as we go deeper. So when a node is popped its is already final → A never needs to re-open a closed node*. With a merely-admissible (but inconsistent) heuristic you may have to re-expand, which is slower.
Worked Example 1 — grid with Manhattan distance
Grid, 4-directional moves cost 1 each. Heuristic Manhattan distance .
- Why admissible? Each move changes Manhattan distance by at most 1 and costs 1, so the straight count never overestimates the true number of moves.
- Why consistent? For neighbours and , so . ✔
Start , goal :
- , .
- Moving to : , , . Same — A* keeps moving goalward, never expanding whose . Why this step? The away-from-goal node has higher , so A* simply ignores it — that's the speedup over Dijkstra.
Worked Example 2 — inadmissible heuristic breaks optimality
Nodes : (total 2). Also direct . Set a bad (overestimate; true is 1).
- . .
- A* pops the direct first → returns cost , missing the true optimum 2. Why this matters: overestimating made the good path look expensive. Steel-man fix: clamp/lower so .
Worked Example 3 — Euclidean heuristic for a drone (GNC)
Continuous space, moves along grid but the true robot can fly diagonally; cost = Euclidean length. Use straight-line (Euclidean) distance.
- Straight line is the shortest possible path ⇒ ⇒ admissible.
- It also satisfies the triangle inequality ⇒ consistent. Why GNC cares: admissible Euclidean guarantees the planner returns the genuinely shortest flyable route, while exploring a narrow cone toward the target — crucial when compute is limited on-board.
Recall Feynman: explain to a 12-year-old
Imagine you're in a maze looking for the exit. Dijkstra explores in every direction equally — slow. A* is smarter: at each spot you also peek and estimate "how far is the exit roughly from here?" (like looking at a straight-line distance). You always go investigate the spot that seems to give the shortest total trip = steps already walked plus the peek-guess. The one rule: your peek must never overpromise — never say "exit is super close" when it isn't. If your guess is always a little cautious (never too rosy), A* is guaranteed to find the truly shortest way out, just much faster.
Flashcards
What is f(n) in A*?
Definition of admissible heuristic
Definition of consistent heuristic
Does consistency imply admissibility?
Which property guarantees A* returns an optimal path?
Which property guarantees A* never re-expands a closed node?
A* with h(n)=0 reduces to what?
A* using only f=h (ignoring g) is what?
Why can an overestimating heuristic break optimality?
What is Weighted A*?
Why is Euclidean distance admissible in continuous space?
Connections
- Dijkstra's Algorithm — A* with .
- Greedy Best-First Search — A* with dropped.
- Heuristic Functions — Manhattan, Euclidean, Chebyshev.
- Priority Queue / Min-Heap — data structure ordering by .
- Triangle Inequality — the geometric root of consistency.
- Weighted A* and Bounded Suboptimality
- GNC Path Planning — rovers, drones, spacecraft.
- Bellman Optimality — relation .
Concept Map
Hinglish (regional understanding)
Intuition Hinglish mein samjho
Dekho, A* basically Dijkstra ka smart version hai. Dijkstra har direction me equally search karta hai — slow, kyunki usko pata hi nahi goal kahan hai. A* me hum ek heuristic add karte hain jo guess karta hai "yahan se goal kitni door hai". Phir har node ka score banta hai , jahan = ab tak chala raasta ka cost aur = aage ka guess. A* hamesha sabse chhote wala node pehle expand karta hai — isliye search goal ki taraf "pull" hoti hai aur bahut kam nodes explore hote hain.
Sabse important rule: heuristic admissible honi chahiye, matlab — kabhi over-estimate mat karo, thoda optimistic raho. Agar tum jhooth bol do ki "goal bahut paas hai" jabki nahi hai, to A* galat (non-optimal) raasta de sakta hai. Ye humne Example 2 me dekha. Consistent heuristic ek step aage hai: (triangle inequality) — isse kabhi neeche nahi girta path ke along, to A* kisi closed node ko dobara expand nahi karta, aur fast rehta hai. Yaad rakho: consistency se admissibility apne aap aa jaati hai (C → A), par ulta zaroori nahi.
GNC (Guidance, Navigation, Control — drones, rovers, spacecraft) me ye crucial hai kyunki on-board compute limited hota hai aur shortest, safe path real-time me chahiye. Euclidean (straight-line) distance ek mast heuristic hai: straight line hamesha shortest hoti hai, isliye automatically admissible aur consistent — guaranteed optimal route, kam exploration ke saath. Agar speed zyada chahiye aur thoda suboptimal chalega, to Weighted A* () use karte hain.