A* 算法、PathFinding问题中的 allow diagonal 和 don't cross corners,以及 .map文件格式

地址:

https://webdocs.cs.ualberta.ca/~nathanst/papers/benchmarks.pdf



image



image



image



地图文件的扩展名为 .map

关于地图文件:.map 文件的格式

参考:https://movingai.com/benchmarks/formats.html

image


Map Format

The maps have the following format:
All maps begin with the lines:

type octile
height y
width x
map
where y and x are the respective height and width of the map.
The map data is store as an ASCII grid. The upper-left corner of the map is (0,0). The following characters are possible:

. - passable terrain
G - passable terrain
@ - out of bounds
O - out of bounds
T - trees (unpassable)
S - swamp (passable from regular terrain)
W - water (traversable, but not passable from terrain)



根据上面的关于地图文件.map的格式解释我们可以知道该文件是使用ASCII字符来表示地图的,@ 和 O 表示的是墙、边界,不可穿越;S 表示潜些的水,是可以穿越的;T 表示是树,也是不可穿越的;W 表示深水,也是不可穿越的;. 表示可以穿越的土地;我们可以完全按照地图上的能否穿越的解释来设置PathFinding算法执行时的穿越判断,同时也可以根据需要对 S 所表示的地形设置一定的权重,表示该种地形穿越难度大,比如我们可以设置 . 地形的穿越的路程权重为1,而 S 地形穿越的权重为1.3。

.map地图所表示的地形的size是可以scale的,但是如果倍增尺寸的话会改变PathFinding算法的执行细节和地图难易度,不过做benchmark的时候保证算法都在同一个地图(相同size)即可。


.map 文件的具体文件内容的形式:

image

.map 文件就是使用上面的这种ASCII字符的形式来表示地图的。


除了 .map 文件还有一种 .scen 文件表示具体的PathFinding问题时的设置,具体如下图:

image

第一个红框中表示的是地图(map)的尺寸,第二个红框表示的是起始点的坐标,第三个红框表示的是目标点的坐标,最后一列表示的是从起始点到目标点的最短路径(oracle视角)。

在 .scen文件中会根据PathFinding的难度来做区分,将相同难度的问题每10个一组,这个组号就是 .scen 文件的第一列数值。


关于 .scen 文件官方给出的具体示意解释如下:

image




posted on 2024-05-04 09:33  Angry_Panda  阅读(56)  评论(0)    收藏  举报

导航