箱装:设置箱数,希望最小化最大箱重

发布于 2024-10-14 20:43:35 字数 234 浏览 6 评论 0原文

给定 n 个无限容量的箱子,我想将 m 个物品装入其中(每个物品都有特定的重量),同时最大限度地减少最重箱子的重量。

这不是传统的垃圾箱包装/背包问题,其中垃圾箱的容量有限,并且您试图最大限度地减少垃圾箱的使用量;我有一定数量的垃圾箱,并且想将它们全部使用,以使最重的垃圾箱的重量尽可能低。

这个问题有名字吗?我查阅了很多带有关键词的论文,但没有发现类似的内容。

干杯。

Given n bins of infinite capacity, I want to pack m items into them (each with a specific weight), whilst minimizing the weight of the heaviest bin.

This isn't a traditional bin packing / knapsack problem where a bin has a finite capacity and you attempt to minimize the amount of bins used; I have a set amount of bins and want to use them all in order to make the heaviest bin's weight as low as possible.

Is there a name for this problem? I have looked through a number of papers with key words, but I have found nothing similar.

Cheers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

素染倾城色 2024-10-21 20:43:35

如果垃圾箱的数量是约束,而不是垃圾箱的容量,那么它就不是垃圾箱包装,而是 多处理器调度问题。

通常,您可以通过 LPT 算法来解决这个问题,并获得很好的结果。不过,需要进行优化,这就是乐趣所在。

If the amount of bins is the constraint, instead of the capacity of bins, then it's not a bin packing, it's a multiprocessor scheduling problem.

Usually, you can approach this by a LPT algorithm with pretty good results. Optimizations will be needed though and that's where the fun lies.

丑疤怪 2024-10-21 20:43:35

这是2D装箱问题的一种形式。第一个维度是对每个垃圾箱容量的限制(= 硬约束),第二个维度是最小化最重垃圾箱的重量( =软约束)。

使用Drools Planner,我会从云平衡示例 并按如下方式实现:

rule "maxCapacity"
  when
    // When there is a bin ...
    $bin : Bin($binCapacity : binCapacity)
    // ... where the total of the item capacity is bigger than the bin capacity ...
    $itemCapacityTotal : Number(intValue > $binCapacity) from accumulate(
        ItemAssignment(
            bin == $bin,
            $itemCapacity : itemCapacity),
        sum($itemCapacity)
    )
  then
    // ... then lower the hard score with the insufficient capacity
    insertLogical(new IntConstraintOccurrence("maxCapacity",
            ConstraintType.NEGATIVE_HARD,
            $itemCapacityTotal.intValue() - $binCapacity,
            $bin));
end


rule "calculateWeight"
  when
    $bin : Bin()
    $itemWeightTotal : Number() from accumulate(
        ItemAssignment(
            bin == $bin,
            $itemWeight : itemWeight),
        sum($itemWeight)
    )
  then
    insertLogical(new BinToWeight($bin, $itemWeightTotal);
end
rule "minimizeWeight"
  when
    BinToWeight($bin : bin, $itemWeightTotal : itemWeightTotal)
    not BinToWeight (itemWeightTotal > $itemWeightTotal,  bin != $bin)
  then
    insertLogical(new IntConstraintOccurrence("minimizeWeight",
            ConstraintType.NEGATIVE_SOFT,
            $itemWeightTotal,
            $bin));
end

It's a form of a 2D bin packing problem. The first dimension is a limit on capacity per bin (= hard constraint), the second dimension is to minimize the weight of the heaviest bin (= soft constraint).

With Drools Planner, I 'd start from the cloud balance example and implement it like this:

rule "maxCapacity"
  when
    // When there is a bin ...
    $bin : Bin($binCapacity : binCapacity)
    // ... where the total of the item capacity is bigger than the bin capacity ...
    $itemCapacityTotal : Number(intValue > $binCapacity) from accumulate(
        ItemAssignment(
            bin == $bin,
            $itemCapacity : itemCapacity),
        sum($itemCapacity)
    )
  then
    // ... then lower the hard score with the insufficient capacity
    insertLogical(new IntConstraintOccurrence("maxCapacity",
            ConstraintType.NEGATIVE_HARD,
            $itemCapacityTotal.intValue() - $binCapacity,
            $bin));
end


rule "calculateWeight"
  when
    $bin : Bin()
    $itemWeightTotal : Number() from accumulate(
        ItemAssignment(
            bin == $bin,
            $itemWeight : itemWeight),
        sum($itemWeight)
    )
  then
    insertLogical(new BinToWeight($bin, $itemWeightTotal);
end
rule "minimizeWeight"
  when
    BinToWeight($bin : bin, $itemWeightTotal : itemWeightTotal)
    not BinToWeight (itemWeightTotal > $itemWeightTotal,  bin != $bin)
  then
    insertLogical(new IntConstraintOccurrence("minimizeWeight",
            ConstraintType.NEGATIVE_SOFT,
            $itemWeightTotal,
            $bin));
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文