Solving Irregular Strip Packing Problems With Free Rotations Using Separation Lines

Solving nesting problems or irregular strip packing problems is to position polygons in a fixed width and unlimited length strip, obeying polygon integrity containment constraints and non-overlapping constraints, in order to minimize the used length of the strip. To ensure non-overlapping, we used separation lines. A straight line is a separation line if given two polygons, all vertices of one of the polygons are on one side of the line or on the line, and all vertices of the other polygon are on the other side of the line or on the line. Since we are considering free rotations of the polygons and separation lines, the mathematical model of the studied problem is nonlinear. Therefore, we use the nonlinear programming solver IPOPT (an algorithm of interior points type), which is part of COIN-OR. Computational tests were run using established benchmark instances and the results were compared with the ones obtained with other methodologies in the literature that use free rotation.


Introduction
Irregular strip packing problems have a great relevance in the production processes, such as garment manufacturing and furniture making. In irregular strip packing, smaller irregular pieces (in our case polygons) must be positioned into a big piece (in our case the strip), minimizing the used length of the strip. The main constraint in irregular strip packing problems is the non-overlapping between pieces, but it is very complex for a computational program to determine if two pieces are overlapping, touching or separated. In the literature there are tools for solving this issue ( [5]), among these the raster methods, direct trigonometry, no-fit polygon, and phi-function. In raster methods the strip is always divided into discrete areas and coding schemes are used. In the coding schemes used by Oliveira and Ferreira, and Segenreich and Braga in [23] and [26], respectively, the empty cells belonging to the division of the strip are encoded by zero and numbers equal to or greater than one are used to encode a piece; so, to check the nonoverlap in raster methods is only a matter of checking the grid cells. There are several tools that use trigonometry to deal with the non-overlapping. In [15] circles inscribed are used to relax the non-overlapping constraints, replacing them with non-overlapping constraints of circles inscribed. In the remaining tools that use trigonometry, the pieces are represented by polygons, thereby, the non-intersection of the edges of polygons must be checked to check the non-overlap. In phi-function, the pieces are represented by the union or intersection of primary objects, that is, circles, rectangles, regular polygons, convex polygons, and the complement of these forms. This tool was designed and implemented in [27,28,6,31]. The phi-function is a mathematical expression that represents the relative position of two pieces. Specifically, the phi-function value is greater than zero if the pieces are separated; equal to zero if their borders are touching; and smaller than zero if overlapping each other. In this article, we use two tools to ensure non-overlapping of pieces, direct trigonometry and no-fit polygon. In the model, we represent the pieces by polygons and use separation lines, that is, we use trigonometry. For the resolution of the modeled problem we need a starting point; for the construction of this point, we use no-fit polygon. A straight line is a separation line if all vertices of a polygon are on one side of the line or on the line, and all vertices of the other polygon are on the other side of the line or on the line. In no-fit polygon the pieces are also represented by polygons. The no-fit polygon is a polygon resulting from the two polygons that are being compared. One of the advantages of this method is that the generation of these no-fit polygons is done only once, in a pre-processing phase, but a big disadvantage is that the no-fit polygons are dependent on the orientation of the polygons, and have to be generated for all possible orientations.
Several solving techniques to these problems that deal with irregular pieces have been developed, based predominantly on heuristics and metaheuristics ( [23,1,18,13,9,21]). The heuristics used for solving these problems can work with partial solutions, constructing the final layout piece by piece (constructive heuristics), or complete solutions, in which changes are done in order to find improvements. Exact algorithms of mixed integer programming that ensure finding the optimal solution were also developed ( [12,2,33]); however, in these algorithms, the runtime increases dramatically with the increase of the quantity of objects used in the problem. In these techniques and algorithms, free rotations are not allowed.
Additionally in the literature, we also find a visual system for packing problem of irregular pieces with free rotation into a rectangular board that aims to minimize the waste, [16]. This algorithm is based on a method of physics, the rubber band physics movement.
Nonlinear programming models have also been proposed for representing the irregular packing problem, such as [8,15,24,17,31,16]. In all these models free rotation of the pieces is allowed. In [8] a model for a strip packing problem was presented. In this model phi-functions are used to ensure non-overlapping of the pieces. The pieces in this paper are phi-objects, which are 2D and 3D objects of very general type. To solve the problem Chernov, Stoyan and Romanova applied a modification of the Zoutendijk method of feasible directions [36,37] combined with the concept of ǫ-active inequalities [29]. In [15] the pieces and the shapes can be arbitrary no convex polygons and to solve the problem Jones used three solvers: Branch&Reduce Optimization Navigator (BARON) [32,25]; LindoGlobal from Lindo Systems, Inc., which is part of the GAMS 22.5 distributions; and GloMIQO [19]. In [24], like in [8], a model for an irregular strip packing problem was presented. In this, the resolution of the problem is divided in two phases: big pieces are compacted in a first phase, while in a second phase, the remaining small pieces are placed between the big pieces. In their experiments, Rocha et al. used instances where the pieces are convex and no convex irregular polygons. The representation of these polygons was done by circle covering, and they used the nonlinear solver ALGENCAN [3,4]. In [17] a model for two cases of packing pieces was developed. In the first case, the objective is to pack the pieces in such a way as to minimize the area of the design rectangle. In the second case, the objective is to pack the pieces on stocked rectangles of known geometric dimensions. Separation lines are used to ensure non-overlapping. In their work the pieces are circles, rectangles, and convex polygons; and to solve the problem Kallrath used BARON [32,25] and LindoGlobal; he performed an experiment with only two polygons and found a feasible solution for it, in which LindoGlobal proved global optimality in 40 min, but BARON did not increase the lower bound at all. With more than two polygons this technique has difficulty finding optimal solution to the problem. In [31] was provided a nonlinear programming model that employs readyto-use phi-functions. In their paper, the pieces are bounded by circular arcs and/or line segments, and two types of container are considered, rectangular and circular. To solve the problem, Stoyan, Pankratov and Romanova developed a compaction algorithm to search for local optimal solutions, which is performed by IPOPT (an algorithm of interior points type, [34]), which is part of the COIN-OR.
In this paper we propose a nonlinear mathematical model for an irregular strip packing problem which deals only with polygons which may be convex or no convex, and that can rotate freely. In the model, to ensure non-overlapping, we use direct trigonometry, in particular separation lines, a similar technique to that used in [17], but with a significantly lower number of variables, allowing us to obtain good solutions for larger instances in reasonable execution times. As said before, a straight line is a separation line if given two polygons, all vertices of one of the polygons are on one side of the line or on the line, and all vertices of the other polygon are on the other side of the line or on the line. Like the polygons, the separation lines also can rotate freely. We use a code for nonlinear programming to solve the problem, IPOPT [34], which depends substantially on a starting point. We present a way of calculating starting points. This paper is organized as followed. In the next section a model of an irregular strip packing problem that considers free rotations is presented. The modeled problem, the polygons representation used in the model, and the tool used to ensure non-overlapping, are described also in this section. In Section 3, the parameters of the algorithm used for solving the problem are presented, as well as the numerical results obtained when performing tests with known benchmark instances. At the end of our paper we present some conclusions in Section 4.

