[Algorithm] A* Search Algorithm Basic

Posted TonyYPZhang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Algorithm] A* Search Algorithm Basic相关的知识,希望对你有一定的参考价值。

A* is a best-first search, meaning that it solves problems by searching amoung all possible paths to the solution(goal) for the one that incurs the smallest cost(least distance, shortest time, etc.), and among these paths it first considers the one that appears most quickly to the solution.

At each iteration of its main loop, A* need to determine which of its partial paths to expand one or more longer paths. A* selects the path that minimizes 

f(n) = g(n) + h(n)

where n is the last node on the path, g(n) is the cost of the path from the start node to n, and h(n) is heuristic that estimates the cheapest cost of path from n to the goal. The heuristic is problem-specific.

 

a sample of A* search

 

A* is admissable and considers fewer nodes than any other admissable search algorithm with the same heuristic. This is because A* use an "optimistic" estimate of the cost of a path through every node that it considers -- optimistic in that the true cost of path through that node to goal will be at least as great as the estimate.

 

Dijkstra\'s algorithm is a special case of A* where h(x)=0 for all x.

BFS(Breadth-First Search) is a special case of Dijkstra\'s algorithm where all edge weights equal to 1.

 

What set A* apart from greedy best-first search algorithm is that it take the cost/distance already traveled, g(n), into account.

 

Reference:

A* search algorithm, wikipedia

Dijkstra\'s algorithm, wikipedia

Breadth-first search, wikipedia

What is difference between BFS and Dijkstra\'s algorithms when looking for shortest path?, stackoverflow

 

以上是关于[Algorithm] A* Search Algorithm Basic的主要内容,如果未能解决你的问题,请参考以下文章

[Algorithm] Delete a node from Binary Search Tree

[Algorithm] Inorder Successor in a binary search tree

基于WebGL 的3D呈现A* Search Algorithm

[Algorithm] Search element in a circular sorted array

[Math] Beating the binary search algorithm – interpolation search, galloping search

[Algorithms] Binary Search Algorithm using TypeScript