All-Around Near-Optimal Solutions for the Online Bin Packing Problem

  • Shahin Kamali
  • Alejandro López-Ortiz
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9472)


In this paper we present algorithms with optimal average-case and close-to-best known worst-case performance for the classic online bin packing problem. It has long been observed that known bin packing algorithms with optimal average-case performance are not optimal in the worst-case. In particular First Fit and Best Fit have optimal asymptotic average-case ratio of 1 but a worst-case competitive ratio of 1.7. The competitive ratio can be improved to 1.691 using the Harmonic algorithm. Further variations of this algorithm can push down the competitive ratio to 1.588. However, these algorithms have poor performance on average; in particular, Harmonic algorithm has average-case ratio of 1.27. In this paper, first we introduce a simple algorithm which we term Harmonic Match. This algorithm performs as well as Best Fit on average, i.e., it has an average-case ratio of 1. Moreover, the competitive ratio of the algorithm is as good as Harmonic, i.e., it converges to 1.691 which is an improvement over Best Fit and First Fit. We also introduce a different algorithm, termed as Refined Harmonic Match, which achieves an improved competitive ratio of 1.636 while maintaining the good average-case performance of Harmonic Match and Best Fit. Our experimental evaluations show that our proposed algorithms have comparable average-case performance with Best Fit and First Fit, and this holds also for sequences that follow distributions other than the uniform distribution.


  1. 1.
    Balogh, J., Békési, J., Galambos, G.: New lower bounds for certain classes of bin packing algorithms. Theor. Comput. Sci. 440–441, 1–13 (2012)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Bentley, J.L., Johnson, D.S., Leighton, F.T., McGeoch, C.C., McGeoch, L.A.: Some unexpected expected behavior results for bin packing. In: Proceedings of the 16th Symposium on Theory of Computing (STOC), pp. 279–288 (1984)Google Scholar
  3. 3.
    Boyar, J., Favrholdt, L.M.: The relative worst order ratio for online algorithms. ACM Trans. Algorithms 3(2), 22 (2007)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Coffman, E.G., Garey, M.R., Johnson, D.S.: Approximation algorithms for bin packing: a survey. In: Approximation Algorithms for NP-hard Problems. PWS Publishing Co., Boston (1997)Google Scholar
  5. 5.
    Coffman, E.G., Hofri, M., So, K., Yao, A.C.C.: A stochastic model of bin packing. Inf. Control 44, 105–115 (1980)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Coffman, E.G., Johnson, D.S., Shor, P.W., Weber, R.R.: Bin packing with discrete item sizes, part II: tight bounds on First Fit. Random Struct. Algorithms 10(1–2), 69–101 (1997)CrossRefzbMATHGoogle Scholar
  7. 7.
    Coffman Jr, E.G., Lueker, G.S.: Probabilistic Analysis of Packing and Partitioning Algorithms. Wiley-Interscience Series in Discrete Mathematics and Optimization. Wiley, New York (1991)zbMATHGoogle Scholar
  8. 8.
    Coffman, E.G., Shor, P.W.: A simple proof of the \({O(\sqrt{n \log ^{3/4} n)}}\) up-right matching bound. SIAM J. Discrete Math. 4, 48–57 (1991)MathSciNetCrossRefzbMATHGoogle Scholar
  9. 9.
    Csirik, J., Galambos, G.: An \({O}(n)\) bin-packing algorithm for uniformly distributed data. Computing 36(4), 313–319 (1986)MathSciNetCrossRefzbMATHGoogle Scholar
  10. 10.
    Gu, X., Chen, G., Xu, Y.: Deep performance analysis of refined harmonic bin packing algorithm. J. Comput. Sci. Technol. 17, 213–218 (2002)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Johnson, D.S.: Near-optimal bin packing algorithms. Ph.D. thesis, MIT (1973)Google Scholar
  12. 12.
    Karp, R.M., Luby, M., Marchetti-Spaccamela, A.: Probabilistic analysis of multi-dimensional binpacking problems. In: Proceedings of the 16th Symposium on Theory of Computing (STOC), pp. 289–298 (1984)Google Scholar
  13. 13.
    Kousiouris, G.: Minimizing the effect of dos attacks on elastic cloud-based applications. In: Proceedings of International Conference on Cloud Computing and Services Science, pp. 622–628 (2014)Google Scholar
  14. 14.
    Lee, C.C., Lee, D.T.: A simple online bin packing algorithm. J. ACM 32, 562–572 (1985)CrossRefzbMATHGoogle Scholar
  15. 15.
    Lee, C.C., Lee, D.T.: Robust online bin packing algorithms. Northwestern University, Technical report (1987)Google Scholar
  16. 16.
    Leighton, F.T., Shor, P.: Tight bounds for minimax grid matching with applications to the average case analysis of algorithms. Combinatorica 9, 161–187 (1989)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Ramanan, P., Tsuga, K.: Average-case analysis of the modified harmonic algorithm. Algorithmica 4, 519–533 (1989)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Ramanan, P.V., Brown, D.J., Lee, C.C., Lee, D.T.: On-line bin packing in linear time. J. Algorithms 10, 305–326 (1989)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    Rhee, W.T., Talagrand, M.: Exact bounds for the stochastic upward matching problem. Trans. AMS 307(1), 109–125 (1988)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Seiden, S.S.: On the online bin packing problem. J. ACM 49, 640–671 (2002)MathSciNetCrossRefzbMATHGoogle Scholar
  21. 21.
    Shor, P.W.: The average-case analysis of some online algorithms for bin packing. Combinatorica 6, 179–200 (1986)MathSciNetCrossRefzbMATHGoogle Scholar
  22. 22.
    Shor, P.W.: How to pack better than Best-Fit: Tight bounds for average-case on-line bin packing. In: Proceedings of the 32nd Symposium on Foundations of Computer Science (FOCS), pp. 752–759 (1991)Google Scholar
  23. 23.
    Yao, A.C.C.: New algorithms for bin packing. J. ACM 27, 207–227 (1980)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2015

Authors and Affiliations

  1. 1.Massachusetts Institute of TechnologyCambridgeUSA
  2. 2.University of WaterlooWaterlooCanada

Personalised recommendations