A model for an irregular strip packing problem
The irregular strip packing problem studied in this paper consists of placing n irregular polygons, which can rotate freely, in a fixed width and unlimited length strip, obeying polygon integrity containment constraints and non-overlapping constraints, in order to minimize the used length of the strip. We propose a nonlinear mathematical model for this irregular strip packing problem.
We now explain how the polygons are represented in the model (Section 2.1), as well as the tool used to ensure non-overlapping of the polygons (Section 2.2), and then, introduce the model (Section 2.3).

Representation of polygons in the model
Here, we describe the representation of the polygons. Remember that the polygons may be convex or no convex. If a polygon is convex, it is represented by their vertices, as follows: If a polygon is no convex, it can be decomposed in convex polygons, as follows: being p i the number of convex polygons belonging to the partition of the no convex polygon P i , see Figure 1. The coordinates of a vertex belonging to a partition of a no convex polygon P i are given by (x l ij , y l ij ), with j = 1, . . . , p i and l = 1, . . . , v ij , being v ij the number of vertices of the convex polygon P ij .
We can deal with the problem with n no convex polygons in the same way that we deal the problem with N convex polygons, with N = n i=1 p i , we just have to ensure that the translations and rotations are the same for all polygons belonging to the partition of a no convex polygon.
The reference point is used for representing a polygon which has undergone translations and/or rotations, since we can write all other vertices of the polygon in terms of this point, as can be seen in Section 2.1.1.
We choose a vertex nearer to the origin as the reference point of a polygon, see Figure 2. Henceforth, we will use the following notation: (x l i , y l i ) are the coordinates of a vertex of a polygon P i in the original position, and (x l i ,ȳ l i ) are the coordinates of a vertex of a polygon P i which has undergone translations and/or rotations.
In the representation of the polygons used in the model, all the vertices are translated, so that the reference point (the first vertex) is located at the origin, (x 1 i , y 1 i ) = (0, 0). Note that the reference point will be transferred after rotation and translation, to the point (t ix , t iy ), that is, ( , with t ix and t iy the values of the translation parameters of the polygon P i . Thus, if we translate and rotate a polygon P i around his reference point, the coordinates of the vertices in general form are given by: being θ i the angle of rotation of the polygon P i . We consider that positive angles represent rotation in the counterclockwise direction.
When we deal with no convex polygons, we make sure that the translations and rotations are the same for all polygons belonging to the partition of the no convex polygon.

Separation lines
We use separation lines to ensure non-overlapping. A straight line given by the equation y = c i,r x + d i,r separates two polygons P i and P r if either or That is, a straight line is a separation line if all vertices of a polygon are on one side of the line or on the line, and all vertices of the other polygon are on the other side of the line or on the line, see Figure 3. When we are dealing with no convex polygons, we must have lines separating each pair of polygons P ij , P rs , belonging to the partition of polygons P i , P r , respectively, with i = r (that is, we do not have lines separating the polygons belonging to the partition of a no convex polygon), j ∈ 1, . . . , p i , and s ∈ 1, . . . , p r ./ Next, we present the general form of a separation line passing through a side of one of the two polygons, that is, which passes through two vertices of a polygon (P ij or P rs ), let's say (x k , y k ) and (x k+1 , y k+1 ).
Like polygons, the separation lines can also rotate and translate, as long as they remain being separation lines. When rotating and translating a separation line, we rewrite the point (x k+1 ,ȳ k+1 ), in function of (x k ,ȳ k ), which we will call from now on, reference point of the separation line; therefore being α ij ,rs the angle of rotation of the separation line of the polygons P ij and P rs .
Next, we rewrite the separation line equation: being v i the number of vertices of the polygon P i .
Without loss of generality, to ensure non-overlapping, we used in our model the set of constraints 2, for each pair of polygons P ij and P rs , with in which (x k , y k ) and (x k+1 , y k+1 ) are the two vertices of one of the polygons whereby passes the separation line and α ij ,rs is the rotation angle of the straight line that separates P ij from P rs . Note that the reference point of the separation line, (x k ,ȳ k ) are the values of the translations parameters, that from now on, we will write (x ij ,rs ,ȳ ij ,rs ), for a straight line that is separating P ij from P rs .
Let (z, q 1 , q 2 , ..., q n ,q 1 ,q 2 , ...,q Q ) be the vector of all variables in our model, being z the length of the strip defined in 6, q i the variables referring to the polygon P i , q i = (x 1 i ,ȳ 1 i , θ i ), i = 1, .., n andq ℓ the variables referring to the line that separates polygon P ij from polygon P rs ,q ℓ = (x ij ,rs ,ȳ ij ,rs , α ij ,rs ), ℓ = 1, ..., Q and Q = Remembering that the vertices of a translated and rotated polygon P ij are given by (x l ij ,ȳ l ij ), for i = 1, . . . , n, j = 1, . . . , p i and l = 1, . . . , v ij , in which i ,ȳ 1 i ) the variable reference point of polygon P i and θ i the variable rotation angle. (x l ij , y l ij ) are the coordinates of a vertex of a polygon P i in the original position. Constraints 7a and 7b ensure that a polygon P i is integrally inside the strip. In these constraints, the width e, is a fixed parameter; the length z is a variable;x l ij andȳ l ij depend on the reference point and the rotation angle of the polygon, (x 1 i ,ȳ 1 i ) and θ i , which are variable, respectively. Constraints 7c and 7d ensure non-overlapping of the convex polygons P ij and P rs . In these constraints, c ij ,rs and d ij ,rs depend on the reference point and the rotation angle of the separation line, (x ij ,rs ,ȳ ij ,rs ) and α ij ,rs , which are variable, respectively.

