Skip to main content
Log in

A fully general, exact algorithm for nesting irregular shapes

  • Published:
Journal of Global Optimization Aims and scope Submit manuscript

Abstract

This paper introduces a fully general, exact algorithm for nesting irregular shapes. Both the shapes and material resource can be arbitrary nonconvex polygons. Moreover, the shapes can have holes and the material can have defective areas. Finally, the shapes can be arranged using both translations and arbitrary rotations (as opposed to a finite set of rotation angles, such as 0\(^\circ \)and 180\(^\circ \)). The insight that has made all this possible is a novel way to relax the constraint that the shapes not overlap. The key idea is to inscribe a few circles in each irregular shape and then relax the non-overlap constraints for the shapes by replacing them with non-overlap constraints for the inscribed circles. These relaxed problems have the form of quadratic programming problems (QPs) and can be solved to optimality to provide valid lower bounds. Valid upper bounds can be found via local search with strict non-overlap constraints. If the shapes overlap in the solution to the relaxed problem, new circles are inscribed in the shapes to prevent this overlapping configuration from recurring, and the QP is then resolved to obtain improved lower bounds. Convergence to any fixed tolerance is guaranteed in a finite number of iterations. A specialized branch-and-bound algorithm, together with some heuristics, are introduced to find the initial inscribed circles that approximate the shapes. The new approach, called “QP-Nest,” is applied to three problems as proof of concept. The most complicated of these is a problem due to Milenkovic that has four nonconvex polygons with 94, 72, 84, and 74 vertices, respectively. QP-Nest is able prove global optimality when nesting the first two or the first three of these shapes. When all four shapes are considered, QP-Nest finds the best known solution, but cannot prove optimality.

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

Access this article

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

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14
Fig. 15
Fig. 16
Fig. 17
Fig. 18
Fig. 19
Fig. 20
Fig. 21
Fig. 22
Fig. 23
Fig. 24
Fig. 25
Fig. 26
Fig. 27
Fig. 28

Similar content being viewed by others

Notes

  1. O’Rourke [24] shows that the computation can also be done in \(O(n\log n + k)\) time, where \(k\) is the number of intersection points of edges, using a variation on the Bentley-Ottmann sweepline algorithm.

  2. A triangle can be considered the intersection the three half-planes defined by its sides. Hence, the intersection of two triangles can be considered the intersection of the associated six half-planes. A region defined by the intersection half-planes is called a convex polyhedron, and Lasserre [18] has derived a general, recursive formula for the volume of such polyhedra. This formula is easy to implement in a computer, but it makes intensive use of the absolute value, minimum, and maximum operators. As a result, even for two triangles, the resulting closed-form expression is quite ugly, nondifferentiable, and not very amenable for use in an optimization algorithm.

  3. A simple polygon is one whose sides do not intersect each other. A simple polygon can, however, have holes.

  4. If \(p\) is a point in the polygon and \(v\) is a translation, then the translation is not valid if \(v+p\in \overline{C}\) or, equivalently, \(v\in \overline{C}-p\). Hence, the translation is valid if \(v\) lies in the complement of the right hand set, \(v\in \overline{\overline{C}-p}\).

  5. Let \(x_i\) and \(x_j\) be points in polygons \(i\) and \(j\), respectively, and let \(t_i\) and \(t_j\) be the locations of the two polygons. Points \(x_i\) and \(x_j\) will coincide, and hence the polygons will overlap, if \(x_i + t_i = x_j + t_j\) or, rearranging, if \(t_j - t_i = x_i-x_j\). To prevent overlap, this must never happen for any \(x_i\) and \(x_j\), which means we can not have \(t_j - t_i \in P_{i}\oplus -P_{j}\). Hence, we must have \(t_j - t_i \in \overline{P_{i}\oplus -P_{j}}\). Besides the use of the Minkowski sum for computing the no-fit polygon, a newer and apparently more efficient approach is given in [5].

  6. The geometric restriction is based on considering triples of parts \((i,j,h)\). Any valid, non-overlapping translation of polygon \(j\) relative to polygon \(i\) should also be computable as a valid translation from \(i\) to \(h\) plus a valid translation from \(h\) to \(j\). This leads to the following tightening rule: \(U_{ij}\leftarrow U_{ij}\cap \left( U_{ih}\oplus U_{hj}\right) \). This range reduction formula is repeatedly applied, considering different triples of parts, until no further reduction is obtained.

  7. For nonconvex polygons, the medial axis can have curved segments as well as straight lines, which would further complicate its use in selecting the centers of the initial inscribed circles.

