假设有一个网格包含障碍物(封锁的单元格)和放置在网格上任何位置的食物物品。
现在,假设我们正在尝试决定在这个网格上放置蚂蚁群落的最佳位置,以使蚂蚁们在任何方向上(从/到群落的起点)行进的距离最短,以获取最大数量的食物。
到目前为止,我想到的最佳方法如下:
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
这种方法可行吗?有没有更高效的解决方案?