Abstract

We study the cutting and packing (C&P) problems in two dimensions by using phi-functions. Our phi-functions describe the layout of given objects; they allow us to construct a mathematical model in which C&P problems become constrained optimization problems. Here we define (for the first time) a complete class of basic phi-functions which allow us to derive phi-functions for all 2D objects that are formed by linear segments and circular arcs. Our phi-functions support translations and rotations of objects. In order to deal with restrictions on minimal or maximal distances between objects, we also propose adjusted phi-functions. Our phi-functions are expressed by simple linear and quadratic formulas without radicals. The use of radical-free phi-functions allows us to increase efficiency of optimization algorithms. We include several model examples.

1. Introduction

We study the cutting and packing (C&P) problems. Its basic goal is to place given objects into a container in an optimal manner. For example, in garment industry one cuts figures of specified shapes from a strip of textile, and one naturally wants to minimize waste. Similar tasks arise in metal cutting, furniture making, glass industry, shoe manufacturing, and so forth. In shipping works one commonly needs to place given objects into a container of a smallest size or volume to reduce the space used or increase the number of objects transported.

The C&P problem can be formally stated as follows: place a set of given objects into a container so that a certain objective function (measuring the “quality” of placement) will reach its extreme value.

In some applications (as in garment industry) objects must be specifically oriented respecting the structure of the textile, that is, they can only be translated without turnings (or only slightly rotated within given limits). In other applications objects can be freely rotated. Some applications involve additional restrictions on the minimal or maximal distances between certain objects or from objects to the walls of the container (one example is packing of radioactive waste).

While most researchers use heuristics for solving C&P problems, some develop systematic approaches based on mathematical modeling and general optimization procedures; see, for example, [13]. We refer the reader to recent tutorials [4, 5] presenting the history of the C&P problem and basic techniques for its solution.

Standard existing algorithms are restricted to 2D objects of polygonal shapes; other shapes are simply approximated by polygons (a notable exception is [6] which also treats circular objects). The most popular and most frequently cited tools in the modern literature on the C&P problem are Minkowski sum [7] and the so-called No-Fit Polygon [4], which works with polygons only and does not support rotations. Rotations of polygons were considered in [8, 9], and in a very recent paper [10] the concept of No-Fit Polygon was extended to objects bounded by circular arcs.

In this paper we develop tools that handle any 2D objects whose boundary is formed by linear segments and/or circular arcs (the latter may be convex or concave). All objects we had to deal with in real applications, without exception, belong to this category. Our tools support free translations and rotations of objects and can respect any restrictions on the distances between objects.

We describe the layout of objects relative to each other by the so-called phi-functions. For any placement of two objects and on the plane , the corresponding phi-function shows how far these objects are from each other, whether they touch each other, or whether they overlap (in the latter case it shows how large the overlap is). Phi-functions were introduced in [1113] and fully described in our recent survey [14]. Phi-functions are also used for solving 3D packing problems [15] and covering problems [16].

The arguments of the phi-function are the translation and rotation parameters of the objects and ; those parameters specify the exact position and orientation of the objects in the plane (or in the space). All these parameters together, for all the given objects, constitute the solution space. Solving the cutting and packing problem then consists of minimization of a certain objective function defined on the solution space.

Thus the solution of the C&P problem reduces to minimization of an objective function on a certain (multidimensional) space, which can be done by mathematical programming. A detailed description of the solution strategy is given in [14]. We emphasize that the minimization is performed with respect to all of the underlying variables, that is, all the objects can move and rotate simultaneously. In this respect our approach differs from many others that optimize the position of one object at a time. Illustrations and animated demonstrations of the performance of our methods can be found on our web page [17].

The solution space consists of all admissible (nonoverlapping) positions of our objects, which correspond to inequalities for all . Our phi-functions are defined by a combination of minima and maxima of various basic functions that represent mutual position of various elements of the underlying objects (their edges, their corner points, etc.) As a result, the solution space is described by a complicated tree in which each terminal node consists of a system of inequalities involving translation and rotation parameters of certain objects. This description is very complex, and one of our goals is to simplify it.

The above-mentioned inequalities may be expressed via distances between various points, segments, and arcs on the boundaries of our objects. The resulting formulas often involve square roots, which may cause unpleasant complications—formulas describing the solution space develop singularities, and the minimization process becomes prohibitively slow.

