Read an admissible heuristic on a toy map

Keep the names of states and actions distinct. · 192 words

An admissible heuristic h(n) estimates the least remaining cost from node n to the goal, but never overestimates that cost. On a toy town map, roads have costs S-A = 3, S-B = 1, B-A = 1, A-G = 2, and B-G = 4. The true cheapest remaining costs are 4 from S, 2 from A, and 3 from B. Thus h(S) = 2, h(A) = 2, h(B) = 3, and h(G) = 0 are admissible. Combining h with the cost already paid gives A* priority f(n) = g(n) + h(n). Here A has f = 5, while B has f = 4, so B is expanded first.

Consider a different map: a 3 by 3 museum courtyard is divided into unit squares, and visitors may walk only up, down, left, or right. The entrance is (0,0), and the exhibit is (2,2). Manhattan distance, h(x,y) = |x-2| + |y-2|, is an admissible heuristic because any allowed route needs at least that many squares of travel. At (1,1), h = 2, equal to the true remaining cost. A claimed value of 3 would be inadmissible because it exceeds the true cost of 2.

Check your recall

On the town map, is h(S) = 2 admissible, and which node does A* expand first?

Check your answer

Yes. The true minimum remaining cost from S is 4, so the estimate 2 does not overestimate it. A* expands B first because f(B) = 1 + 3 = 4, which is lower than f(A) = 3 + 2 = 5.

Sources and credits

Original KeyTouch lesson. Background reading · UC Berkeley · Introduction to Artificial Intelligence.