A* Search

A Search* is a search algorithm that expands the frontier node with the lowest estimated total cost, where . Here, is the actual path cost from the start to as used in UCS, and is the estimated cost from to a goal. Like Greedy and UCS, it uses a priority queue, but its ordering is by .

A* is both complete and optimal when the heuristic is admissible and consistent, where

  • Admissibility ensures that the algorithm never overestimates the true cost to the goal, such that for any node , it holds that, where is the true minimal cost from to the goal.
  • Consistency ensures that is nondecreasing along paths, such that for every transition with step cost , it holds that , where is the next node after action has been applied to it.

A*‘s worst-case time and space complexity are exponential in the depth of the solution, but in practice, a good heuristic can dramatically reduce the number of expanded nodes. It is one of the most widely used search algorithms in AI because it combines the efficiency of heuristic guidance with the guarantees of UCS.

Proof

Implementation