bin covering problem

{{short description|Operations research problem of packing items into the largest number of bins}}

{{Covering/packing-problem pairs}}

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.{{Cite journal|last1=Assmann|first1=S. F.|author1-link=Susan Assmann|last2=Johnson|first2=D. S|last3=Kleitman|first3=D. J|last4=Leung|first4=J. Y. -T|date=1984-12-01|title=On a dual version of the one-dimensional bin packing problem|url=https://dx.doi.org/10.1016/0196-6774%2884%2990004-X|journal=Journal of Algorithms|language=en|volume=5|issue=4|pages=502–525|doi=10.1016/0196-6774(84)90004-X|issn=0196-6774}}

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

  • Algorithms covering at least 1/2, 2/3 or 3/4 of the optimum bin count asymptotically, running in time O(n), O(n \log n), O(n {\log}^2 n) respectively.{{Cite journal|last1=Csirik|first1=János|last2=J. B. G. Frenk and M. Labbé and S. Zhang|date=1999-01-01|title=Two simple algorithms for bin covering|url=https://cyber.bibl.u-szeged.hu/index.php/actcybern/article/view/3507|journal=Acta Cybernetica|language=en|volume=14|issue=1|pages=13–25|issn=2676-993X|via=}}
  • An asymptotic PTAS, algorithms with bounded worst-case behavior whose expected behavior is asymptotically-optimal for some discrete distributions, and a learning algorithm with asymptotically optimal expected behavior for all discrete distributions.{{Cite journal|last1=Csirik|first1=Janos|last2=Johnson|first2=David S.|last3=Kenyon|first3=Claire|date=2001-01-09|title=Better approximation algorithms for bin covering|url=https://dl.acm.org/doi/abs/10.5555/365411.365533|journal=Proceedings of the Twelfth Annual ACM-SIAM Symposium on Discrete Algorithms|series=SODA '01|location=Washington, D.C., USA|publisher=Society for Industrial and Applied Mathematics|pages=557–566|isbn=978-0-89871-490-6}}
  • An asymptotic FPTAS.{{cite journal

| last1 = Jansen | first1 = Klaus

| last2 = Solis-Oba | first2 = Roberto

| doi = 10.1016/S0304-3975(03)00363-3

| issue = 1-3

| journal = Theoretical Computer Science

| mr = 2000192

| pages = 543–551

| title = An asymptotic fully polynomial time approximation scheme for bin covering

| volume = 306

| year = 2003}}

The bidirectional bin-filling algorithm

Csirik, Frenk, Lebbe and Zhang{{Rp|16-19}} present the following simple algorithm for 2/3 approximation. Suppose the bin size is 1 and there are n items.

  • Order the items from the largest (1) to smallest (n).
  • Fill a bin with the largest items: 1, 2, ..., m, where m is the largest integer for which the sum of items 1, ..., m is less than 1.
  • Add to this bin the smallest items: n, n-1, ..., until its value raises above 1.

For any instance I, denote by \mathrm{OPT}(I) the number of bins in the optimal solution, and by \mathrm{BDF}(I) the number of full bins in the bidirectional filling algorithm. Then \mathrm{BDF}(I) \geq (2/3) \mathrm{OPT}(I) - (2/3), or equivalently, \mathrm{OPT}(I) \leq (3/2) \mathrm{BDF}(I)+1.

= Proof =

For the proof, the following terminology is used.

  • t := \mathrm{BDF}(I) = the number of bins filled by the algorithm.
  • B_1,\ldots,B_t := the t bins filled by the algorithm.
  • Initial items - the t items that are inserted first into each of the t bins.
  • Final items - the t items that are inserted last into each of the t bins.
  • Middle items - all items that are neither initial nor final.
  • 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 B_1,\ldots,B_t 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 B_1,\ldots,B_w contains an initial item, possibly some middle items, and a final item. Each of the last t-w bins B_{w+1},\ldots,B_t 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 B_i 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 \mathrm{OPT}(I). Therefore, \mathrm{OPT}(I) \leq 3t/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 \mathrm{OPT}(I) by presenting it as a sum \mathrm{OPT}(I) = |K_0|+|K_1|+|K_2| where:

  • K_0 := the optimal bins with no initial/final items (only middle items).
  • K_1 := the optimal bins with exactly one initial/final item (and some middle items).
  • K_2 := the optimal bins with two or more initial/final items (and some middle items).

We focus first on the optimal bins in K_0 and K_1 . We present a bijection between the items in each such bin to some items in B_1,\ldots,B_t which are at least as valuable.

  • The single initial/final item in the K_1 bins is mapped to the initial item in B_1,\ldots,B_
    K_1
    . Note that these are the largest initial items.
  • The middle items in the K_0 and K_1 bins are mapped to the middle items in B_1,\ldots,B_{w} . Note that these bins contain all the middle items.
  • Therefore, all items in K_0 and K_1 are mapped to all non-final items in B_1,\ldots,B_
    K_1
    , plus all middle items in B_
    K_1|+1},\ldots,B_{w} .
  • The sum of each bin B_1,\ldots,B_{w} 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 B_1,\ldots,B_{|K_1
  • , plus all middle items in B_{|K_1|+1},\ldots,B_{w} , is at most |K_1| + (w-|K_1|)/2 = (|K_1|+w)/2 .
  • The sum of each optimal bin is at least 1. Hence: |K_0| + |K_1| \leq (|K_1|+w)/2 , which implies 2 |K_0| + |K_1| \leq w \leq t .

We now focus on the optimal bins in K_1 and K_2 .

  • The total number of initial/final items in the K_1 and K_2 bins is at least |K_1| + 2|K_2| , but their total number is also 2 t since there are exactly two initial/final items in each bin. Therefore, |K_1| + 2|K_2|\leq 2 t .
  • Summing the latter two inequalities implies that 2 \mathrm{OPT}(I) \leq 3 t, which implies \mathrm{OPT}(I) \leq 3 t/2.

= Tightness =

The 2/3 factor is tight for BDF. Consider the following instance (where \epsilon>0 is sufficiently small):\begin{align}

1-6 k \epsilon, ~&~ \tfrac{1}{2}-\epsilon, \ldots, \tfrac{1}{2}-\epsilon, ~&~ \epsilon,\ldots,\epsilon

\\

~&~ \{\cdots 6k ~ \text{units} \cdots \} ~&~ \{ \cdots 6k ~ \text{units} \cdots \}

\end{align}BDF 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{{Rp|19-24}} present another algorithm that attains a 3/4 approximation. The algorithm orders the items from large to small, and partitions them into three classes:

  • X: The items with size at least 1/2;
  • Y: The items with size less than 1/2 and at least 1/3;
  • Z: The items with size less than 1/3.

The algorithm works in two phases. Phase 1:

  • Initialize a new bin with either the largest item in X, or the two largest items in Y, whichever is larger. Note that in both cases, the initial bin sum is less than 1.
  • Fill the new bin with items from Z in increasing order of value.
  • Repeat until either X U Y or Z are empty.

Phase 2:

  • If X U Y is empty, fill bins with items from Z by the simple next-fit rule.
  • If Z is empty, pack the items remaining in X by pairs, and those remaining in Y by triplets.

In the above example, showing the tightness of BDF, the sets are:\begin{align}

1-6 k \epsilon, ~&~ \tfrac{1}{2}-\epsilon, \ldots, \tfrac{1}{2}-\epsilon, ~&~ \epsilon,\ldots,\epsilon

\\

\{ |X|=1 \} ~&~ \{ \cdots |Y|=6k \cdots \} ~&~ \{ \cdots |Z|=6k \cdots \}

\end{align}TCF 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 \mathrm{OPT}(I) the number of bins in the optimal solution, and by \mathrm{TCF}(I) the number of full bins in the three-classes filling algorithm. Then \mathrm{TCF}(I) \geq (3/4) (\mathrm{OPT}(I) - 4).

The 3/4 factor is tight for TCF. Consider the following instance (where \epsilon>0 is sufficiently small):

\begin{align}

\tfrac{1}{2}-6 k \epsilon, \tfrac{1}{2}-6 k \epsilon, ~&~ \tfrac{1}{3}-\epsilon, \ldots, \tfrac{1}{3}-\epsilon, ~&~ \epsilon,\ldots,\epsilon

\\

~&~ \{\cdots 12k ~ \text{units} \cdots \} ~&~ \{ \cdots 12k ~ \text{units} \cdots \}

\end{align}

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)\cdot \mathrm{OPT}(I) - 4 bins if the sum of all items is more than 13 B/\epsilon^3, and at least (1 - 2 \varepsilon)\cdot \mathrm{OPT}(I) - 1 otherwise. It runs in time O(n^{1/\varepsilon^2}). The algorithm solves a variant of the configuration linear program, with n^{1/\varepsilon^2}variables and 1 + 1/\varepsilon^2 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 n^{400}.

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)\cdot \mathrm{OPT}(I) -1 bins if the sum of all items is more than 13B/\epsilon^3 (if the sum of items is less than that, then the optimum is at most 13/\epsilon^3\in O(1/\epsilon^3) anyway). It runs in time O\left(

\frac{1}{\epsilon^5}

\cdot \ln{\frac{n}{\varepsilon}}

\cdot \max{(n^2,\frac{1}{\varepsilon}\ln\ln\frac{1}{\varepsilon^3})}

+

\frac{1}{\varepsilon^4}\mathcal{T_M}(\frac{1}{\varepsilon^2})

\right), where \mathcal{T_M}(n) is the runtime complexity of the best available algorithm for matrix inversion (currently, around O(n^{2.38})). This algorithm becomes better than the 3/4 approximation already when \varepsilon < 1/4, and in this case the constants are reasonable - about 2^{10} n^2 + 2^{18}.

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.{{Cite journal |last1=Coffman |first1=E. G |last2=Garey |first2=M. R |last3=Johnson |first3=D. S |date=1987-12-01 |title=Bin packing with divisible item sizes |url=https://dx.doi.org/10.1016/0885-064X%2887%2990009-4 |journal=Journal of Complexity |volume=3 |issue=4 |pages=406–428 |doi=10.1016/0885-064X(87)90009-4 |issn=0885-064X}}{{Rp|location=Sec.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

  • Python: The [https://github.com/erelsgl/prtpy prtpy package] contains an implementation of the [https://github.com/erelsgl/prtpy/blob/main/prtpy/packing/cflz_covering.py Csirik-Frenk-Labbe-Zhang algorithms].

References