算法的问题:包装棒成一排算法、问题

2023-09-11 04:16:54 作者:﹏ヽ淡漠记忆、忘记回忆つ

好了,这可能是一个棘手的问题。它实际上是一个比喻与我的实际应用程序的另一个类似的问题,但我已经简化成为清楚起见,这个假设的问题。这里有云:

Alright, this might be a tricky problem. It is actually an analogy for another similar problem relating to my actual application, but I've simplified it into this hypothetical problem for clarity. Here goes:

在我有一个线棒,我需要进行排序的。因为它是一个行中,只有1维需要关注的问题。 棒是不同的长度和不同的权重。有体重和长度之间没有相关性。小棒可以是非常沉重的,而一个大拉杆可以很轻。 的棒需要由重量排序。 的的真正的前提条件是,但是,的部分的棒只能放置的不超过的某些从线开始的距离,更不管他们的体重。任何地方在这之前是好的,但。 在不保证此限制将被隔开足够远,互相prevent约束棒的可能性挤进重叠。在此(希望罕见)情况下,或者在杆需要被重新安排以某种方式的限制范围内,以产生所需的空间,或一个理想的折衷解决方案可能需要被找到(如违反至少光杆的约束,为例子)。 是可能的在该附加约束可被添加*除了长度约束,以指示特定的(和甚至非妥协)的边界线,其中棒的内的未来日期不能的重叠成。 I have a line of rods I need to be sorted. Because it is a line, only 1 dimension needs to be of concern. Rods are different lengths and different weights. There is no correlation between weight and length. A small rod can be extremely heavy, while a large rod can be very light. The rods need to be sorted by weight. The real catch is, however, some rods can only be placed no more than certain distances from the start of the line, regardless of their weight. Anywhere before that is fine, though. No guarantee is given that constraints will be spaced enough away from each other to prevent the possibility of constrained rods being squeezed into overlapping. In this (hopefully rare) case, either the rods need to be re-arranged somehow within their constraints to create the needed space, or an ideal compromise solution may need to be found (such as violating a constraint of the least light rod, for example). It is possible at a future date that additional constraints may be added *in addition to the length constraint to indicate specific (and even non-compromising) boundaries within the line where rods cannot overlap into.

我目前的解决方案,不占后者的情况下,他们听起来像他们会涉及到一些复杂的工作来解决这些问题。

My current solution does not account for the latter situations, and they sound like they'll involve some complex work to resolve them.

请注意,这是一个客户端Web应用程序,因此使得href="http://stackoverflow.com/questions/3829762/linear-programming-with-javascript">适用于Javascript的

 
精彩推荐
图片推荐