Q3 — A* Search for Optimal Solution (Edge Cost 5)

A* on a uniform-cost graph (edge = 5) — the h function overestimates and A* returns S,B,F,L,G at cost 20.

The Question

A graph with uniform edge cost 5. Start S, goal G. Manhattan heuristic.

#QuestionOfficial answer
3.1A* pathS,B,F,L,G
3.2Cost of the path20
3.3Is Manhattan admissible?B — No

The Topic in 60 Seconds

A* orders OPEN by f(n)=g(n)+h(n)f(n) = g(n) + h(n). Uniform edge costs make gg a multiple of 5 (one edge = one move). Admissibility needs h(n)≤h∗(n)h(n) \le h^*(n) everywhere — a single counterexample kills it.

Deep-dive: A* Search.

Step 0 — Grid coordinates and the h-table

Reading tile positions off the figure (xx rightward, yy downward), each grid step is charged like one edge (cost 5):

Node(x, y)Tiles to Gh=5×h = 5 \times tilesNode(x, y)Tiles to Gh=5×h = 5 \times tiles
S(1, 0)525F(4, 0)210
A(2, 0)420H(5, 1)210
B(3, 0)315L(5, 0)15
C(2, 1)525M(5, −1)210
D(3, 1)420K(6, 1)15
E(4, 1)315G(6, 0)00

3.1 — A* working → S,B,F,L,G

MoveGen alphabetical; every entry shows g+h=fg + h = f exactly.

StepExpanded (ff)Generate / updateOPEN after (cheapest first)
1S : 0+25=250+25=25A : 5+20=255+20=25 · B : 5+15=205+15=20 · C : 5+25=305+25=30B 20 · A 25 · C 30
2B : 20D : 10+20=3010+20=30 · E : 10+15=2510+15=25 · F : 10+10=2010+10=20 (A, C, S seen)F 20 · A 25 · E 25 · C 30 · D 30
3F : 20L : 15+5=2015+5=20 (E already at 25, B closed)L 20 · A 25 · E 25 · C 30 · D 30
4L : 20G : 20+0=2020+0=20 · K : 20+5=2520+5=25 · M : 20+10=3020+10=30 · H : 20+10=3020+10=30G 20 · A 25 · E 25 · K 25 · C 30 · D 30 · H 30 · M 30
5G : 20 — GOAL——

Path: S → B → F → L → G ✓

3.2 — Cost of the path → 20

Four edges × 5: 5+5+5+5=205+5+5+5 = \mathbf{20} ✓

3.3 — Is Manhattan admissible? → B (No)

Admissibility dies on a single node, and this figure has several:

NodehhTrue cheapest cost h∗h^*Verdict
M1055 (single edge M–L)overestimates ✗
E1555 (single edge E–L)overestimates ✗

The figure joins nodes that are 2 Manhattan tiles apart with a single cost-5 edge, so the tile count (× 5) exceeds the true remaining cost → h≰h∗h \not\le h^* → not admissible → B ✓ (A* still happened to return a cheapest path here because the overestimates sit off the main corridor.)

Interactive A* trace

1 / 6
OPEN = { S(g=0, h=25, f=25) }
expandingin OPEN (f = g+h)expandedreturned path

Tricks & Tips

Answers: 3.1 S,B,F,L,G · 3.2 20 · 3.3 B