References

  1. Albano, A., Sapuppo, G.: Optimal allocation of two-dimensional irregular shapes using heuristic search methods. IEEE Trans. Syst. Cybern. SMC–10(5), 242–248 (1980)

    Article  Google Scholar 

  2. Avnaim, F., Boissonnat, J.: Polygon placement under translation and rotation. Informatique theorique et applications 23(1), 5–28 (1989)

    Google Scholar 

  3. Bennel, J.A., Oliveira, J.F.: A tutorial in irregular shape packing problems. J. Oper. Res. Soc. 60(1), 93–105 (2009)

    Article  Google Scholar 

  4. Burke, E., Hellier, R., Kendall, G., Whitwell, G.: A new bottom-left-fill heuristic algorithm for the two-dimensional irregular packing problem. Oper. Res. 54(3), 587–601 (2006)

    Article  Google Scholar 

  5. Burke, E., Hellier, R., Kendall, G., Whitwell, G.: Complete and robust no-fit polygon generation for the irregular stock cutting problem. Eur. J. Oper. Res. 279, 27–49 (2007)

    Article  Google Scholar 

  6. Chin, F., Snoeyink, J., Wang, C.A.: Finding the medial axis of a simple polygon in linear time. Discret. Comput. Geomet. 99(3), 382–391 (1995)

    Google Scholar 

  7. Costa, M.T., Gomes, A.M., Oliveira, J.F.: Heuristic approaches to large-scale periodic packing of irregular shapes on a rectangular sheet. Eur. J. Oper. Res. 192, 29–40 (2009)

    Article  Google Scholar 

  8. Daniels, K., Milenkovic, V.: Multiple translational containment: approximate and exact algorithms. In: Clarkson, K. (ed.) Proceedings of the 6th Annual ACM-SIAM Symposium on Discrete Algorithms (1995)

  9. Daniels, K., Milenkovic, V.: Column-based strip packing using ordered and compliant containment. In: Lin, M.C., Manocha, D. (eds.) Proceedings of the First ACM Workshop on Applied Computational Geometry (WACG), pp. 33–38 (1996)

  10. de Berg, M., Cheong, O., van Kreveld, M., Overmars, M.: Computational Geometry: Algorithms and Applications. Springer, Berlin (2008)

    Book  Google Scholar 

  11. Dowsland, K., Dowsland, W.: Solution approaches to irregular nesting problems. Eur. J. Oper. Res. 84, 506–521 (1995)

    Article  Google Scholar 

  12. Farley, A.A.: Mathematical models for cutting-stock problems in the clothing industry. J. Oper. Res. Soc. 39(1), 41–53 (1988)

    Article  Google Scholar 

  13. Floudas, C.A., Visweswaran, V.: Handbook of Global Optimization, chap. Quadratic Optimization, pp. 217–270. Kluwer, Berlin (1995)

  14. Heistermann, J., Lengauer, T.: Efficient automatic part nesting on irregular and inhomogeneous surfaces. In: Ramachandran, V. (ed.) Proceedings of the Fourth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 251–259 (1993)

  15. Kallrath, J.: Cutting circles and polygons from area-minimizing rectangles. J. Glob. Optim. 43, 299–328 (2009)

    Article  Google Scholar 

  16. Kallrath, J., Rebennack, S.: Cutting ellipses from area-minimizing rectangles. J. Glob. Optim. (2013). doi:10.1007/s10898-013-0125-3

  17. Lamousin, H., Waggenspack Jr, W.N.: Nesting of two-dimensional irregular parts using a shape reasoning heuristic. Comput. Aided Des. 29(3), 221–238 (1997)

    Article  Google Scholar 

  18. Lasserrre, J.B.: An analytical expression and an algorithm for the volume of a convex polyhedron in \({R}^{n}\). J. Optim. Theory Appl. 39, 363–377 (1983)

    Article  Google Scholar 

  19. Li, Z.: Compaction algorithms for non-convex polygons and their applications. Ph.D. thesis, Harvard University, Department of Computer Science (1994)

  20. Li, Z., Milenkovic, V.: Compaction and separation algorithms for non-convex polygons and their applications. Eur. J. Oper. Res. 84, 539–561 (1995)

    Article  Google Scholar 

  21. Milenkovic, V.: Rotational polygon containment and minimum enclosure using only robust 2d constructions. Comput. Geom. 13, 3–19 (1999)

    Article  Google Scholar 

  22. Milenkovic, V.: Densest translational lattice packing of non-convex polygons. Comput. Geom. 22, 205–222 (2002)

    Article  Google Scholar 

  23. Misener, R., Floudas, C.A.: GloMIQO: global mixed-integer quadratic optimizer. J. Glob. Optim. 57, 3–50 (2013)

    Article  Google Scholar 

  24. O’Rourke, J.: Computational Geometry in C, 2nd edn. Cambridge University Press, Cambridge (2001)

    Google Scholar 

  25. Preparata, F.P., Shamos, M.I.: Computational Geometry. Springer, Berlin (1985)

    Book  Google Scholar 

  26. Sahinidis, N.V.: BARON: a general purpose global optimization software package. J. Glob. Optim. 8(2), 201–205 (1996)

    Article  Google Scholar 

  27. Verkhoturov, M.A., Sergeyeva, O.Y.: The sequential value correction method for the two-dimensional irregular cutting stock problem. Pesquisa Operacional 20(2), 233–246 (2000)

    Google Scholar 