To remedy the situation, we redefine the phi-functions so that the solution space will be described by simpler formulas without radicals (thus avoiding related singularities), This speeds up the optimization process. By our rules, phi-functions only need to satisfy certain flexible requirements, they are not rigidly determined by the shapes of the given objects. In fact, one can often define phi-functions for fairly complicated objects by simple formulas that avoid square roots and other irrational functions.

This strategy was employed in our previous works [14], but here we implement it to an utmost extent. We will show that for any objects bounded by linear segments and circular arcs phi-functions can be defined by algebraic formulas without radicals. This is the principal goal of our paper. It was announced in [14] without much details. Here we give explicit practical formulas for computing the phi-functions in all possible cases. Our radical-free phi-functions also incorporate additional constraints on the distances between objects (see Section 4).

We demonstrate the efficiency of our new phi-functions by model examples. For the description of the solution space via phi-functions we refer the reader to [14]. For further details of local optimization algorithms used in our programs we refer the reader to [18].

2. Phi-Functions and Decomposition of Objects

Recall that a 2D object is a subset ; it is usually specified by some equations or inequalities in the canonical coordinates . Placing the object in means moving it without changing its shape or size. Rigid motions in consist of rotations and translations. If we rotate by angle (say, clockwise) and translate it by vector , then the resulting set (placed object) can be described by equation where denotes the standard rotation matrix. We call and the placement parameters for the object .

Now let be two objects. We denote the corresponding placed objects by and . The phi-function describes the mutual position (interaction) of the pair of sets and . It must satisfy three basic requirements: Here int denotes the interior of and the boundary (frontier) of . We always assume that our objects are canonically closed sets, that is, each object is the closure of its interior. Also, the boundary should not have self-intersections [11, 14].

Note that is a function of six real variables . An important requirement is that is continuous in all these six variables [14]. We will also assume that is “symmetric” in the sense that and translation invariant, that is, for any vector Our phi-functions are also rotation invariant in a natural sense. In our formulas, the superscripts of will always refer to given objects, while the arguments of (the placement parameters) will be often omitted for brevity.

The general meaning of (2.4) is that when the placed objects are disjoint, that is, a positive distance apart, then . When those objects just touch each other (on their boundaries), but do not overlap, then . When they overlap, then .

We emphasize that the exact value of the phi-function is not subject to any rigid constraints. If two placed objects and are disjoint, then should just roughly approximate the distance between them. If they overlap, then the absolute value should just roughly measure the extent of overlap. This flexibility allows us to construct relatively simple phi-functions for rather complex objects, which is the main goal of our paper.

For example, let and be two circles (disks) of radii and , respectively, defined by Now by translating and through some vectors and , we get two placed circles and with centers and , respectively, and the same radii and (rotations are redundant for circles). Now the distance between and is , where Note that if the circles are disjoint and if they overlap, thus we could set . But we define differently: Note that the sign of coincides with that of (and whenever ). But the formula (2.9) allows us to avoid radicals, thus improving the performance of our optimization algorithms.

Next suppose are two objects, each of which is a union of some smaller (and simpler) components and , respectively. Those do not have to be disjoint, that is, some ’s may overlap, and so may some of the ’s. When the object is rotated and translated, all its parts are rotated by the same angle and translated through the same vector, so the placement parameters for and for all its parts are the same. This applies to and its parts, too.

Now we can define This simple fact can be verified by direct inspection, see also [11, 14].

In this paper we consider objects whose boundary is formed by linear segments and/or circular arcs (the latter may be convex or concave); see an example in Figure 1. Such objects can be partitioned into simpler components of four basic types: (a) convex polygons, (b) circular segments, (c) “hats”, and (d) “horns”; see Figure 2.

A convex polygon is an intersection of half-planes. More generally, an intersection of half-planes will be called a generalized convex polygon, or phi-polygon. It may be a regular (bounded) polygon, or an unbounded region, such as a region between two rays (half-lines) emanating from a common vertex (see illustrations in [11]).

