Packing a set of geometric objects in a non-overlapping way into a minimum-size container is an intriguing problem. Because of its practical significance, many variants of the problem have been investigated, see the surveys [1, 8] and the references therein. Even a simple variant of packing a set of rectangles into a rectangular container turns out to be NP-complete . In many cases, not much is known about the true complexity of the problem.
Constant-factor approximation algorithms of polynomial running time have been found for many variants of packing problems, in particular for finding minimum-size rectangular or convex containers for a set of convex polygons under translations , that is, the objects may be translated but rotations are not allowed. Also, approximation algorithms for rigid motions (translations and rotations) are known in this case, see for instance .
In three dimensions, most previous results are concerned with “regular” packing problems where objects to be packed are axis-parallel boxes, see for instance [4, 7]. In particular, approximation algorithms for packing rectangular cuboids or convex polyhedra into minimum-volume rectangular cuboids or convex containers under rigid motions are known . Whether this is possible under only translations remains open.
In this paper, we give a positive answer for a restricted set of possible objects, namely disks of unit radius and axis-parallel box containers (see Figure 1) by describing a constant-factor approximation algorithm. Our approximation factor is high, but it is of theoretical interest that the problem, whose decision version is neither known to be NP-hard nor to be in NP, can be approximated within a constant factor.
The input to the problem is a set of unit-radius disks. Since we are allowed to freely translate them, we can assume each disk to be centered at the origin, so that the disk is fully defined by its normal vector. Two disks areidentical if their normal vectors are multiples of each other (in particular, and define the same disk). A set of distinct disks is a set where no two disks are identical.
Two disks are in a position where they touch if their intersection contains exactly one point. Two disks intersect if their intersection consists of more than one point. By non-overlapping, we mean a placement of disks such that no two disks intersect, but where disks are allowed to touch.
Our main problem is as follows (see Figure 1):
Definition 1 (DiskPacking).
Given a set of distinct unit-radius disks in by their normal vectors, find
an axis-parallel box of minimum volume such that all disks can be translated into the disk without overlap;
and the actual packing of the disks inside the box.
We will approximately solve DiskPacking by arranging subsets of disks such that their centers lie on a line and they are packed as densely as possible. Let be a given ordering of a set of unit-radius disks, and let be a vector. We define the length of with respect to direction as follows: let be a line with direction vector . Place the disks such that their centers lie on and appear in the ordering when traversing the line in direction , and such that two consecutive disks touch but do not overlap. Then the the length of the ordering with respect to is the distance from the center of the first disk to the center of the last disk. Figure 2 illustrates the definition in two dimensions, where the disks are line segments of length two.
We can now define the DiskStabbing-problem as follows (see Figure 3):
Definition 2 (DiskStabbing).
Given a set of distinct unit-radius disks by their normal vectors, and an additional vector defining the direction of a line, find an ordering of the disks that minimizes the length with respect to .
In Section 2, we study the geometry of the DiskStabbing-problem and define a metric on the family of unit-radius disks. This will allow us to prove that an optimal solution to DiskStabbing implies an approximate solution to DiskPacking. We prove this first for disks with similar normal vectors in Section 3, then for the general case in Section 4.
In Section 5 we then show how to approximately solve DiskStabbing by (approximately) computing a shortest Hamiltonian path in a complete weighted graph, implying a constant-factor approximation for DiskPacking.
In two dimensions, all (infinitely many) unit-length line segments can be packed into a rectangle of area (Figure 4), and even smaller containers are possible. In Section 6 we show that a similar result does not hold in three dimensions: there is no bounded-size container into which all unit-radius disks can be packed.
In Section 7 we briefly consider packing other fixed shapes like squares and mention some open problems.
2 A metric on unit-radius disks
Given a vector , we define the -distance between two unit disks and with centers and as the length of the ordering with respect to . In other words, it’s the distance when the disks touch and the ray has direction . When and are identical, we define .
For any , the distance is a metric on the set of unit-radius disks.
If and are not identical, it is clear that . Otherwise, by definition.
Symmetry holds since a point reflection keeps both disks identical (their normal vectors are negated), but reverses the order in which a line with direction meets them.
It remains to prove the triangle inequality . It clearly holds when any two of the three disks are identical, so we will assume for a contradiction that there are three distinct disks with centers such that . We place in this order on a line with direction such that (so the disks touch but do not overlap) and that (so these disks touch in a point and do not overlap). Since , the disks and do not intersect at all.
We consider the situation in the plane containing the line and the point . Since , the intersection is a segment of length two centered at , for . We choose a coordinate system for where is the -axis and , see Figure 5(top). By assumption, the segment has length two, its midpoint is , and it does not intersect or . In other words, it is contained in the wedge bounded by the rays and (light blue in Figure 5).
We first observe that we can move to the left and to the right while keeping and unchanged, until . This can only grow the wedge, so it will still contain , see Figure 5(bottom).
As a result, we now have and , for . Setting , we have , and so .
We pick a point on the segment and point on the segment such that is parallel to and is parallel to . We have and . It follows that the parallelogram lies strictly in the interior of the disk of radius one around , and so can only intersect this parallelogram in , see Figure 5(bottom).
It follows that the line supporting intersects the ray in a point and the ray in a point . Breaking symmetry, we can assume that lies on the segment . Let , and let , see see Figure 6. We will let decrease from down to , and observe how and change. The distance decreases monotonically as decreases. If , then the distance decreases until . During this decrease, we obviously have , so cannot support . Once , the distance increases monotonically while decreases.
The minimum is therefore maximized when the two distances are equal. Let be the angle where this happens, and let be the orthogonal projection of on the -axis, see Figure 7. Since , the triangles and are congruent, which implies that also and are congruent. This implies that , and so (since ).
It follows that for any , we have , and so the line cannot support the segment , a contradiction. ∎
Consider now a configuration of two disks and that realize the -distance for a given direction vector . We let denote the normal of disk , its center, and the plane supporting . Let be the line (its direction vector is ). The two disks must touch in a point . Let denote the half-plane of delimited by that contains .
We can distinguish three cases:
is tangent to in , lying entirely in , and ;
is tangent to in , lying entirely in , and ;
and intersects both disks in a segment of positive length. These segments have disjoint interior.
We have the following lemma.
Let and be two disks whose normal vectors form an angle . Then .
We first observe that the angle formed by and is either or . Since , we can assume the former. The claim is then obvious in case (i), as has distance from the plane , and case (ii) is symmetric. In case (iii) we consider and set . Since , we have ∎∎
We next discuss how to compute , given the normal vectors and for the disks and the direction vector . We pick the point to be the origin, so that the planes and and the line are all determined. The direction vector tells us which half-planes of and are and . We then check the three cases above:
In case (1), the location of is fully determined. We intersect the line with direction through with to obtain . If , this is the solution.
Otherwise, we symmetrically test case (ii).
If neither case holds, then we are in case (iii). We now know that lies on a circle of radius one around in . Since has direction , we construct the elliptic cylinder whose axis is the line of direction through the origin, and that intersects the plane in the unit-radius circle around the origin. The center lies both on and on the unit-radius circle around in . It suffices to test the at most two intersection points.
Seiferth’s Ph.D. thesis  explains how to perform these computations algebraically, and how to compute exactly using rational arithmetic when are given with rational coordinates.
3 Stabbing helps to pack similar disks
We fix the angle . This is the angle between the diagonal and an edge of the cube. In this section we consider a set of unit-radius disks whose normal vector makes an angle of at most with the positive -axis, that is, with the vector . We will show that the DiskStabbing and DiskPacking problems are related by proving that an optimal solution to DiskStabbing for with respect to direction provides a -approximation to DiskPacking for . In the next section we will then extend this to arbitrary sets of disks.
Let us first define to be the maximum extent of all the disks. Formally, let be the smallest axis-parallel box that contains all the disks if we place them with their center at the origin, and let , , and be the dimensions of . We have and symmetrically .
Let now denote a minimum-volume axis-parallel box into which can be packed—that is, an optimal solution to DiskPacking—and denote its dimensions by . Its volume is .
When we project onto the -plane, we obtain a rectangle of size . We place a grid of points inside this area at interval , starting at the point at distance from the left or upper boundary, and stopping when we have passed the same distance from the right or lower boundary, see Figure 8. We have
and symmetrically .
We observe that since the disks lie entirely in , the projection of a disk center on the rectangle must have distance at least from the rectangle boundary (that is, it must lie in the shaded region of Figure 8), so it has distance at most to the nearest grid point.
For each of the grid points, we consider the segment of length obtained by intersecting with a line parallel to the -axis through the grid point. By our construction, every disk center has distance at most to one of the segments. This means that the segment stabs the disk in a point at distance at most from the disk center. The smaller disk of radius around lies entirely inside the original disk.
It follows that we can place all segments behind each other and obtain a disk stabbing of length for , where the disks have been scaled down to radius . Simply enlarging this stabbing by factor results in a solution to DiskStabbing for of length .
Let be a family of unit-radius disks whose normals make an angle of at most with the -axis. An optimal solution to DiskStabbing for with respect to the -direction has length at most , where opt is the volume of an optimal solution of DiskPacking for . The DiskStabbing-solution thus provides a -approximation for DiskPacking.
Since an optimal solution to DiskPacking implies a stabbing of length at most , an optimal stabbing has at most this length, implying the first claim.
The smallest axis-parallel box enclosing the stabbing is a valid packing of the disks (here we make use of the triangle inequality from Theorem 3: if consecutive disks do not intersect, then no pair of disks can intersect). If is the length of the stabbing, its volume is at most (the -term is needed because we measure the length of a stabbing only from the first to the last center). Since and , this is at most
(making use of the fact that ). ∎
4 Stabbing helps to pack general disks
We now address the general DiskPacking problem. Given a set of disks , we partition it into three subsets , , and , depending on which coordinate axis the normal vector makes the smallest angle with (this corresponds simply to the highest absolute coordinate value in the normal vector). We then consider an optimal stabbing for with respect to the -axis, an optimal stabbing for with respect to the -axis, and an optimal stabbing for with respect to the -axis. Note that the normals for each subfamily make an angle of at most with its corresponding axis.
Optimal stabbings for , , and with respect to the appropriate axis provide a -approximation for DiskPacking for .
Again we define (of dimension ) to be the extent of all the disks (in the entire set ). Let , , and be the length of an optimal stabbing for the sets , , and , respectively. Without loss of generality we assume that is the largest among these.
If , then we are done by Theorem 5, so we assume this is not the case. This implies that for all three extent dimensions we have
We now consider the segment of length that stabs the disks in , and partition it into six equal pieces of length . For each piece, we take the smallest axis-parallel box containing the disks whose centers lie on the piece. Each box has dimensions at most . We stack them in -direction to obtain a single box of dimensions at most that packs all disks of . These are the blue pieces in Figure 9.
Consider the segment of length that stabs the disks in , and partition it into equal pieces of length . For each piece, we take the smallest axis-parallel box containing the disks whose centers lie on the piece. Each box has dimensions at most . We arrange them in three layers of boxes to obtain a single box of dimensions at most that packs all disks of . These are the green pieces in Figure 9.
Similarly, we partition the segment of length that stabs the disks of into equal pieces of length . For each piece, we obtain a box of dimensions at most . We arrange them in three columns of boxes to obtain a single box of dimensions at most that packs all disks of . These are the orange pieces in Figure 9.
We finally arrange the three boxes into a single container of dimensions , see Figure 9(right). For the -direction, we make use of the fact that , so that , and obtain
It remains to bound the volume in terms of opt. We use as well as and . By Theorem 5 we have . We thus have
5 Approximating the optimal disk stabbing and solving everything
It remains to show how to actually solve the DiskStabbing problem.
A -approximation for DiskStabbing can be computed in polynomial time.
Given a set of unit disks by their normal vectors and a direction vector , we construct the complete weighted graph on vertices , where the weight of the edge is . The Hamiltonian paths in this graph correspond one-to-one to the orderings of the disks, and the length of the path in the graph is equal to the length of the ordering with respect to . It follows that the optimal ordering is given by the shortest Hamiltonian path in .
We then have the following corollary.
A -approximation to DiskPacking can be computed in polynomial time.
In the proof of Theorem 6, we now have the weaker bound , and so
6 There is no bounded-size container for all unit-radius disks
While in two dimensions all (infinitely many) unit-length line segments can be packed into a single fixed rectangle (Figure 4), we now show that this is not true in three dimensions.
Packing a set of unit disks requires a container of volume in the worst case.
We construct a set of unit-radius disks as follows: we pick a a -square in the -plane that is centered at the origin, for some constant . We partition the square into grid cells with side length , and project each grid point vertically up onto the unit-radius sphere, see Figure 10. These points define the normal vectors for our set of disks. When is small enough, all normals make an angle of less than with the -axis.
We observe next that the angle made by any two of the normal vectors is at least . Indeed, since any two grid points have distance at least , so do their projections and . The angle is the length of the great circle arc between and on , so it is longer than , see Figure 11.
From Theorem 9, we obtain immediately the following corollary.
There is no container of bounded size into which all unit-radius disks in can be packed.
7 Other objects and open problems
Our approximation algorithm can be extended to any arbitrary fixed planar shape , provided that can be enclosed by some disk (that is, it is bounded) and contains another disk (that is, it has nonempty interior). More precisely, if we are given a finite set of congruent copies of in three dimensions, we can approximate the smallest axis-parallel box into which the set can be packed by translations.
This can be done by just applying our algorithm to the corresponding set of copies of . Since it gives a constant-factor approximation of the optimal packing of the ’s it also gives an approximation of the optimal packing of the ’s. Observe however, that the approximation factor is multiplied by where is the ratio between the radii of and . Since the optimal packing of the ’s provides some packing of the ’s its container must be at least as large from which we obtain an approximation for the ’s.
The approximation factor obtained this way depends on the shape of . For standard shapes such as squares (), equilateral triangles () etc., we can directly compute it from the approximation factor of Section 4.
We have given a constant-factor approximation for a special case of objects, unit-radius disks. It remains an open problem whether an optimal packing of disks of different radii can be efficiently approximated.
Approximating the packing of arbitrarily oriented boxes or convex polyhedra seems to be much more difficult.
We showed further that there is no bounded-size container for all unit-radius disks in three dimensions. Does this generalize to higher dimensions, for instance to three-dimensional balls in four dimensions?
-  Helmut Alt. Computational aspects of packing problems. Bulletin of the EATCS, 118, 2016.
-  Helmut Alt, Mark de Berg, and Christian Knauer. Approximating minimum-area rectangular and convex containers for packing convex polygons. J. Comput. Geom., 8(1):1–10, 2017.
-  Helmut Alt and Nadja Scharf. Approximating smallest containers for packing three-dimensional convex objects. In Proc. 27th Annu. Internat. Sympos. Algorithms Comput. (ISAAC), pages 11:1–11:14, 2016.
-  Florian Diedrich, Rolf Harren, Klaus Jansen, Ralf Thöle, and Henning Thomas. Approximation algorithms for 3D orthogonal knapsack. J. Comput. Sci. Technol., 23(5):749–762, 2008.
-  Robert J. Fowler, Mike Paterson, and Steven L. Tanimoto. Optimal packing and covering in the plane are NP-complete. Inf. Process. Lett., 12(3):133–137, 1981.
J. A. Hoogeveen.
Analysis of Christofides’ heuristic: Some paths are more difficult than cycles.Oper. Res. Lett., 10(5):291–295, 1991.
-  Klaus Jansen and Lars Prädel. A new asymptotic approximation algorithm for 3-dimensional strip packing. In Viliam Geffert, Bart Preneel, Branislav Rovan, Julius Stuller, and A Min Tjoa, editors, SOFSEM 2014: Theory and Practice of Computer Science - 40th International Conference on Current Trends in Theory and Practice of Computer Science, Nový Smokovec, Slovakia, January 26-29, 2014, Proceedings, volume 8327 of Lecture Notes in Computer Science, pages 327–338. Springer, 2014.
-  Guntram Scheithauer. Zuschnitt- und Packungsoptimierung: Problemstellungen, Modellierungstechniken, Lösungsmethoden. Vieweg+Teubner Verlag, 2008.
-  Nadja Seiferth. Algorithmic Aspects of Packing Problems. PhD thesis, Freie Universität Berlin, 2021.
-  L. von Niederhäusern. Packing polygons. Master’s thesis, EPFL Lausanne, FU Berlin, 2014.