Download references

Acknowledgments

Lee Bristol of Delphi Interior and Lighting Systems introduced me to the fabric nesting problem, and Bill Crawford of Delphi Interior and Lighting Systems provided Fig. 1 and shared his knowledge on the nature the fabric nesting problem and the relative merits of different nesting approaches. Karen Daniels graciously guided me through the work she has done with Milenkovic and Li. Victor Milenkovic provided me with the data for his four-part test problem. Mary Dalzell of the GM Research library carried out a computerized literature search on the subject of nesting. Paul Sweeney and Bob Haessler of the University of Michigan also helped identify the relevant literature. Special thanks go to Chris Floudas of Princeton University for giving me an account on the Princeton computer system for carrying out the numerical experiments. Thanks also to Ruth Misener (co-creator of GloMIQO), who provided me with an updated literature search and helped me understand how different problem formulations would affect the performance of GloMIQO. Santosh Tiwari of GM installed LaTeX and BibTeX on my computer and showed me how to use them. Finally, I would like to thank the two anonymous reviewers for their comments and suggestions that pushed me to add clarifications, extend the literature review, and do additional numerical work, all of which substantially improved the paper.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Donald R. Jones.

Appendix

Appendix

1.1 Algorithm for inscribing circles and computing maximum penetrations

Figure 29 illustrates the steps in the branch-and-bound procedure for inscribing a circle in a polygon in such a way that: (i) the circle lies entirely inside the polygon and (ii) the circle does not intersect any previously inscribed circles. The figure shows six steps, labeled (a)–(f), that we now explain.

Fig. 29
figure 29

