小编Jos*_*ose的帖子

最优蚁群定位算法

假设有一个网格包含两个墙(被阻挡的单元格)以及放置在网格上任何位置的食物.

示例网格的图像

现在假设我们正在尝试确定将蚁群放置在该网格上的最佳位置,使得蚂蚁必须行进最小距离(在任何方向上往/来自群体的起始点)以获得最大量的食物.

到目前为止,我提出的最佳方法如下:

for each square on the grid
    use a shortest path algorithm to find the distance to/from each food source from this square
    sum these distances to find a number and put the number in that square
select the square with the smallest number
Run Code Online (Sandbox Code Playgroud)

这种方法是否有效?有更有效的解决方案吗?

algorithm path-finding shortest-path

12
推荐指数
1
解决办法
473
查看次数

标签 统计

algorithm ×1

path-finding ×1

shortest-path ×1