Content deleted Content added
Erel Segal (talk | contribs) |
Erel Segal (talk | contribs) |
||
Line 24:
* Handle the large items first:
** Round the item sizes in some way, such that the number of different sizes is at most some constant ''S.''
** Write the integer LP for the rounded instance. Since the number of sizes is ''S'' and there are at most 1/''e'' items in each bin, the total number of configurations is at most ''S''<sup>1/''e''</sup>.
** Solve the integer LP.
* Allocate the small items greedily, e.g. with [[next-fit bin packing]]. If no new bins are created, then we are done. If new bins are created, this means that all bins (except maybe the last one) are full up to at least (1-''e'')''B''. Therefore, the number of bins is at most OPT/(1-''e'')+1, which is (1+O(''e''))OPT+1.
The algorithms differ in how they round the instance and in how the solve the integer LP.
=== Rounding the large-items instance ===
If all items are large (of size at least ''eB''), Karmarkar and Karp<ref name=":12" /> present a more efficient rounding method which they call ''geometric rounding'' (in contrast to the linear rounding of de-la-Vega and Lueker).
=== Solving the integer LP for the rounded instance ===
A simple way to solve the integer LP is by exhaustive search. Since there are at most ''S<sup>1/e</sup>'' configurations, and for each configuration there are at most ''n'' possible values, there are at most <math> n^{S^{1/e}}</math> combinations to check. For each combination, we have to check ''S'' constraints, so the run-time is <math>S\cdot n^{S^{1/e}}</math>, which is polynomial in ''n'' when ''S, e'' are constant.<ref name=":2">{{Cite web|last=Claire Mathieu|title=Approximation Algorithms Part I, Week 3: bin packing|url=https://www.coursera.org/learn/approximation-algorithms-part-1/home/week/3|url-status=live|website=Coursera}}</ref>
A more efficient way is to use the '''fractional configuration LP'''. It is the [[linear programming relaxation]] of the above ILP. It replaces the last constraint <math>x_c\in\{0,\ldots,n\}</math> with the constraint <math>x_c \geq 0</math>. In other words, each configuration can be used a fractional number of times.
* ''Example'': suppose there are 31 items of size 3 and 7 items of size 4, and the bin-size is 10. The configurations are: 4, 44, 34, 334, 3, 33, 333. The constraints are [0,0,1,2,1,2,3]*'''x'''=31 and [1,2,1,1,0,0,0]*'''x'''=7. An optimal solution to the fractional LP is [0,0,0,7,0,0,17/3] That is: there are 7 bins of configuration 334 and 17/3 bins of configuration 333. Note that only two different configurations are needed.
Let FOPT(I) be the optimal solution of the fractional LP for instance I, and OPT(I) the optimal solution of the integral LP. Let AVG be the sum of all sizes divided by ''B''.
It is obvious that AVG(I) ≤ FOPT(I) ≤ OPT(I): AVG(I) is the number of bins when all bins are completely full - no solution can be better than this. FOPT(I) is the solution to the LP, which is less constrained than the ILP, so it is at least as good as OPT(I). Karmarkar and Karp<ref name=":12">{{cite journal|last1=Karmarkar|first1=Narendra|last2=Karp|first2=Richard M.|date=November 1982|title=An efficient approximation scheme for the one-dimensional bin-packing problem|url=https://ieeexplore.ieee.org/document/4568405/references#references|journal=23rd Annual Symposium on Foundations of Computer Science (SFCS 1982)|pages=312–320|doi=10.1109/SFCS.1982.61|s2cid=18583908}}</ref> prove the following inequalities for any instance I: ▼
* AVG(I) ≤ FOPT(I), since AVG(I) is the (possibly fractional) number of bins when all bins are completely filled with items or fractions of items. Clearly, no solution can be more efficient.
* FOPT(I) ≤ OPT(I), since FOPT(I) is a solution to a minimization problem with fewer constraints.
* OPT(I) < 2*AVG(I), since in any packing with at least 2*AVG(I) bins, the sum of the two least-full bins is at most ''B'', so they can be combined into a single bin.
▲
* Let '''x''' be an optimal [[basic feasible solution]] of the fractional LP. By definition, the value of '''x''' is FOPT(I). Since the fractional LP has ''S'' constraints, '''x''' has at most ''S'' nonzero variables, that is, at most ''S'' different configurations are used. We construct from '''x''' an integral packing consisting of a ''principal part'' and a ''residual part''.
* The principal part contains floor(''x<sub>c</sub>'') bins of each configuration ''c'' for which ''x<sub>c</sub>''
* For the residual part (denoted by ''R''), we construct two candidate packings:
** A single bin of each configuration ''c'' for which ''x<sub>c</sub>''
** A greedy packing
* The smallest of these packings requires min(S, 2*AVG(''R'')
* Adding to this the rounded-down bins of the principal part yields FOPT(I) +
* The execution time of this conversion algorithm is O(''n'' log ''n'').
|