使用Fast Marching Method后,我得到了距离图输出。所涉及的偏微分方程是 Eikonal 方程,其形式为:其中 c 是速度函数,u 是我们计算的未知距离/时间。下面是一个 2D 距离图的示例(蓝色为初始点,红色为其他点)。
给定地图中的 2 个点,我想显示它们之间的简单/最短路径。我尝试使用一种不太好的简单算法,因为我可能会遇到障碍物、多个来源、不同速度的复杂问题。
find_path(point A, point B)
{
point current_point = B; // B is ending point
while(current_point is not A)
{
new_current_point is the the neighbor of current_point with the minimum value // I use a 5 point stencil
current_point = new_current_point
tag every current_point found to show the path
}
}
我的数据结构是一个一维行主数组(我在 C 中编码),表示二维规则网格中的距离值。我认为梯度下降可能是一个很好的解决方案,但我很难找到一个简单的算法。谢谢你。
编辑 我加入了一篇文章Application of the fast marching method for outdoor motion planning in robots(从第 12 页开始),它使用梯度下降来计算它。我已经看过其他论文,但我看不出它是如何工作的。
更新 我正在尝试向我的幼稚算法添加回溯算法,但我在将其放入应用程序时遇到了麻烦。我觉得我在做蛮力,这不是我想做的。如果有人对如何改变我的幼稚算法有想法。