Bin covering problem explained

In the bin covering problem, items of different sizes must be packed into a finite number of bins or containers, each of which must contain at least a certain given total size, in a way that maximizes the number of bins used.

This problem is a dual of the bin packing problem: in bin covering, the bin sizes are bounded from below and the goal is to maximize their number; in bin packing, the bin sizes are bounded from above and the goal is to minimize their number.[1]

The problem is NP-hard, but there are various efficient approximation algorithms:

O(n),O(nlogn),O(n{log}2n)

respectively.[2]

The bidirectional bin-filling algorithm

Csirik, Frenk, Lebbe and Zhang present the following simple algorithm for 2/3 approximation. Suppose the bin size is 1 and there are n items.

For any instance I, denote by

OPT(I)

the number of bins in the optimal solution, and by

BDF(I)

the number of full bins in the bidirectional filling algorithm. Then

BDF(I)\geq(2/3)OPT(I)-(2/3)

, or equivalently,

OPT(I)\leq(3/2)BDF(I)+1

.

Proof

For the proof, the following terminology is used.

t:=BDF(I)=

the number of bins filled by the algorithm.

B1,\ldots,Bt:=

the t bins filled by the algorithm.

w

:= the number of final items that are at most 1/2 (equivalently,

t-w

is the number of final items larger than 1/2).The sum of each bin

B1,\ldots,Bt

is at least 1, but if the final item is removed from it, then the remaining sum is smaller than 1. Each of the first

w

bins

B1,\ldots,Bw

contains an initial item, possibly some middle items, and a final item. Each of the last

t-w

bins

Bw+1,\ldots,Bt

contains only an initial item and a final item, since both of them are larger than 1/2 and their sum is already larger than 1.

The proof considers two cases.

The easy case is

w=t

, that is, all final items are smaller than 1/2. Then, the sum of every filled

Bi

is at most 3/2, and the sum of remaining items is at most 1, so the sum of all items is at most

3t/2+1

. On the other hand, in the optimal solution the sum of every bin is at least 1, so the sum of all items is at least

OPT(I)

. Therefore,

OPT(I)\leq3t/2+1

as required.

The hard case is

w<t

, that is, some final items are larger than 1/2. We now prove an upper bound on

OPT(I)

by presenting it as a sum

OPT(I)=|K0|+|K1|+|K2|

where:

K0:=

the optimal bins with no initial/final items (only middle items).

K1:=

the optimal bins with exactly one initial/final item (and some middle items).

K2:=

the optimal bins with two or more initial/final items (and some middle items).We focus first on the optimal bins in

K0

and

K1

. We present a bijection between the items in each such bin to some items in

B1,\ldots,Bt

which are at least as valuable.

K1

bins is mapped to the initial item in

B1,\ldots,B

|K1|

. Note that these are the largest initial items.

K0

and

K1

bins are mapped to the middle items in

B1,\ldots,Bw

. Note that these bins contain all the middle items.

K0

and

K1

are mapped to all non-final items in

B1,\ldots,B

|K1|

, plus all middle items in
B
|K1|+1

,\ldots,Bw

.

B1,\ldots,Bw

without its final item is less than 1. Moreover, the initial item is more than 1/2, so the sum of only the middle items is less than 1/2. Therefore, the sum of all non-final items in

B1,\ldots,B

|K1|

, plus all middle items in
B
|K1|+1

,\ldots,Bw

, is at most

|K1|+(w-|K1|)/2=(|K1|+w)/2

.

|K0|+|K1|\leq(|K1|+w)/2

, which implies

2|K0|+|K1|\leqw\leqt

.We now focus on the optimal bins in

K1

and

K2

.

K1

and

K2

bins is at least

|K1|+2|K2|

, but their total number is also

2t

since there are exactly two initial/final items in each bin. Therefore,

|K1|+2|K2|\leq2t

.

2OPT(I)\leq3t

, which implies

OPT(I)\leq3t/2

.

Tightness

The 2/3 factor is tight for BDF. Consider the following instance (where

\epsilon>0

is sufficiently small):\begin1-6 k \epsilon, ~&~ \tfrac-\epsilon, \ldots, \tfrac-\epsilon, ~&~ \epsilon,\ldots,\epsilon\\ ~&~ \ ~&~ \\endBDF initializes the first bin with the largest item and fills it with the

6k

smallest items. Then, the remaining

6k

items can cover bins only in triplets, so all in all

2k+1

bins are filled. But in OPT one can fill

3k

bins, each of which contains two of the middle-sized items and two small items.

Three-classes bin-filling algorithm

Csirik, Frenk, Lebbe and Zhang present another algorithm that attains a 3/4 approximation. The algorithm orders the items from large to small, and partitions them into three classes:

The algorithm works in two phases. Phase 1:

Phase 2:

