Bin Packing: Set amount on bins, want to minimize the max bin weight

穿精又带淫゛_ 提交于 2019-12-01 08:17:37

问题


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.


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/4825465/bin-packing-set-amount-on-bins-want-to-minimize-the-max-bin-weight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!