The bin packing problem is an optimization problem, in which items of different sizes must be packed into a finite number of bins or containers, each of a fixed given capacity, in a way that minimizes the number of bins used. The problem has many applications, such as filling up containers, loading trucks with weight capacity constraints, creating file backups in media, splitting a network prefix into multiple subnets, and technology mapping in FPGA semiconductor chip design. Computationally, the problem is NP-hard, and the corresponding decision problem, deciding if items can fit into a specified number of bins, is NP-complete. Despite its worst-case hardness, optimal solutions to very large instances of the problem can be produced with sophisticated algorithms. In addition, many approximation algorithms exist. For example, the first fit algorithm provides a fast but often non-optimal solution, involving placing each item into the first bin in which it will fit. It requires Θ(n log n) time, where n is the number of items to be packed. The algorithm can be made much more effective by first sorting the list of items into decreasing order (sometimes known as the first-fit decreasing algorithm), although this still does not guarantee an optimal solution and for longer lists may increase the running time of the algorithm. It is known, however, that there always exists at least one ordering of items that allows first-fit to produce an optimal solution. There are many variations of this problem, such as 2D packing, linear packing, packing by weight, packing by cost, and so on. The bin packing problem can also be seen as a special case of the cutting stock problem. When the number of bins is restricted to 1 and each item is characterized by both a volume and a value, the problem of maximizing the value of items that can fit in the bin is known as the knapsack problem. A variant of bin packing that occurs in practice is when items can share space when packed into a bin. Specifically, a set of items could occupy less space when packed together than the sum of their individual sizes. This variant is known as VM packing since when virtual machines (VMs) are packed in a server, their total memory requirement could decrease due to pages shared by the VMs that need only be stored once. If items can share space in arbitrary ways, the bin packing problem is hard to even approximate. However, if space sharing fits into a hierarchy, as is the case with memory sharing in virtual machines, the bin packing problem can be efficiently approximated. Another variant of bin packing of interest in practice is the so-called online bin packing. Here the items of different volume are supposed to arrive sequentially, and the decision maker has to decide whether to select and pack the currently observed item, or else to let it pass. Each decision is without recall. In contrast, offline bin packing allows rearranging the items in the hope of achieving a better packing once additional items arrive. This of course requires additional storage for holding the items to be rearranged.
Formal statement In Computers and Intractability Garey and Johnson list the bin packing problem under the reference [SR1]. They define its decision variant as follows. Instance: Finite set I of items, a size s(i)∈ℤ+ for each i∈I, a positive integer bin capacity B, and a positive integer K. Question: Is there a partition of I into disjoint sets I1,…,IK such that the sum of the sizes of the items in each Ij is B or less? Note that in the literature often an alternate, but not equivalent, notation is used, where B=1 and s(i)∈ℚ∩(0,1] for each i∈I. Furthermore, research is mostly interested in the optimization variant, which asks for the smallest possible value of K. A solution is optimal if it has minimal K. The K-value for an optimal solution for a set of items I is denoted by OPT(I) or just OPT if the set of items is clear from the context. A possible integer linear programming formulation of the problem is:
where yj=1 if bin j is used and xij=1 if item i is put into bin j.
Hardness of bin packing The bin packing problem is strongly NP-complete. This can be proven by reducing the strongly NP-complete 3-partition problem to bin packing. Furthermore, there can be no approximation algorithm with absolute approximation ratio smaller than 32 unless 𝖯=𝖭𝖯. This can be proven by a reduction from the partition problem: given an instance of Partition where the sum of all input numbers is 2T, construct an instance of bin packing in which the bin size is T. If there exists an equal partition of the inputs, then the optimal packing needs 2 bins; therefore, every algorithm with an approximation ratio smaller than 3/2 must return less than 3 bins, which must be 2 bins. In contrast, if there is no equal partition of the inputs, then the optimal packing needs at least 3 bins. On the other hand, bin packing is solvable in pseudo-polynomial time for any fixed number of bins K, and solvable in polynomial time for any fixed bin capacity B.
Approximation algorithms for bin packing To measure the performance of an approximation algorithm there are two approximation ratios considered in the literature. For a given list of items L the number A(L) denotes the number of bins used when algorithm A is applied to list L, while OPT(L) denotes the optimum number for this list. The absolute worst-case performance ratio RA for an algorithm A is defined as
RA≡inf{r≥1:A(L)/OPT(L)≤r for all lists L}. On the other hand, the asymptotic worst-case ratio RA∞ is defined as
RA∞≡inf{r≥1:∃N>0,A(L)/OPT(L)≤r for all lists L with OPT(L)≥N}. Equivalently, RA∞ is the smallest number such that there exists some constant K, such that for all lists L:
A(L)≤RA∞⋅OPT(L)+K. Additionally, one can restrict the lists to those for which all items have a size of at most α. For such lists, the bounded size performance ratios are denoted as RA(size≤α) and RA∞(size≤α). Approximation algorithms for bin packing can be classified into two categories:
… excerpt ends here. Continue reading the full article.