带 bo​​ost 图库的 A* Dijkstra 算法的启发式函数

发布于 2024-12-22 11:15:48 字数 164 浏览 4 评论 0原文

我对 A* Dijkstra 算法没有太多详细的了解。我知道这也是一种最短路径算法,它还考虑 h(x) 启发式和 g(x)。我在我的项目中使用 Boost Graph Library,该库中有 A* 算法。

有人可以向我展示一个简单的例子来定义简单无向图的启发式吗?这对我以后的发展会有很大的帮助。

I have no much detailed knowledge about A* Dijkstra algorithm. I know it is also a shortest path algorithm which also considers h(x) heuristic along with g(x). I am using Boost Graph Library for my project and there is A* algorithm in the library.

Can anybody show me with a simple example to define a heuristic for a simple undirected graph? It would be of great help to me in moving further.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁把谁当真 2024-12-29 11:15:48

如果没有实现示例,A* 的启发式就像“我知道路径至少有这个长度(而不是更短)”。一个例子是地图,其中两个节点之间的道路距离不能短于空中距离(或欧几里得距离或您使用的任何坐标系)。因此,启发式函数的一个示例是返回两个节点之间的空中距离的函数。

Without having an example implemented, a heuristic for A* is something like "I know that the path has at least this leghth (and not shorter)". An example would be a map where the road distance between two nodes cannot be shorter than the aerial distance (or Euclidean distance or whatever coordinate system you use). So an example for a heuristic function would be a function returning the aerial distance between two nodes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文