Computational experiments and results
All numerical experiments were performed on an Intel Core I7-4510U CPU @ 2.1GHz processor and 8 GB of memory. We used a code for nonlinear programming to solve the problem, IPOPT [34] (an algorithm of interior points type), which is part of the COIN-OR [35].
IPOPT is the implementation of a barrier or interior points method for nonlinear optimization on a large scale that solves problems of the type being v ∈ R n , and f , and g continuously differentiable; the mathematical details of this algorithm can be found in [34,22]. We used the C version of Ipopt-3.12.3 and compile the codes in the Ubuntu 12.04 operating system.
The CPU time is very large when we use the Hessian of the Lagrangian, therefore, we will always use an option given in IPOPT to approximate the Hessian with limited memory, which makes the runtime shorter, without affecting the quality of the solution.
In addition to the standard IPOPT parameters, we use the adaptive update strategy for barrier parameter, and we add equality constraints when handling fixed variables. The maximum execution time is set to one hour.
In the next subsection a brief explanation of the starting point used in the execution of IPOPT is presented. In Section 3.2, the results obtained with IPOPT and comparisons of these with two methodologies recent in the literature ( [31,16]), which also allow free rotations, are presented.

Starting points
The solution given by IPOPT is a stationary point. Taking into account that the developed nonlinear models are no convex, when solving them we can find many stationary points with different objective function values, and these stationary points depend on the starting point.
To generate a starting point, we used a bottom-left algorithm, which is a single pass heuristic that, given a set of pieces and an order, places the pieces one by one on the strip, as far to left and to the bottom as possible. We choose the shortest length obtained from the execution of 1000 iterations. In each one of these iterations the algorithm receives a list of randomly ordered polygons. This list is represented by a sequence, and for decoding the sequences, we used the technique presented in [20]. To avoid overlapping, the algorithm uses no-fit raster, concept also introduced in [20]. In no-fit raster, the strip should be represented using a discrete grid of points, the scale used for discretization in most instances is 1.0, except for Albano, Dagli, and Swim, which are 0.02, 0.5, and 0.00005, respectively. In all instances, the allowed rotation of the polygons are at four predefined angles 0 • , 90 • , 180 • , and 270 • .