The steps in the basic circle filling procedure

  1. (a)

    The starting point for the algorithm is a polygon with one or more previously inscribed circles (here just one circle).

  2. (b)

    We cover the original polygon with triangles. The triangular cover is initialized by finding the bounding box of the polygon and dividing it into two triangles. We have grayed out the original polygon and circle to focus attention on the triangles.

  3. (c)

    In each iteration, one triangle is selected and subdivided by connecting the midpoint of the longest side to the opposite vertex. Here we show how this is done for the lower right triangle.

  4. (d)

    As the iterations proceed, it is possible that some triangle will have an empty intersection with the polygon; an example is the shaded triangle. Any such triangle is deleted, as it cannot contain the center of any inscribed circle.

  5. (e)

    For each triangle in the partition, we compute a lower and upper bound on the radius of a circle that has a center in the triangle, lies within the polygon, and does not intersect any previously inscribed circles. Here we illustrate the computation of the lower bound for the thick-lined triangle. We begin by finding the centroid of the triangle, here shown as the black dot. If the centroid lies inside the original polygon (which may not always be the case), we compute the minimum distance from the centroid to each side and to each existing inscribed circle; these distances are shown with dotted lines. The minimum of all these distances is the radius of the largest circle that can be inscribed having the centroid as its center. This is therefore a lower bound on the radius of an inscribed circle with a center in the triangle. We keep track of the largest circle so found, as this is our best feasible solution. If the centroid does not lie in the polygon, we skip the computation of the lower bound.

  6. (f)

    Here we illustrate the computation of the upper bound for the thick-lined triangle. For each side of the polygon, we determine which vertex of the triangle is furthest from the side (i.e, maximizes the minimum distance between the side and the vertex). In the figure, the dotted lines connect each side to the furthest vertex of the triangle. The furthest distance will be the distance between the triangle vertex and either (i) the closest endpoint of the side or (ii) the projection of the triangle vertex on the side of the polygon. Similarly, for each circle, we compute the distance from the perimeter of the circle to the furthest vertex. Clearly, these are the largest possible distances from a point in the triangle to a polygon side or circle perimeter. The minimum of all these distances is thus a valid upper bound on the radius of an inscribed circle with a center in the triangle that does not intersect any previously inscribed circles.

The entire procedure starts with the initial two triangles in (b), computing the lower and upper bound as discussed. From this point we proceed iteratively, selecting the triangle with the largest upper bound, bisecting it, and computing the bounds for the two child rectangles. Of course, if a child triangle lies outside the polygon, as in (d), we skip the bound calculation and simply delete it. The stopping criterion is the gap between radius of the largest circle successfully drawn from a triangle centroid (our best solution) and the overall upper bound (the largest upper bound of any undeleted triangle). When this gap is sufficiently small, we stop. I normally use a very small tolerance; for example, in the Milenkovic problems the tolerance was \(10^{-4}\). In general, the tolerance used should be several (say three) orders of magnitude smaller than the accuracy \(\epsilon \) that one desires for the nest length.

We can compute the maximum penetration of polygon \(A\) into polygon \(B\) using the following modification of the branch-and-bound algorithm:

  • The initial bounding box is the bounding box of both polygons \(A\) and \(B\).

  • We delete a triangle if it either has no intersection with polygon \(A\) or has no intersection with polygon \(B\).

  • We only compute a lower bound for a triangle if the centroid lies in both polygons \(A\) and \(B\). If this happens, we find the shortest distance from each side of polygon \(B\) to the centroid. The minimum of these “shortest distances to the centroid” is the radius of a circle that can be grown from the centroid and still lie within polygon \(B\). It is a valid lower bound on the maximum penetration.

  • To compute an upper bound for a triangle, for each side of polygon \(B\), we find the furthest vertex of the triangle. The minimium of these “furthest distances” is the upper bound for the triangle.

Finally, we can compute the largest circle that can be inscribed in the overlap of two polygons with the following modifications of the branch-and-bound algorithm:

  • The initial bounding box is the bounding box of both polygons \(A\) and \(B\).

  • We delete a triangle if it either has no intersection with polygon \(A\) or has no intersection with polygon \(B\).

  • We only compute a lower bound for a triangle if the centroid lies in both polygons \(A\) and \(B\). If this happens, we find shortest distance from each side of polygons \(A\) and \(B\) to the centroid. The minimum of these “shortest distances to the centroid” is the radius of a circle that can be grown from the centroid and still lie within both polygons \(A\) and \(B\). It is a valid lower bound on the radius of a circle inscribed in the overlap of \(A\) and \(B\).

  • To compute an upper bound for a triangle, for each side of polygons \(A\) and \(B\), we find the furthest vertex of the triangle. The minimium of these “furthest distances” is the upper bound for the triangle.

1.2 Proof of theorem 2

To set up the proof, for each polygon, assume we have computed the distance between any two vertices and between any vertex and a non-adjacent side. Let \(s_{\min }\) denote the very smallest of these distances. Because there are only a finite number of vertices and sides, and because the sides do not intersect, the minimum distance \(s_{\min }\) must exist and be strictly greater than zero. Also compute the smallest (most acute) angle \(\theta _{\min }\) of any vertex. Figure 30 illustrates the computation of \(s_{\min }\) and \(\theta _{\min }\).