In the above example, showing the tightness of BDF, the sets are:\begin1-6 k \epsilon, ~&~ \tfrac-\epsilon, \ldots, \tfrac-\epsilon, ~&~ \epsilon,\ldots,\epsilon\\ \ ~&~ \ ~&~ \\endTCF attains the optimal outcome, since it initializes all

3k

bins with pairs of items from Y, and fills them with pairs of items from Z.

For any instance I, denote by

OPT(I)

the number of bins in the optimal solution, and by

TCF(I)

the number of full bins in the three-classes filling algorithm. Then

TCF(I)\geq(3/4)(OPT(I)-4)

.

The 3/4 factor is tight for TCF. Consider the following instance (where

\epsilon>0

is sufficiently small):

\begin\tfrac-6 k \epsilon, \tfrac-6 k \epsilon, ~&~ \tfrac-\epsilon, \ldots, \tfrac-\epsilon, ~&~ \epsilon,\ldots,\epsilon\\ ~&~ \ ~&~ \\end

TCF initializes the first bin with the largest two items, and fills it with the

12k

smallest items. Then, the remaining

12k

items can cover bins only in groups of four, so all in all

3k+1

bins are filled. But in OPT one can fill

4k

bins, each of which contains 3 middle-sized items and 3 small items.

Polynomial-time approximation schemes

Csirik, Johnson and Kenyon present an asymptotic PTAS. It is an algorithm that, for every ε>0, fills at least

(1-5\varepsilon)OPT(I)-4

bins if the sum of all items is more than

13B/\epsilon3

, and at least

(1-2\varepsilon)OPT(I)-1

otherwise. It runs in time
1/\varepsilon2
O(n

)

. The algorithm solves a variant of the configuration linear program, with
1/\varepsilon2
n
variables and

1+1/\varepsilon2

constraints. This algorithm is only theoretically interesting, since in order to get better than 3/4 approximation, we must take

\varepsilon<1/20

, and then the number of variables is more than

n400

.

They also present algorithms for the online version of the problem. In the online setting, it is not possible to get an asymptotic worst-case approximation factor better than 1/2. However, there are algorithms that perform well in the average case.

Jansen and Solis-Oba present an asymptotic FPTAS. It is an algorithm that, for every ε>0, fills at least

(1-\varepsilon)OPT(I)-1

bins if the sum of all items is more than

13B/\epsilon3

(if the sum of items is less than that, then the optimum is at most

13/\epsilon3\inO(1/\epsilon3)

anyway). It runs in time
O\left(1
\epsilon5

⋅ ln{

n
\varepsilon
}\cdot \max+\frac\mathcal(\frac)\right), where

l{TM}(n)

is the runtime complexity of the best available algorithm for matrix inversion (currently, around

O(n2.38)

). This algorithm becomes better than the 3/4 approximation already when

\varepsilon<1/4

, and in this case the constants are reasonable - about

210n2+218

.

Performance with divisible item sizes

An important special case of bin covering is that the item sizes form a divisible sequence (also called factored). A special case of divisible item sizes occurs in memory allocation in computer systems, where the item sizes are all powers of 2. If the item sizes are divisible, then some of the heuristic algorithms for bin covering find an optimal solution.[5]

Related problems

In the fair item allocation problem, there are different people each of whom attributes a different value to each item. The goal is to allocate to each person a "bin" full of items, such that the value of each bin is at least a certain constant, and as many people as possible receive a bin. Many techniques from bin covering are used in this problem too.

Implementations

Notes and References

  1. Assmann. S. F. Johnson. D. S. Kleitman. D. J. Leung. J. Y. -T. 1984-12-01. On a dual version of the one-dimensional bin packing problem. Journal of Algorithms. en. 5. 4. 502–525. 10.1016/0196-6774(84)90004-X. 0196-6774.
  2. Csirik. János. J. B. G. Frenk and M. Labbé and S. Zhang. 1999-01-01. Two simple algorithms for bin covering. Acta Cybernetica. en. 14. 1. 13–25. 2676-993X.
  3. Csirik. Janos. Johnson. David S.. Kenyon. Claire. 2001-01-09. Better approximation algorithms for bin covering. Proceedings of the Twelfth Annual ACM-SIAM Symposium on Discrete Algorithms. SODA '01. Washington, D.C., USA. Society for Industrial and Applied Mathematics. 557–566. 978-0-89871-490-6.
  4. Jansen. Klaus. Solis-Oba. Roberto. 2002-11-21. An Asymptotic Fully Polynomial Time Approximation Scheme for Bin Covering. Proceedings of the 13th International Symposium on Algorithms and Computation. ISAAC '02. 2518 . Berlin, Heidelberg. Springer-Verlag. 175–186. 10.1007/3-540-36136-7_16 . 978-3-540-00142-3.
  5. Coffman . E. G . Garey . M. R . Johnson . D. S . 1987-12-01 . Bin packing with divisible item sizes . Journal of Complexity . 3 . 4 . 406–428 . 10.1016/0885-064X(87)90009-4 . 0885-064X.