Comparing results
To test our model, we will use the same benchmark problems used in the two approaches with which we will compare results, and that can be downloaded in [11]. The most important characteristics of these instances are presented in Table 1. The names of the instances are presented in the first column. In the second and third columns the number of convex, and no convex polygons are presented, respectively. The total number of polygons, after decomposition of no convex polygons into convex polygons are presented in the fourth column. In the fifth the total number of vertices are presented. The number of variables, and the number of constraints are presented in the sixth and seventh columns, respectively.  albano  10  14  52  220  3907  11700  blaz  16  12  48  216  3385  10792  dagli  21  9  51  228  3790  11988  jakobs1  15  10  35  146  1831  5468  jakobs2  14  11  42  158  2590  7367  marques  10  14  50  214  3628  11002  poly1a  10  5  22  81  712  1968  poly2a  20  10  44  162  2875  7500  poly3a  30  15  66  243  6490  16596  poly4a  40  20  88  324  11557  29256  poly5a  50  25  110  405  18076  45480  poly10a  100  50  220  810  72451  180060  poly20a  200  100  440  1620  290101  716520  shirts  60  39  169  739  42583  126236  swim  6  42  291  1446  123787  415845  trousers  48  16  104  468  16045  49476 For each instance, we obtained 10 starting points using the bottom-left algorithm, mentioned in the previous section. We execute IPOPT to solve our model with each one of these 10 different starting points. In Table 2, the minimum (second column), the average (third column), and the maximum (fourth column) strip length obtained are presented.
This is obtained when we solve the model in Section 2.3 for the instances of Table 1 using the 10 different starting points. The average time used to construct the starting points (fifth column) and the average time (sixth column) that was spent to solve the instances are also presented in the Table 2, as well as those results of the recent literature that allow free rotations. For these methods, the strip length and time reported in [31] are in seventh and eighth columns, and strip length and time reported in [16] are in ninth and tenth columns, respectively. For those instances tested in [31], it can be observed that the length in the best solution obtained in this work is slightly greater than those reported there. However, when comparing with [16] we can see that in most instances the minimum length obtained using our model is smaller. In the few remaining, the length is very close. On the other hand, note that our model finds good solutions for problems with a large number of polygons, although in these, the number of variables and constraints, and therefore the computational time, grows drastically. These solutions may not be optimal local due to the maximum execution time.
The layout of minimum length obtained and the starting point used to find it, for each instance, can be seen in Figures 4 -19.

Conclusions
In this work, we developed a model for irregular strip packing problems, that allows free rotations and uses separation lines to avoid overlap. As a relevant point of this work we highlight the use of the general equation of the line to model the separation lines, allowing us to use only three variables: the rectangular coordinates of the reference point and the angle of rotation. This establishes a marked dissimilarity with other models presented in the literature, for example the one presented in [17] which has a higher number of variables. In fact, in such work, it was reported that for one instance with a circle and a polygon of 4 vertices, 47 variables were used. In addition, it presented a shape of an experiment with two convex polygons of 5 and 6 vertices, but it does not report the number of variables of this instance. We estimate that there are 87        The solution of the problem modeled here, using local nonlinear programming solvers, depends on the starting point. We use a bottom-left algorithm to construct these starting   points. To test the effectiveness of our model, we compare our results with those obtained recently in the literature ( [31,16]), which also use methodologies with free rotations. The lengths reported in [31] are smaller but very close to those found in this work. On the other hand, the lengths reported in [16] are greater in most instances; in the others, they are very close. With the above said, the effectiveness of our model is verified, as well as the constructing starting points using bottom-left algorithm is good; however, we believe that these results could be improved by using another algorithm to construct the starting points, dividing the strip and the number of polygons into several parts, thus solving sub problems, among others.