Fig. 30
figure 30

The value of \(s_{\min }\) in the proof of Theorem 2 is the smallest of a the minimum distance between any two vertices and b the minimum distance between any vertex and a non-adjacent side

Now suppose Theorem 2 were false. Then there would exist some number \(\delta >0\) with the property that, in every iteration, one shape would penetrate another by at least \(\delta \). This means that in every iteration there would exist a point \(x\) in some shape \(A\) that penetrates some other shape \(B\) by \(\delta \). By definition, then, the circle with center \(x\in A\) and radius \(\delta \) would lie entirely in \(B\) (see Fig. 31a).

Fig. 31
figure 31

If Theorem 2 were false, there would always exist some point \(x\) in some shape \(A\) that penetrates some other shape \(B\) by \(\delta \)

Now let \(\lambda =\min (\delta ,s_{\min }/2)\) and let \(C\) denote the circle with center \(x\) and radius \(\lambda \). This circle obviously lies entirely inside \(B\) (see Fig. 31b). Moreover, because the diameter of \(C\) is less than or equal to \(s_{\min }\), at most one vertex of \(A\) can lie in \(C\) (if there were two vertices inside \(C\), then these vertices would be closer together than \(s_{\min }\), which is impossible).

We may now distinguish three cases, as illustrated in Fig. 32. In case 1 there are no vertices of shape \(A\) in \(C\). In case 2 there is exactly one vertex and this vertex is not \(x\). Finally, in case 3 there is exactly one vertex and this vertex is \(x\). In all three cases, we can find a circle that lies in the intersection of shapes \(A\) and \(B\), as shown in Fig. 32.

Fig. 32
figure 32

Three cases considered in the proof of Theorem 2

Clearly, the smallest overlap of shape \(A\) with circle \(C\) (and hence with \(B\)) occurs in case 3 when the angle at the vertex is the smallest (most acute) angle \(\theta _{\min }\). Thus, the smallest possible overlap is a wedge with angle \(\theta _{\min }\) from a circle of radius \(\lambda \). Beside the two sides forming the wedge, no other side from polygon \(A\) can be inside circle \(C\), because we have assumed that the radius of circle \(C\) is smaller than the smallest distance from a vertex to any non-adjacent side; this is why the entire wedge must be inside shape \(A\) and, hence, the entire wedge is in the overlap of polygons \(A\) and \(B\). A little trigonometry (see Fig. 33) shows that one can inscribe a circle in this wedge with radius:

$$\begin{aligned} r=\frac{\lambda \sin (\theta _{\min }/2)}{1+\sin (\theta _{\min }/2)}>0. \end{aligned}$$
(20)

Moreover, this is true no matter what iteration we are on, because we have assumed that in each iteration some polygon penetrates another by at least \(\delta \). But if we can always inscribe a circle of radius \(r\) inside the overlap region, then the radius of the largest possible inscribed circle would not go to zero, which contradicts Theorem 1! \(\square \)

Fig. 33
figure 33

Computing the radius of the largest circle that can be inscribed in a wedge

As an aside, note that “asymptotically,” as the iterations proceed and the maximum penetration \(\delta \) becomes so small that it is less than \(s_{\min }/2\), then we will have \(\lambda = \min (\delta , s_{\min }/2)=\delta \). Equation (20) then implies that the ratio \(\delta /r_{max}\)—the ratio of the maximum penetration to the radius of the largest inscribed circle—is indeed bounded, as stated in Eq. (15) in the text. In particular, we have:

$$\begin{aligned} \frac{\delta }{r_{max}} \le \frac{\delta }{r} = \frac{\lambda }{r} = \frac{1+\sin (\theta _{\min }/2)}{\sin (\theta _{\min }/2)} \end{aligned}$$
(21)

Rights and permissions

Reprints and permissions

About this article

Cite this article

Jones, D.R. A fully general, exact algorithm for nesting irregular shapes. J Glob Optim 59, 367–404 (2014). https://doi.org/10.1007/s10898-013-0129-z

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10898-013-0129-z

Keywords

Navigation