找到最快的路径

时间:2013-09-04 20:31:49

标签: c++ algorithm math physics

我有一个宽度为w,高度为h的物体。对象需要在最短的时间内找到覆盖整个区域的最快路径。可以把它想象成需要将化学物质喷洒到整个表面上的机械臂。黑色区域是无法横向移动的区域。

Object moving through an area

在上图中,w by h物体在一个区域内移动(其后面的深灰色区域是已经被覆盖的区域)。如果物体以速度v移动并且花费t秒进行90度转弯(或每转1度转动t / 90),我需要制定一种算法来确定覆盖整个区域的最快路径。物体可以移动到指定区域之外。

目标应该是减少转弯次数并最大化线性运动。假设我已经完成了所有测量,那么我将如何开始编程可以确定这条路径的东西呢?

1 个答案:

答案 0 :(得分:1)

[编辑回答] 对不起,我错了。

对我来说,最好的解决方案是这样的算法:

1. what is the smallest rectangle that covers the all area
2. compute the time to 'paint it' from your starting position:
    2.1 as you can go outside, just
        2.1.1 calculate time  if browsing by rows
        2.1.2 if by column
        2.1.3 if turning from outer to center
        2.1.4 if turning from outer to center
    2.2 decide what is the most efficient solution
3. store this result
4. subdivise the area in 2 smaller rectangles
5. redo the same thing for the 2 and test various combination for the travel from rectangle 1 to 2 (obviously the starting pos on 2 is free) Always keep track that anything bigger than the cost of the first solution can be ignored 

如果我可以做一个简单的猜测,那在数学上不是最快的,而是一个很好的解决方案 是大多数AOI做的,只做最大的矩形。

问题在数学上取决于很多变量,如果t很重要(对于机器人来说通常是正确的)那么简单的解决方案可能接近解决方案,即最小转弯的解决方案。

已经找到了矩形的最佳解决方案。 那就是图形问题(矩形图,图之间的联系是另一个问题)

抱歉,我无能为力。

相关问题