Compute the A-star priority for two nodes

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

A-star (A*) orders nodes by f(n) = g(n) + h(n), where g is the known path cost from the start and h estimates the remaining cost to the goal. A lower f value gives a node higher search priority. Suppose a delivery robot has reached warehouse node A along a route of cost 4, with h(A) = 1, and node B along a route of cost 2, with h(B) = 4. Then f(A) = 4 + 1 = 5 and f(B) = 2 + 4 = 6. The robot expands A first, even though B has the smaller g value.

Now compare two stations on a rail map. Train X was reached with g(X) = 10 and its admissible remaining estimate is h(X) = 5, so f(X) = 15. Train Y was reached with g(Y) = 7 and h(Y) = 4, so f(Y) = 11. A* gives Y priority because 11 is lower than 15. These numbers do not mean Y is closer to the goal in every sense. They mean Y currently offers the smaller estimated total route cost. If a goal node is inserted, its h value is 0.

Check your recall

In the robot example, what are the A* priorities of A and B, and which node is expanded first?

Check your answer

The priorities are f(A) = 5 and f(B) = 6. A is expanded first because it has the lower A* priority.

Sources and credits

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