# Online Square Packing with Gravity

## Abstract

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.

This is a preview of subscription content, log in via an institution to check access.

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

### Online Square-into-Square Packing

Sándor P. Fekete & Hella-Franziska Hoffmann

## Notes

1. That is, we take the square with the topmost bottom line. If there is more than one, we take the leftmost of these squares.

2. The charge to the bottom of $$\tilde{A}_{1}$$ can be reduced to $$\frac{3}{4}$$ by considering the larger one of the rectangles, R 1 and the one induced by Q, Q′, and P, as well as the triangle below the larger rectangle formed by $$D_{l}^{h}$$ and $$D_{r}^{h}$$. However, this does not lead to a better competitive ratio, because these costs are already dominated by the cost for holes of Type T.

## References

1. Azar, Y., Epstein, L.: On two dimensional packing. J. Algorithms 25(2), 290–310 (1997)

2. Baker, B.S., Schwarz, J.S.: Shelf algorithms for two-dimensional packing problems. SIAM J. Comput. 12(3), 508–525 (1983)

3. Baker, B.S., Coffman, E.G. Jr., Rivest, R.L.: Orthogonal packings in two dimensions. SIAM J. Comput. 9(4), 846–855 (1980)

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)

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)

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)

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)

8. Brucker, P.: Scheduling Algorithms, 2nd edn. Springer, Berlin (2004)

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)

10. Coffman, E.G. Jr., Downey, P.J., Winkler, P.: Packing rectangles in a strip. Acta Inform. 38(10), 673–693 (2002)

11. Csirik, J., Woeginger, G.J.: Shelf algorithms for on-line strip packing. Inf. Process. Lett. 63(4), 171–175 (1997)

12. Epstein, L., van Stee, R.: Online square and cube packing. Acta Inform. 41, 595–606 (2005)

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)

14. Fekete, S.P., Schepers, J., van der Veen, J.: An exact algorithm for higher-dimensional orthogonal packing. Oper. Res. 55, 569–587 (2007)

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)

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)

17. Galambos, G., Woeginger, G.J.: Online bin packing—a restricted survey. Math. Methods Oper. Res. 42(1), 25–45 (1995)

18. Graham, R.L.: Bounds on multiprocessing timing anomalies. SIAM J. Appl. Math. 17(2), 416–429 (1969)

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)

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)

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)

22. Seiden, S.S.: On the online bin packing problem. J. ACM 49(5), 640–671 (2002)

23. Sleator, D.D.: A 2.5 times optimal algorithm for packing in two dimensions. Inf. Process. Lett. 10(1), 37–40 (1980)

24. Steinberg, A.: A strip-packing algorithm with absolute performance bound 2. SIAM J. Comput. 26(2), 401–409 (1997)

25. van Vliet, A.: An improved lower bound for online bin packing algorithms. Inf. Process. Lett. 43(5), 277–284 (1992)

26. Ye, D., Han, X., Zhang, G.: A note on online strip packing. J. Comb. Optim. 17(4), 417–423 (2009)

## Author information

Authors

### Corresponding author

Correspondence to Sándor P. Fekete.

Tom Kamhans was supported by DFG grant FE 407/8-3, project “ReCoNodes”. A preliminary extended abstract summarizing the results of this paper appeared in [15].

## Rights and permissions

Reprints and Permissions

Fekete, S.P., Kamphans, T. & Schweer, N. Online Square Packing with Gravity. Algorithmica 68, 1019–1044 (2014). https://doi.org/10.1007/s00453-012-9713-8