码迷,mamicode.com
首页 > 其他好文 > 详细

[Algorithm] A* Search Algorithm Basic

时间:2017-04-14 01:29:56      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:time   https   mini   etc   ems   blog   org   problems   test   

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

标签:time   https   mini   etc   ems   blog   org   problems   test   

原文地址:http://www.cnblogs.com/TonyYPZhang/p/6706371.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!