A circular segment is a region bounded by a circular arc (smaller than a semicircle) and the respective chord. One can also describe a circular segment as the convex hull of a circular arc. A hat is formed by a circular arc (smaller than a semicircle) and two tangent lines at its endpoints (Figure 2(c)). A horn is made by two circular arcs (one convex and one concave) that are tangent to each other at the point of contact and a line crossing both arcs and tangent to the concave one (Figure 2(d)). We will denote these four types by , , , and , as in Figure 2.

Figure 1 shows a division of an object into basic subobjects. It consists of 8 convex polygons, 3 circular segments, 3 hats, and one horn.

Decomposition of a given object into basic subobjects can be done by a computer algorithm based on the following steps.(1)Locate “beaks,” that is, points on the boundary of where two arcs (one concave and one convex) terminate with a common tangent line. At each beak, cut off a small piece that is shaped as a horn (by a line tangent to the concave arc). After the detachment of horns, the resulting object will have no beaks.(2)Locate all concave arcs and carve out hats so that each concave arc will be replaced with a polygonal line. After the detachment of hats, the resulting object will have no concave arcs.(3)Locate all convex arcs and cut off circular segments so that each convex arc will be replaced with one or more chords. After the detachment of segments, the resulting object will have no convex arcs.(4)If the resulting phi-polygon is convex, keep it. If not, decompose it into two or more convex ones.

We note that if the given object is simple enough, it may not be necessary to divide it into basic objects. For example, if is a circle (or a ring), there is no need to cut it artificially into some polygons and circular segments, as phi-functions for circles (and rings) are quite simple; see (2.9) and other formulas below, as well as [1113].

Next, recall that our basic goal is to place given objects into a container with respect to a given objective. To ensure that the placed objects do not overlap, we can just verify that for all . To ensure that , we verify that , where is the closure of the complement to the container . This is a part of our optimization algorithm; see [14].

The necessity of treating as a (rather special) object leads us to considering unbounded objects, too. Given a bounded object , we denote by the unbounded complementary object. If is delimited by line segments and circular arcs, then it can be decomposed into basic objects of the same four types, except one or more basic objects are unbounded phi-polygons as described above.

3. Basic Phi-Functions

Due to the decomposition principle (2.11) our problem reduces the construction of phi-functions for all pairs of basic objects. As there are four types of basic objects, there are a total of possible pairs of types of basic objects to treat. These will form a complete class of basic phi-functions.

3.1. Two Convex Polygons

A convex polygon is an intersection of several half-planes. A half-plane can be defined by so it is completely specified by three parameters . Without loss of generality we assume in what follows that . A convex polygon (phi-polygon) that is the intersection of half-planes can be specified by Alternatively, can be specified by a sequence of vertices listed in the counterclockwise direction. If the polygon is moved (rotated and translated), its parameters and can be recomputed in terms of the rotation angle and translation vector , according to (2.1). Thus the placement parameters of can be incorporated into , and .

Now let be a convex -gon and another convex -gon whose parameters we denote by and whose vertices are denoted by for . Denote Now we define the “polygon-polygon” phi-function as see [14] for a detailed analysis of this formula. We note that does not involve quadratic functions. It is defined by linear expressions only if rotational angles are not used.

In particular, if is a half-plane defined by and a polygon with vertices , then (3.4) takes a much simpler form

3.1.1. Convex Polygon and Circle

Let be a convex polygon with sides and vertices for . Let be the equation of the line containing the side . We assume that and the vertices and sides are numbered counterclockwise and the th side joins the th and st vertices (if , then we set ). Let be a circle with center and radius . Then we define where (see Figure 3(a)), (see Figure 3(b)), and (see Figure 3(b)). See [14] for more details.

In particular, if is a half-plane and a circle with center and radius , then (3.6) takes a much simpler form

3.2. Convex Polygon and Circular Segment

Let be again a convex polygon. Let be a circular segment , where is a circle and a triangle made by the chord (the base of the segment) and the two tangents drawn at its endpoints. Now we define where was defined by (3.6) and by (3.4).

3.3. Two Circular Segments

Let and be two circular segments. We define where was defined by (2.9), and by (3.6), and by (3.4).

This takes care of all possible pairs of convex basic objects, that is, types (a) and (b). It remains to deal with concave objects, that is, “hats” and “horns.” We first consider a simple object with a concave arc—the complement to a circle. This case is practically important because in many applications one places objects into a circular container.

