Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does A* terminate

While running an A* search on a tree with 1 set source node(root of the tree) and more destination nodes, when will the algorithm terminate?

Does it terminate after finding the first goal or it continues until the tree is fully visited

like image 579
smith Avatar asked Jul 17 '26 02:07

smith


1 Answers

Neither of those terminations conditions is quite right.

A* terminates when the cost of the best path to the goal that you've actually found is less than or equal to the best possible cost of any other path.

Since an admissible heuristic function never overestimates the cost, this is accomplished just by putting the goal vertex into the priority queue when you find it, with its estimated cost equal to its actual cost.

The algorithm then terminates when the goal vertex is popped off the queue as the one with the minimum cost.

like image 98
Matt Timmermans Avatar answered Jul 20 '26 15:07

Matt Timmermans



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!