A binning problem...

Status
Not open for further replies.

Arakageeta

Ars Scholae Palatinae
729
Subscriptor++
I am looking at a problem that is somewhat similar to bin-packing. There are 100s (1000s or more?) of bin-packing-like problems out there-- each with their own unique twist. Has anyone seen this problem before?

Setup: Suppose you are given k infinitely-sized bins, enumerated by B_i, and n items of finite size. Let |B_i| denote the total size of items held in the i-th bin, B_i. Let |n_i| denote the size of the i-th item.

Problem: For all possible binnings, what is the maximum value for |B_j| when min{|B_i|} (for i in [1..k]) = |B_j|? That is, what is the largest the least-full bin can be?

So many bin-packing problems are NPC, but I'm not sure that this one is. I think a simple greedy algorithm, iteratively filling the least-full bin with the next smallest item, may work. The algorithm would just return the size of the smallest bin after all items have been binned. I suppose an induction proof might be in order. Due to sorting, this algorithm would run in O(n lg n).

I know that I can also loosely bound |B_j| with: |B_j| <= Sum(|n_i|)/k. This is a simple rule of averages. If one bin has more than average, then another must have less than average. This balance is moot when all bins are of equal size-- |B_i| = Sum(|n_i|)/k for all i. Therefore, B_j can be no larger than Sum(|n_i|)/k.

Perhaps this is closer to a partitioning problem since the bins are infinitely sized, but I've found it more natural to conceptualize this as a binning problem. You may also think of this as a load-balancing problem amongst k servers.
 

Arakageeta

Ars Scholae Palatinae
729
Subscriptor++
I hate it when threads get left with no solutions, so here's mine (in Mathematica):
Code:
items = {1, 4, 3, 4};
numBins = 2;
count = Length[items];
X = x /@ Range[numBins*count];
eqs = And @@ Thread[Total[Partition[X, count]] == 1] && And @@ Thread[Partition[X, count].items >= minBin];
bds = And @@ Thread[X >= 0] && Total[X] == count;
Maximize[{minBin, eqs && bds && X \[Element] Integers && minBin \[Element] Integers}, Flatten[{X, minBin}]]
Set the array 'items' to the values you want to bin and 'numBins' to the number of bins in your problem. The variable array/matrix 'X' holds booleans which indicate whether or not an item exists in a particular bin. Use Partition[X, count]] to arrange the indicators into proper form-- a bins-by-items matrix. Disclaimer: This is probably not the most concise formulation.

Sources that I found helpful:
http://www.math.ucsd.edu/~fan/teach/202/notes/11approx-alg.pdf
http://www.mathkb.com/Uwe/Forum.aspx/op-research/1015/Bin-packing-and-load-balancing
http://reference.wolfram.com/mathematica/tutorial/ConstrainedOptimizationExact.html

Now to generalize this and redo it in lpsolve-- unless someone can recommend a better free integer linear program solver?
 
Status
Not open for further replies.