3.3.1. Convex Objects inside a Circular Container

Let denote the (closure of the) complement to a circle with center and radius . Now let be a circular object with center and radius that we want to place inside the circle . Then we define If , then we set .

Next let be a polygon (not necessarily convex) with vertices that we want to place in our circle . Then we set

If is a “hat,” that is, the intersection of a triangle and the complement to a circle (see Figure 6), we simply put , where is given by (3.11).

Now let be a circular segment, where is a circle with center and radius and a triangle as before, and , , the endpoints of the chord bounding ; see Figure 4(a). We put then Note that subject to , see Figure 4(a). Now we define where is given by (3.12) and

Formula (3.14) results from the following observations: if subject to (see Figure 4(b)), or (Figure 4(c)), or (Figure 4(d)).

To clarify the role of the functions and we introduce vectors , , , , and , as shown in Figure 5(a). Note that and . In these notations, We call and “switch” functions. Note that if and and , see Figure 5(a). However, there exist tree cases, where but . First, and (see Figure 5(b)). Second, and (Figure 5(c)). Lastly, and (Figure 5(d)).

3.4. Polygon and Hat

Let be a hat, that is, the intersection of the complement to a circle and a triangle as shown in Figure 6. Let denote the domain lying above the circle and above the line containing the chord forming the base of the triangle ; see the grey area in Figure 6. Note that .

Now if is any convex object, then it overlaps with if and only if it overlaps with both and ; hence, we can define the phi-function as provided we have properly defined and . This formula applies when is either a convex polygon or a circular segment. In these two cases is given by either (3.4) or (3.8), respectively. Thus it remains to define function . Here we assume that is a convex polygon.

Let and denote two triangles adjacent to ; one side of each is a tangent to the circle , and another side of each is a segment of the line adjacent to the chord; see Figure 6 (the choice of the third side is not important). Let the circle have center and radius . Let the half-plane below the line be defined by inequality . Note that .

Now let be any polygon (not necessarily convex) with vertices , , . Note that does not overlap with if and only if two conditions are met: (i) every vertex lies either in the circle or below the line ; (ii) the polygon does not overlap with and . Accordingly, we define where Therefore, which completes the analysis of the “polygon-hat” pair.

3.5. Circular Segment and Hat

Let be a hat as before and a circular segment. The above analysis applies, up to the formula (3.17), because is a convex object. It remains to define .

We again use the notations , and so forth, for objects associated with the hat , as defined above. We denote by and the endpoints of the arc bounding , as shown in Figure 8, that is, the points of intersection of with . The point is a vertex of the triangle for .

The circular segment is the intersection of a circle and a triangle , as before. Let denote the radius of the circle and its center. Let and denote the endpoints of the chord bounding (as shown in Figure 4) and the line passing through these points. Let the half-plane below the line (away from ) be defined by inequality . Note that .

If , then we set where is defined by (3.5), by (3.14), and for we set Thus, if (see Figure 7(a)) or (see Figure 7(b)) or (see Figure 7(c)), (see Figure 7(d)) or (see Figure 7(e)).

The function in (3.21) is defined as follows: where was defined by (3.10) and by (3.7). We also denote for , and the functions are defined so that is the equation of the line (see Figure 8), and is the half-plane below that line in Figure 8. The line passes through points and . The line segment , , is perpendicular to the line , the line segment is perpendicular to the line , and we have for all . The functions , , come from the application of (3.6) to and .

If , we need to replace , , in (3.21) with defined by

Finally, combining (3.17) and (3.21) gives Indeed, if (see Figure 9(a)) or (see Figure 9(b)).

3.6. Two Hats

Let be a hat and another hat. Equivalently, and . For the hat we use notation , and so forth, as defined above, and for the hat the respective notation , and so forth. Now our phi-function is defined by where , are given by (3.17), (3.18), respectively, and we denote where are the coordinates of the vertices and , , are the equations of lines containing the two straight sides of , respectively; and are the coordinates of the center and the radius of the arc bounding . Similar notation applies to the hat .

The hats and do not overlap if (see Figure 10(a)), or (Figure 10(b)), or (Figure 10(c)), or (Figure 10(d)).

3.7. Horns

A horn is the intersection of a hat and the union of a circular segment and a triangle ; see Figure 11, where the triangle has vertices , and the hat has vertices .

