, Volume 68, Issue 4, pp 1019–1044 | Cite as

Online Square Packing with Gravity

  • Sándor P. Fekete
  • Tom Kamphans
  • Nils Schweer


We analyze the problem of packing squares in an online fashion: Given a semi-infinite strip of width 1 and an unknown sequence of squares of side length in [0,1] that arrive from above, one at a time. The objective is to pack these items as they arrive, minimizing the resulting height. Just like in the classical game of Tetris, each square must be moved along a collision-free path to its final destination. In addition, we account for gravity in both motion (squares must never move up) and position (any final destination must be supported from below). A similar problem has been considered before; the best previous result is by Azar and Epstein, who gave a 4-competitive algorithm in a setting without gravity (i.e., with the possibility of letting squares “hang in the air”) based on ideas of shelf packing: Squares are assigned to different horizontal levels, allowing an analysis that is reminiscent of some bin-packing arguments. We apply a geometric analysis to establish a competitive factor of 3.5 for the bottom-left heuristic and present a \(\frac{34}{13} \approx 2.6154\)-competitive algorithm.


Online packing Strip packing Squares Gravity Tetris 


  1. 1.
    Azar, Y., Epstein, L.: On two dimensional packing. J. Algorithms 25(2), 290–310 (1997) CrossRefMATHMathSciNetGoogle Scholar
  2. 2.
    Baker, B.S., Schwarz, J.S.: Shelf algorithms for two-dimensional packing problems. SIAM J. Comput. 12(3), 508–525 (1983) CrossRefMATHMathSciNetGoogle Scholar
  3. 3.
    Baker, B.S., Coffman, E.G. Jr., Rivest, R.L.: Orthogonal packings in two dimensions. SIAM J. Comput. 9(4), 846–855 (1980) CrossRefMATHMathSciNetGoogle Scholar
  4. 4.
    Baker, B.S., Brown, D.J., Katseff, H.P.: A 5/4 algorithm for two-dimensional packing. J. Algorithms 2(4), 348–368 (1981) CrossRefMATHMathSciNetGoogle Scholar
  5. 5.
    Balogh, J., Békési, J., Galambos, G.: New lower bounds for certain classes of bin packing algorithms. In: Proc. 8th Internat. Workshop Approx. Online Algor. Lect. Notes Comput. Sci., vol. 6534, pp. 25–36 (2010) CrossRefGoogle Scholar
  6. 6.
    Breukelaar, R., Demaine, E.D., Hohenberger, S., Hoogeboom, H.J., Kosters, W.A., Liben-Nowell, D.: Tetris is hard, even to approximate. Int. J. Comput. Geom. Appl. 14(1–2), 41–68 (2004) CrossRefMATHMathSciNetGoogle Scholar
  7. 7.
    Brown, D.J., Baker, B.S., Katseff, H.P.: Lower bounds for on-line two-dimensional packing algorithms. Acta Inform. 18(2), 207–225 (1982) CrossRefMATHMathSciNetGoogle Scholar
  8. 8.
    Brucker, P.: Scheduling Algorithms, 2nd edn. Springer, Berlin (2004) CrossRefMATHGoogle Scholar
  9. 9.
    Coffman, E.G. Jr., Garey, M.R., Johnson, D.S., Tarjan, R.E.: Performance bounds for level-oriented two-dimensional packing algorithms. SIAM J. Comput. 9(4), 808–826 (1980) CrossRefMATHMathSciNetGoogle Scholar
  10. 10.
    Coffman, E.G. Jr., Downey, P.J., Winkler, P.: Packing rectangles in a strip. Acta Inform. 38(10), 673–693 (2002) CrossRefMATHMathSciNetGoogle Scholar
  11. 11.
    Csirik, J., Woeginger, G.J.: Shelf algorithms for on-line strip packing. Inf. Process. Lett. 63(4), 171–175 (1997) CrossRefMathSciNetGoogle Scholar
  12. 12.
    Epstein, L., van Stee, R.: Online square and cube packing. Acta Inform. 41, 595–606 (2005) CrossRefMATHMathSciNetGoogle Scholar
  13. 13.
    Fekete, S.P., Schepers, J.: New classes of lower bounds for bin packing problems. In: Proceedings of the 6th International Conference on Integer Programming and Combinatorial Optimization (IPCO’98). Lecture Notes in Computer Science, vol. 1412, pp. 257–270. Springer, Berlin (1998) CrossRefGoogle Scholar
  14. 14.
    Fekete, S.P., Schepers, J., van der Veen, J.: An exact algorithm for higher-dimensional orthogonal packing. Oper. Res. 55, 569–587 (2007) CrossRefMATHMathSciNetGoogle Scholar
  15. 15.
    Fekete, S.P., Kamphans, T., Schweer, N.: Online square packing. In: Proceedings of the 11th Algorithms and Data Structures Symposium (WADS’09). Lecture Notes in Computer Science, vol. 5664, pp. 302–314. Springer, Berlin (2009) CrossRefGoogle Scholar
  16. 16.
    Galambos, G., Frenk, J.B.G.: A simple proof of Liang’s lower bound for online bin packing and the extension to the parametric case. Discrete Appl. Math. 41(2), 173–178 (1993) CrossRefMATHMathSciNetGoogle Scholar
  17. 17.
    Galambos, G., Woeginger, G.J.: Online bin packing—a restricted survey. Math. Methods Oper. Res. 42(1), 25–45 (1995) CrossRefMATHMathSciNetGoogle Scholar
  18. 18.
    Graham, R.L.: Bounds on multiprocessing timing anomalies. SIAM J. Appl. Math. 17(2), 416–429 (1969) CrossRefMATHMathSciNetGoogle Scholar
  19. 19.
    Han, X., Iwama, K., Ye, D., Zhang, G.: Strip packing vs. bin packing. In: Proceedings of the 3rd International Conference on Algorithmic Aspects in Information and Management (AAIM’07). Lecture Notes in Computer Science, vol. 4508, pp. 358–367. Springer, Berlin (2007) CrossRefGoogle Scholar
  20. 20.
    Kenyon, C., Rémila, E.: Approximate strip packing. In: Proceedings of the 37th Annual IEEE Symposium on Foundations of Computer Science, (FOCS’96), pp. 31–36. IEEE Comput. Soc., Los Alamitos (1996) Google Scholar
  21. 21.
    Schiermeyer, I.: Reverse-fit: A 2-optimal algorithm for packing rectangles. In: Proceedings of the 2nd Annual European Symposium on Algorithms (ESA’94). Lecture Notes in Computer Science, vol. 855, pp. 290–299. Springer, Berlin (1994) Google Scholar
  22. 22.
    Seiden, S.S.: On the online bin packing problem. J. ACM 49(5), 640–671 (2002) CrossRefMathSciNetGoogle Scholar
  23. 23.
    Sleator, D.D.: A 2.5 times optimal algorithm for packing in two dimensions. Inf. Process. Lett. 10(1), 37–40 (1980) CrossRefMATHMathSciNetGoogle Scholar
  24. 24.
    Steinberg, A.: A strip-packing algorithm with absolute performance bound 2. SIAM J. Comput. 26(2), 401–409 (1997) CrossRefMATHMathSciNetGoogle Scholar
  25. 25.
    van Vliet, A.: An improved lower bound for online bin packing algorithms. Inf. Process. Lett. 43(5), 277–284 (1992) CrossRefMATHGoogle Scholar
  26. 26.
    Ye, D., Han, X., Zhang, G.: A note on online strip packing. J. Comb. Optim. 17(4), 417–423 (2009) CrossRefMATHMathSciNetGoogle Scholar

Copyright information

© Springer Science+Business Media New York 2012

Authors and Affiliations

  • Sándor P. Fekete
    • 1
  • Tom Kamphans
    • 1
  • Nils Schweer
    • 1
  1. 1.Department of Computer Science, Algorithms GroupBraunschweig University of TechnologyBraunschweigGermany

Personalised recommendations