[Algorithm] A* Search Algorithm Basic

本文深入探讨了A*搜索算法,一种最佳优先搜索算法,它通过寻找最小成本路径解决复杂问题。A*算法在每次迭代中选择f(n)=g(n)+h(n)最小的路径进行扩展,其中g(n)是从起始节点到节点n的成本,h(n)是对从n到目标的最便宜路径的估价。A*算法是可采纳的,考虑的节点比任何其他具有相同启发式的可采纳搜索算法少。此外,文章还讨论了迪杰斯特拉算法和广度优先搜索作为A*算法的特殊情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

 

转载于:https://www.cnblogs.com/TonyYPZhang/p/6706371.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值