Now for any convex polygon we define Similarly, for any circular segment , and for any hat Now let be another horn. Then we define

Some formulas for the phi-functions may appear quite complex. Note, however, that they all can be programmed off-line and stored in a computer library. In practical applications, one can just call the respective functions, and their evaluation proves to be fast and efficient.

4. Adjusted Phi-Functions

Some applications involve restrictions on the distances between certain pairs of objects, or between objects and the walls of the container. For example, when one is packing radioactive waste, discarded pieces cannot be placed too close together. On the other hand, when one designs a printed circuit board (PCB), then certain electronic components cannot be placed too far apart. Cutting mechanical parts out of a metal sheet is another example where minimal distances have to be maintained, because one has to take into account the physical size of the cutter.

In other words, some upper and/or lower limits on the distances between certain placed objects may be set, that is, given two objects , the corresponding placed objects and must satisfy where Here denotes the minimal allowable distance and the maximal allowable distance between and .

To fulfil (4.1), it has been a common practice to compute the actual distance between and at every step during the optimization process and check if (4.1) holds. But the computation of geometric distances (especially for complex objects) involves complicated formulas with radicals, see a variety of examples detailed in [11]. We avoid the computation of geometric distances by using so called adjusted phi-functions defined below.

Suppose we have to maintain a minimal distance for a pair of objects . We will construct an adjusted phi-function satisfying Then we work with it a just like with the regular phi-function in the previous sections, where no restrictions on distances were imposed. Indeed, all allowable placements of the objects now correspond to and prohibited placements correspond to . Thus our optimization algorithms can proceed the usual routine, but with the new (adjusted) phi-function instead of .

Given an object and we define its -expansion (Figure 12) by where denotes a circle of radius centered on the origin and the symbol stands for the so-called Minkowski sum [19], which is defined by for any two sets . In other words, the -expanded object in (4.4) consists of points that are either in or at distance   from . We will not need to use Minkowski sum for computing our phi-functions.

Now we construct the adjusted phi-function by , and it will satisfy the requirements (4.3). Note that instead of expanding the object we can expand the other object and define . This extra flexibility can be used in practice to minimize the cost of computation.

Suppose we have to maintain a maximal allowable distance for a pair of objects . This means that the objects have to be positioned so that (to avoid overlaps) and , where is the adjusted function constructed above (the latter condition will keep the distance ). Thus we can define another adjusted phi-function as Now we have Thus all allowable positions of and correspond to .

We see that the adjusted phi-functions can always be defined as (ordinary) phi-functions, but for expanded objects. It remains to define phi-functions for expanded objects. For any object we have , where is the expansion of the boundary of ; see Figure 12(b). One can think of as a “fattened” boundary of (whose “thickness” is ). Then by the decomposition principle (2.11) we define

Now recall that consists of linear segments and circular arcs, that is, , where each is either a segment of a line or a circular arc. Therefore, , where denotes the expansion of (as described below). Now by the decomposition principle (2.11) we define The domain is shown in Figure 13 for three different cases: is a line segment (a), is an arc of radius (b), and is an arc of radius (c); see a detailed analysis below.

In all these three cases we have , where and are disks of radius centered on the endpoints of . If is a line segment, then is a rectangle (Figure 14(a)). If is a circular arc of radius , then is a “bent rectangle” (Figure 14(b)). If is a circular arc of radius , then degenerates to a circular segment (Figure 14(c)). Thus we define where denotes the corresponding rectangle, or bent rectangle, or circular segment.

We note that consists of components, so will consist of disks of radius and rectangles or “bent rectangles” (some of the latter may degenerate to circular segments). Rectangles and circular segments are objects of basic types, for which phi-functions were defined in Section 3. Bent rectangles are objects of a new type, so we need to handle them separately.

We have two cases shown in Figure 15. On (a), the “bent rectangle” is the union of two “wedges” , and a hat . Every wedge is in turn the union of a triangle and a circular segment (see Figure 16), hence In the second case (Figure 15(b)) the bent rectangle can be decomposed as . Accordingly, we define

5. Numerical Examples

