First-fit bin packing

From Wikipedia, the free encyclopedia
  (Redirected from )

First-fit (FF) is an online algorithm for bin packing. Its input is a list of items of different sizes. Its output is a packing - a partition of the items into bins of fixed capacity, such that the sum of sizes of items in each bin is at most the capacity. Ideally, we would like to use as few bins as possible, but minimizing the number of bins is an NP-hard problem. The first-fit algorithm uses the following heuristic:

  • It keeps a list of open bins, which is initially empty.
  • When an item arrives, it find the first bin into which the item can fit, if any.
    • If such a bin is found, the new item is placed inside it.
    • Otherwise, a new bin is opened and the coming item is placed inside it.

Approximation ratio[]

Denote by FF(L) the number of bins used by First-Fit, and by OPT(L) the optimal number of bins possible for the list L. The analysis of FF(L) was done in several steps.

  • The first upper bound of for FF was proven by Ullman[1] in 1971.
  • In 1972, this upper bound was improved to by Garey, Graham and Ullman,[2] Johnson and Demers.[3]
  • In 1976, it was improved by Garey, Graham, Johnson, Yao and Chi-Chih[4] to , which is equivalent to due to the integrality of and .
  • The next improvement, by Xia and Tan [5] in 2010, lowered the bound to .
  • Finally, in 2013, this bound was improved to by Dósa and Sgall.[6] They also present an example input list , for which matches this bound.

Refined first-fit[]

Refined-First-Fit (RFF) is another online algorithm for bin packing, that improves on the previously developed FF algorithm. It was presented by Andrew Chi-Chih Yao.[7]

The algorithm[]

The items are categorized in four classes, according to their sizes:

  • -piece - size in .
  • -piece - size in .
  • -piece - size in .
  • -piece - size in .

Similarly, the bins are categorized into four classes: 1, 2, 3 and 4.

Let be a fixed integer. The next item is assigned into a bin in -

  • Class 1, if is an -piece,
  • Class 2, if is an -piece,
  • Class 3, if is an -piece, but not the th -piece seen so far, for any integer .
  • Class 1, if is the th -piece seen so far,
  • Class 4, if is an -piece.

Once the class of the item is selected, it is placed inside items of that class using first-fit bin packing.

Note that RFF is not an Any-Fit algorithm since it may open a new bin despite the fact that the current item fits inside an open bin (from another class).

Approximation ratio[]

RFF has an approximation guarantee of . There exists a family of lists with for .[7]

See also[]

  • First-Fit-Decreasing (FFD) is the offline variant of First-Fit: it accepts all input items, orders them by descending size, and calls First-Fit. Its asymptotic approximation ratio is much better: about 1.222 instead of 1.7.

References[]

  1. ^ Ullman, J. D. (1971). "The performance of a memory allocation algorithm". Technical Report 100 Princeton Univ.
  2. ^ Garey, M. R; Graham, R. L; Ullman, J. D. (1972). "Worst-case analysis of memory allocation algorithms | Proceedings of the fourth annual ACM symposium on Theory of computing". Proceedings of the Fourth Annual ACM Symposium on Theory of Computing: 143–150. doi:10.1145/800152.804907. S2CID 26654056.
  3. ^ David S. Johnson, Alan J. Demers, Jeffrey D. Ullman, M. R. Garey, Ronald L. Graham. Worst-Case Performance Bounds for Simple One-Dimensional Packing Algorithms. SICOMP, Volume 3, Issue 4. 1974.
  4. ^ Garey, M. R; Graham, R. L; Johnson, D. S; Yao, Andrew Chi-Chih (1976). "Resource constrained scheduling as generalized bin packing". Journal of Combinatorial Theory, Series A. 21 (3): 257–298. doi:10.1016/0097-3165(76)90001-7. ISSN 0097-3165.
  5. ^ Xia, Binzhou; Tan, Zhiyi (August 2010). "Tighter bounds of the First Fit algorithm for the bin-packing problem". Discrete Applied Mathematics. 158 (15): 1668–1675. doi:10.1016/j.dam.2010.05.026.
  6. ^ Dósa, György; Sgall, Jiri (2013). "First Fit bin packing: A tight analysis". 30th International Symposium on Theoretical Aspects of Computer Science (STACS 2013). Schloss Dagstuhl–Leibniz-Zentrum für Informatik. 20: 538–549. doi:10.4230/LIPIcs.STACS.2013.538.
  7. ^ a b Yao, Andrew Chi-Chih (April 1980). "New Algorithms for Bin Packing". Journal of the ACM. 27 (2): 207–227. doi:10.1145/322186.322187. S2CID 7903339.
Retrieved from ""