【发布时间】:2020-07-04 03:13:28
【问题描述】:
我正在寻找一种最短路径算法,其中代理(必须从头到尾移动的东西)在可步行场上只有有限的视野。假设我们有一个迷宫,其起点和目标都是基于图块的。像这样的东西: 然后代理可能在每个方向(上、下、左、右)上只能看到一个,但具有无限记忆。作为衡量标准,我希望尽可能少的步骤达到目标。 有算法吗?
如果是这样,是否有解决更普遍问题的算法。假设:一个图、多个目标和起点以及一个返回可见节点的函数,以及有限的内存?
【问题讨论】:
我正在寻找一种最短路径算法,其中代理(必须从头到尾移动的东西)在可步行场上只有有限的视野。假设我们有一个迷宫,其起点和目标都是基于图块的。像这样的东西: 然后代理可能在每个方向(上、下、左、右)上只能看到一个,但具有无限记忆。作为衡量标准,我希望尽可能少的步骤达到目标。 有算法吗?
如果是这样,是否有解决更普遍问题的算法。假设:一个图、多个目标和起点以及一个返回可见节点的函数,以及有限的内存?
【问题讨论】:
一段时间后,我想到了一些想法和相似之处。
接近Micromouse必须解决大多数使用Flood Fill的问题
Flood-fill (node, target-color, replacement-color):
1. If target-color is equal to replacement-color, return.
2. ElseIf the color of node is not equal to target-color, return.
3. Else Set the color of node to replacement-color.
4. Perform Flood-fill (one step to the south of node, target-color, replacement-color).
Perform Flood-fill (one step to the north of node, target-color, replacement-color).
Perform Flood-fill (one step to the west of node, target-color, replacement-color).
Perform Flood-fill (one step to the east of node, target-color, replacement-color).
5. Return.
【讨论】:
由于能见度有限,您无法真正期望找到最短路径,因为您要么可以看到通往目标的路径,要么看不到,除非您有幸看到多条路径。
但是,您可以使用启发式方法来改进您的搜索。例如,您需要探索未探索的图块,优先考虑目标周围的图块,从最接近的图块开始。能见度只有 1,基本上是盲人,但如果能见度稍高,则可以优先围绕目标进行探索,直到找到一条与您已经探索过的事物相连的路径。
这让我想起了双向路径追踪,这是一种渲染技术,您可以追踪来自相机和灯光的路径,直到它们连接。 http://www.pbr-book.org/3ed-2018/Light_Transport_III_Bidirectional_Methods/Bidirectional_Path_Tracing.html
【讨论】:
一个非常简单的替代方法是:
walk to an undiscovered tile using a star
if it is the goal stop
if not repeat
if there aren't any undiscovered tiles stop and fail
【讨论】:
基本上 A* 仍然可以工作,但您需要找到一个新的启发式方法,我建议您包括图块之间的旅行时间。
【讨论】: