最佳优先搜索和 A* 搜索有什么区别?

What's the difference between best-first search and A* search?

在我的教科书中,我注意到这两种算法的工作原理几乎完全相同,我试图了解它们之间的主要区别是什么

教科书使用 A* 遍历此示例,方法与 最佳优先搜索.

相同

如有任何帮助,我们将不胜感激。

最佳优先搜索 算法根据启发函数 f(n) = h 访问具有最低启发值(通常称为贪婪的)。它不考虑到该特定状态的路径成本。它只关心当前状态的下一个状态具有最低的启发式。

A* 搜索 算法基于遗传算法访问下一个状态 f(n) = h + g 其中 h 组件与最佳优先搜索中应用的启发式相同,但 g 组件是从初始状态到特定状态的路径。因此,它不会仅选择具有最低启发式值的下一个状态,而是选择在考虑到它的启发式和到达该状态的成本时给出最低值的状态。

In your example above when you start from Arad you can go either straight to Sibiu (253km) or to the Zerind(374km) or Timisoara(329km). In this case both algorithms choose Sibiu as it has lower value f(n) = 253.

Now you can expand to either state back to Arad(366km) or Oradea(380km) or Faragas(178km) or Rimnicu Vilcea(193km). For best first search Faragas will have lowest f(n) = 178 but A* will have Rimnicu Vilcea f(n) = 220 + 193 = 413 where 220 is cost of getting to Rimnicu from Arad (140+80) and 193 is from Rimnicu to Bucharest but for Faragas it will be more as f(n) = 239 + 178 = 417.

现在你可以清楚地看到 best-first 是贪心算法,因为它会选择具有较低启发式但总体成本较高的状态,因为它不考虑达到该状态的成本从初始状态开始的状态

A* 通过使用启发式方法来指导其搜索来实现更好的性能。 A* 结合了 Best-first Search 和 Uniform Cost Search 的优点:确保找到优化路径,同时使用启发式提高算法效率。 A* 函数将是 f(n) = g(n) + h(n),其中 h(n) 是任何随机顶点 n 和目标顶点之间的估计距离,g(n) 是起点和目标点之间的实际距离任何顶点 n。如果 g(n)=0,则 A* 变为最佳优先搜索。如果 h(n)=0,则 A* 变为统一成本搜索。