We illustrate our method by several model examples. In these examples we describe each object by listing elements of its boundary . Each boundary element is completely described by its numerical code (which is 0 for straight line segments, for convex arcs, and −1 for concave arcs), the coordinates of the two endpoints and , and (for circular arcs only) the coordinates of the center .

Our goal is to place a given object or two given objects into a circle of minimal radius or into a rectangle of minimal area. The rectangle is always properly oriented, that is, its sides are parallel to the and axes. Accordingly, our objective function (to be minimized) is in case of a circular container of radius and in case of a rectangular container with sides and .

The arguments of the objective function include the translation vectors for all the objects and rotation angles , where appropriate; compare (2.1). If we place a single object into a circle, no rotation is needed. If two objects are placed into a circle, it is enough to rotate one of them to achieve the optimal placement. When one or two objects are placed into a rectangle, each of them may have to be rotated in order to find the best placement.

Example 5.1. The goal is to place a given object into a circle of minimal radius. The object is a dolphin-like domain shown in Figure 17(a); its boundary is described in Table 1. The optimal placement is also shown in Figure 17(a). The radius of the optimal circle is . This example took 3.61 sec of the computer running time (we processed our examples on a PC with an AMD Athlon 64X2 2.6 GHz CPU).

Example 5.2. The goal is to place the given object (same as in Example 5.1) into a rectangle of minimal area. The optimal placement is shown in Figure 17(b). The rectangle has sides and . We note that our algorithm supports rotation of objects. The optimal rectangle is found when the object is rotated by angle . This example took 104 sec.

Example 5.3. The goal is to place two given objects, and , into a circle of minimal radius. The objects are identical copies of the dolphin-like object in Example 5.1. The optimal placement is shown in Figure 18(a). The radius of the circle is . Again, the objects are subject to rotation, and the optimal circle is found when the object is rotated by angle . This example took 4298 sec.

Example 5.4. The goal is to place two given objects, and , into a circle of minimal radius. The objects have identical shape, they look like thick metal staples and their boundary is described in Table 2. The optimal placement is shown in Figure 18(b). The radius of the optimal circle is . Again, the objects are subject to rotation, and the optimal circle is found when the object is rotated by angle . This example took 31 sec.

Example 5.5. The goal is to place two given objects, and , of different shape into a circle of minimal radius. The object is made by three arcs (two concave and one convex) described in Table 3. The object is the union of two overlapping hats specified in Table 4. The optimal placement is shown in Figure 19(a). The radius of the circle is . Again, the objects are subject to rotation, and the optimal circle is found when the object is rotated by angle . This example took 1147 sec.

Example 5.6. The goal is to place the two given objects, and (same as in Example 5.5), into a rectangle of minimal area. The optimal placement is shown in Figure 19(b). The rectangle has sides and . Again, the objects are subject to rotation, and the optimal rectangle is found when the object is rotated by angle and the object is rotated by angle . This example took 443 sec.

Example 5.7. The goal is to place two very irregular (star-shaped) objects, and , into a circle of minimal radius. The objects have identical shape, each is the union of four overlapping hats specified in Table 5. The optimal placement is shown in Figure 20(a). The radius of the circle is . Again, the objects are subject to rotation, and the optimal circle is found when the object is rotated by angle . This example took 996 sec.

Example 5.8. The goal is to place two very irregular (star-shaped) objects, and , into a rectangle of minimal area. The objects are the same as in Example 5.7. The optimal placement is shown in Figure 20(b). The rectangle has sides and . Again, the objects are subject to rotation, and the optimal rectangle is found when the object is rotated by angle and the object is rotated by angle . This example took 154 sec.

Example 5.9. This is a modification of Example 5.5: we place two objects and into a circle of minimal radius, but now the object must be at least the distance of 0.7 away from the object and from the edge of the circle ; that is, we need dist and dist. In this example we use adjusted phi-functions (Section 4). The optimal placement is shown in Figure 21. Note that the object does not touch the object or the boundary of , to maintain the required distance from both. The radius of the optimal circle is . The objects are subject to rotation, and the optimal circle is found when the object is rotated by angle . This example took 7725 sec.

Acknowledgments

The authors would like to thank M. Zlotnick for programming the decomposition of objects into basic objects. N. Chernov acknowledges the support of National Science Foundation, Grant DMS-0969187. They thank the anonymous referee for many useful remarks.