IMPROVED BIASED RANDOM KEY GENETIC ALGORITHM FOR THE TWO-DIMENSIONAL NON-GUILLOTINE CUTTING PROBLEM

. The two-dimensional cutting problem has a direct relationship with industry problems. There are several proposals to solve these problems. In particular, solution proposals using metaheuristics are the focus of this research. Thus, in this paper, we present a specialized biased random key genetic algorithm. Several tests were performed using known instances in the specific literature, and the results found by the metaheuristics proposed were, in many cases, equal or superior to the results already published in the literature. Another comparison of results presented in this paper is related to the results obtained by specialized metaheuristics and the results found by a mathematical model using commercial software. Once again, in this case, the genetic algorithm presented results equal to or very close to the optimum found by the mathematical model. In addition, the optimization proposal was extended to two-dimensional non-guillotine cutting without parts orientation.


INTRODUCTION
In the stage of globalization which the markets currently are, products with competitive prices have been increasingly sought by industries. For that reason, we have invested in optimizing industrial processes to achieve the necessary competitiveness. Several types of problems arise when it comes to optimizing production processes, among them, there is the two-dimensional non-guillotine cutting problem. the value of a part is taken to be proportional to its area (Hadjiconstantinou;Christofides, 1995), where only two dimensions are considered by the problem under study in which the laser cutting technique is used.
Often, what is observed in the industry are pieces with high added value that must be cut from a plate, but these isolated pieces are not the product ready to be delivered. For the product to be finished by the industry, this high-value piece should interact with other parts whose value is smaller, but no less important for the delivery of the final product. Thus, the raw material cutting industry is forced to cut the pieces of lesser value, and from such an impasse, the lower and upper bounds applied to the quantity of each piece to be cut arise. Although it is interesting for the industry to cut the most valuable parts, the constraints of the two bounds must be respected.
Among the cutting problems, there are those that are guillotined and those that are nonguillotined. In several industries, the cutting equipment operates in such a way that any cut made on a rectangle should be performed in a straight line from one edge of the plate to another. This type of cut is referred to as a guillotine cut (Lai, Chan, 1997). However, in some applications, the guillotine cut is not the most suitable one, making it possible to use another cutting technique called laser-cut, allowing non-guillotine cutting.
This paper aims to identify the application of a metaheuristic in the resolution of the twodimensional non-guillotine cutting problem. Particularly, as a comparative basis, the papers analyzed were the ones by Alvarez-Valdes et al. (2007), in which the tabu search metaheuristic was used, by Lai and Chan (1997), in which the simulated annealing metaheuristic was chosen, and by Gonçalves and Resende (2013), in which the genetic algorithm metaheuristic was applied to solve the problem. As a specific objective, this work proposed to apply metaheuristics to solve the problem, which is the biased random key genetic algorithm (BRKGA), proposed by Gonçalves and Resende (2013), adding significant improvements to its implementation, and therefore to formulate a proposal that is better performing. A secondary objective is to show the performance of the optimization solver to solve the mathematical model of the problem.
There are several additional proposals in the specialized literature that address the twodimensional non-guillotined cutting problem. Arenales and Morabito (1995) address the unconstrained problem using a branch and bound strategy by using AND/OR logic and using additional heuristic rules to reduce the search space. In Leung et al. (2001), the unconstrained problem is approached by using the genetic algorithm and simulated annealing metaheuristics for the problem with fixed orientation and by performing tests using eight instances. In Beasley (2004), the constrained problem without rotation is approached by using a population heuristic which is a modified genetic algorithm. In Baldaci and Boschetti (2007), a two-level proposal is presented in which a subset of parts to be allocated is selected at the first level, and the possibility of finding feasible solutions is verified at the second level. The proposal can improve the upper bounds of several complex instances. In Ayadi et al., a new implementation version of the particle swarm optimization (PSO) metaheuristics is proposed which incorporates a heuristic strategy existing in the specialized literature. In Wei et al. (2018), a proposal based on the best-fit branch and bound method is presented. This proposal is supported by a greedy heuristic to generate complete solu-tion proposals from a partial solution within the branch and bound structure. Due to the diversity of variants used in tests, only a comparative analysis with some of these proposals is presented in the testing phase. This paper is organized into sections: section 2 presents the mathematical model of the problem; section 3 describes the specialized BRKGA to optimize the two-dimensional non-guillotine cutting problem; in section 4, the results found in this work are presented and analyzed; section 5 describes the conclusions and final considerations of the paper.

MATHEMATICAL MODEL
Hadjiconstantinou and Christofides (1995) describe the mathematical model for the twodimensional, orthogonal, non-guillotine, part-oriented, and constrained related to the upper bound problems in the following way: Let A 0 = (α 0 , β 0 ) be a rectangular plate with length α 0 and height β 0 , and let R be a set of m smaller rectangular pieces R 1 , R 2 , . . ., R m with dimensions (α 1 , β 1 ), (α 2 , β 2 ),..., (α m , β m ) and with corresponding values v 1 , v 2 , . . ., v m for each piece of R. The objective is to build a non-guillotine cutting pattern for A 0 with the highest total value using no more than Q i copies of each piece R i for all i = 1, . . ., m. There is also a minimum requirement of P i copies of each piece R i to be used in the cutting pattern.
Hadjiconstantinou and Christofides (1995) assumed the following hypotheses: (i) All dimensions (α i , β i ), for i = 0, ..., m, are assumed to be integers, therefore, cuts on the plates must be made in whole steps along the axes x or y. This limitation is not considered serious by the authors, since the real dimensions can be extended in practice; (ii) The orientation of the pieces is considered fixed, that is to say, a piece of length e and height f is different from a piece of length f and height e; (iii) Each piece should be cut with its edges parallel to the edges of the plate (orthogonal cuts).
To formulate the problem as a binary programming problem, the following was defined as the set of all possible points x along the length of A 0 , so that any piece R i of the set R can be cut from A 0 with its height parallel to the axis y and the cut piece has its lower-left corner in any x∈L i . In the same way, the authors defined the following: The sets L i and W i are defined for i = 1, . . ., m. In addition, it is defined that: 1, if the j th copy of the piece i is cut with its lower-left corner at x-position p where j =1,. . . , Q i and p ∈ L i , 0, otherwise.
The mathematical formulation of Hadjiconstantinou and Christofides (1995) takes the following form: x ijp , y ijq ∈ {0, 1} , i = 1, . . ., m, j = 1, . . ., Constraint (2) ensures that any point in A 0 be cut in one piece at most. Constraints (3) and (4) express the fact that any piece is cut at most once in A 0 . Constraint (5) ensures that not all pieces of the set R, whose sum of heights exceeds β 0 , can be cut in A 0 with the same length, having the left lower corners of each piece as the origin. Likewise, constraint (6) ensures that if the sum of the lengths of the pieces exceeds α 0 , then not all of these pieces can be cut into A 0 with the same height, having its lower-left corners as origin.
This model is a complete formulation of the two-dimensional cutting, orthogonal, nonguillotined problem involving approximately constraints and integer variables in the following way: and According to Hadjiconstantinou and Christofides (1995), the size of this formulation depends on the total number of pieces in R and the maximum number Q i of copies of each piece that can be used for cutting. A sequence of cuts in R is called the cutting pattern.
According to Alvarez-Valdes et al. (2007), depending on the values of the lower bound, P i , and the upper bound, Q i , of the pieces R i to be cut on the plate R, three types of problems can be distinguished: unconstrained, constrained, and doubly constrained. The first problem is called unconstrained, in which there are no lower and upper constraints that must be met, the only constraint is related to respecting the boundaries of the plate area R. In the constrained problem, there is only one constraint related to the upper bound. In this problem, all pieces R i to be cut in R, do not have a minimum number of copies to be cut, but there is a constraint on the maximum number of copies for any R i pieces. The upper bound indicates that up to Q i copies of pieces R i can be cut into a plate R. If the sum of the areas of the Q i copies of the piece R i is smaller than the area of the plate R, and all copies of the piece R i have already been used in cutting the plate, even if there is a possibility of cutting more copies of this piece R i , it cannot be done, because the upper bound has been reached and this constraint must be respected. Similarly, if the sum of the areas of Q i pieces R i is greater than the area of the plate R, not all copies of this part will be used, so the constraint continues to be respected but without using all the copies available through the upper bound.
The latter type of problem is doubly constrained when there are lower and upper bounds that must be respected by any R i pieces to be cut on the plate R. Therefore, it is possible to cut a number of copies of the part ranging from the value of its lower bound to the value of its upper bound, in a way that the two constraints imposed by the latter problem are respected.

SPECIALIZED BIASED RANDOM KEY GENETIC ALGORITHM
The BRKGA was proposed by Gonçalves and Resende (2013) and brings some differences in relation to the traditional genetic algorithm. However, to understand its operation, it is necessary first to define the random key genetic algorithm (RKGA).

Random Key Genetic Algorithm
Introduced by Bean (1994), the RKGAs have their chromosomes represented by vectors with n elements, which assume values generated randomly in the real interval [0, 1]. For that reason, a proposed solution is depicted in encoded form and must be decoded using a decoder.
The decoder is a deterministic algorithm that uses a chromosome as input, associating it with a solution of the combinatorial optimization problem, for which a target value or fitness can be calculated (GONÇ ALVES; RESENDE, 2013).
According to Gonçalves and Resende (2013), an RKGA generates a population of random key vectors during a number of generations. The initial population consists of p vectors of n random keys. Each component of the solution vector, or random key, is independently and randomly generated in the real interval [0, 1]. After the fitness of each individual is calculated by the decoder in the generation g, the population is partitioned into two groups of individuals: a small group of p e elite individuals, in other words, those with the best fitness values, and a group formed by the rest of the population, set of pp e non-elite individuals. To evolve from generation g to generation g + 1, a new generation of individuals is produced. The RKGA algorithm uses elitism. All the elite individuals of the population of generation g are copied unmodified to the population of generation g + 1. Two other strategies are used by the RKGAs to complete the formation of generation g + 1, that is, the mutation and recombination operators.
The RKGAs implement mutation by introducing mutants into the current population. A mutant is created as a vector of random keys, generated in the same way as an element of the initial population. With each generation, a small number of mutants p m is introduced into the population. Mutants replace the mutation strategy used in the traditional genetic algorithm (GONÇ ALVES; RESENDE, 2013).
The population of the next generations will be composed of elite individuals ( p e ), mutant individuals ( p m ), and individuals produced by the recombination process. With p e + p m individuals representing the population of the g+1, p− p e − p m , additional individuals need to be generated to complete the p individuals that make up the population of the g + 1. This is accomplished by producing p − p e − p m solutions through the recombination process.
In the RKGA, as in the BRKGA, there is no conventional selection operator. This is exactly where the two random key algorithms differ.

Biased Random Key Genetic Algorithm
In the BRKGA proposed by Gonçalves and Resende (2013), each descendant is generated by combining an individual randomly selected from the elite partition of the current population. For the selection of the second individual, there are two strategies: in the first strategy, the second individual is obtained by selecting it from the non-elite partition of the current population; and in the second strategy, the second individual is obtained by selecting it from the current population, which includes both the elite and the non-elite partitions. It should be noted that the selection operator is implicitly present.
The word biased in the BRKGA, incorporated by Gonçalves and Resende (2013), is used to show that recombination is not purely random. That is, one of the generating solutions must necessarily be an elite (biased), as opposed to the original proposal, in which the two generating solutions can be of the population as a whole. The other biased component appears when a single descendant is generated.
It should be noted that each recombination is performed independently and, therefore, one individual can produce more than one descendant in the same generation. As in RKGAs, BRKGAs implement parameterized uniform recombination (SPEARS; DEJONG, 1991).
In this type of recombination, there is the probability q e which will serve as a flag parameter to know if the component n, of the descending vector C, will be inherited from parent A or parent B. It is important to remember that n denotes The value used for q e is high and is typically chosen q e = 0,7. Thus, in each case, there is a probability of 0,7 for the value stored in A to be copied into the descending C being generated. This strategy allows most of the elements copied in C to be elements stored in the elite solution, making the reasons why only one descendant is generated clear.
When the next population is generated, the values of fitness of these individuals are calculated using the decoder, and the population is partitioned into elite and non-elite individuals to start a new generation until the stopping criterion is satisfied.

Specialized Genetic Algorithm
The specialized algorithm was based on the BRKGA proposed by Gonçalves and Resende (2013), but it considers some processes that were necessary to improve the performance when solving the problem under consideration.

Functioning of the Specialized BRKGA
Next, in Algorithm 1, we have a description of the operation of the specialized BRKGA.
Algorithm 1 -Specialized Biased Random Key Genetic Algorithm In Algorithm 1, it is noticed that the specialized genetic algorithm maintains some characteristics of the traditional genetic algorithm, such as the initial population generation, fitness calculation, recombination, mutation, and stopping criterion. Only a few phases were added, such as the decoding of each individual (solution proposal), the transformation of these individuals into cutting patterns, and the use of the elite group in the recombination.
In Algorithm 2, there is the description of the CHA sub-algorithm. while (block area ≤free area ( j)) 6: cut block from step 4 closest to the plate origin (lower-left corner) 7: update the list of free rectangles and the list of pieces available 8: end while 9: end for 10: return cutting pattern It can be seen in Algorithm 2 that the CHA determines how and where each piece is cut on the plate, picking the plate and the free rectangle to cut from it.

Formation of blocks
In the algorithm proposed in this paper, the block with equal parts is constructed. This procedure of grouping the plates into blocks was not used in the BRKGA proposed by Gonçalves and Resende (2013), so it is an improvement applied to the specialized RKGA proposed in this paper.
Pieces p i are placed side by side until no more space is available within the free rectangle chosen to allocate more pieces, or until the availability of the pieces p i is exhausted. Only after pieces p i are placed next to each other, and if more pieces of the same type are available to be used in the block construction, pieces p i are to be allocated above the pieces p i already allocated in the free rectangle, so it will occur successively until the quantity of pieces p i used in the construction of the block is ≤Q i . Consequently, a block with a rectangular or square geometric shape is guaranteed.

Scanning Free Rectangles
During the research, it was found that the identification of free rectangles on the plate is important for the success of the algorithm because identifying free rectangles makes it possible to choose which rectangle to use in the next cut inside the plate.
The purpose of this paper is to trace the plate by mapping the spaces that are available for further cuts. The procedure works as a scanner by mapping the board from top to bottom and from left to right. This is another improvement, proposed in this paper, to be applied to the specialized BRKGA, and it is also an unprecedented contribution of this work since the type of scanning done on the plate is different from those found in the specialized literature.
When a space is identified as free, it is added to it all the free and sequential spaces that are just below it. Then, following the same procedure, the free spaces to the right are added, obeying the height delimitation performed by the first column of the scan, thus originating a free rectangle. Using this logic, scanning is performed from top to bottom.
In the same way, scanning from left to right is used. When a space is identified as free, all the free and sequential spaces that are to its right are added to it.
After obtaining the free rectangles, the process of difference and elimination proposed by Lai and Chan (1997) is applied.

Tests
The test instances were obtained from the OR-Library website (2017). The OR-Library (2017) set of tests is composed of 21 cases extracted from the specialized literature, 12 instances of Beasley (1985), 2 instances of Hadjiconstantinou and Christofides (1995), 1 instance of Wang (1983), 1 instance of Christofides and Whitlock (1977), and 5 instances of Fekete and Scheppers (1997).
The algorithm was run using a laptop with an Intel Core i7 processor, 8GB of RAM, and the FORTRAN programming language was used. The time required for processing did not increase substantially in the different test cases, reaching an average execution time of 5 seconds.
As a comparison, the test cases were also submitted to the mathematical model proposed by Hadjiconstantinou and Christofides (1995) to solve the two-dimensional non-guillotine cutting problem with fixed orientation pieces. The model was programmed and tested in AMPL, using the solver CPLEX version 12.6.3 as the solver. In the execution of AMPL, it was used a Dell PowerEdge T430, with Linux Operating System (Debian distribution), with two 12 Cores/24 Threads Intel® Xeon® Processors E5-2650 v4 2.2GHz and 64 GB of RAM. The first 14 cases had an execution time of 1 to 10 seconds, but the last 6 cases had execution time greater than 24 hours.
To perform a fair comparison with the results obtained by the mathematical model tested in AMPL, the specialized algorithm proposed in this paper also considered the pieces with fixed orientation. In addition, in the specialized literature, both metaheuristic algorithms and exact methods also consider only this type of orientation. Therefore, the 21 cases were tested with two algorithms, which are: System I -The mathematical model, programmed in the AMPL proposed by Hadjiconstantinou and Christofides (1995) to solve the two-dimensional non-guillotine cutting problem with fixed orientation of the pieces.
System II -Specialized random key genetic algorithm with fixed orientation of the pieces.
System III -Specialized random key genetic algorithm with free orientation of the pieces which are tests that cannot be compared with other optimization proposals.

Analysis and Discussion of Results
The specialized algorithms proposed in this work were able to solve the two-dimensional nonguillotine cutting problem. The results are shown in Table 1, where it is possible to analyze the results obtained by this paper, comparing them with the results of works that are already published and taken as references in the specialized literature.
When analyzing the data contained in Table 1, the following are shown: in the second column, the data obtained by Beasley (1985) are presented using an exact method as a solution technique; the third column shows the results obtained by Alvarez-Valdes et al. (2005) in which the GRASP metaheuristics to solve the problem under study were used; the fourth column shows the results obtained by Alvarez-Valdes et al. (2007) in which the Tabu Search metaheuristics to solve the same problem were used; the fifth column presents the results obtained by System I by using the mathematical model proposed by Hadjiconstantinou and Christofides (1995), and the problem was solved using CPLEX; the following columns show the results obtained by System II with a specialized algorithm using fixed orientation of parts, and by System III with the specialized algorithm using free orientation of parts.
Comparing the results, System I presented better solutions in relation to Beasley (1985), which compares two exact methods applied to solve the same problem with the same tested instances. The results obtained by System I are considered optimal solutions and were used as comparison parameters to evaluate specialized metaheuristics.
The results presented by the GRASP metaheuristic of Alvarez-Valdes et al. (2005) are very close to the optimal results of System I; only in three test cases the results were inferior (cases 17, 18, and 19).
The results presented by the tabu search metaheuristics of Alvarez-Valdes et al. (2007) are identical to the results found by System I.
In terms of the results obtained by System II proposed in this work, using specialized metaheuristics, it was also found that the results are close to the optimal solutions of System I, so they are good-quality results; still, there were six test cases with results lower than optimal (cases 1, 3,7,15,16,17).
Comparing the results of the test cases of Alvarez-Valdes et al. (2005) with the results obtained by System II proposed in this work, the algorithm of Alvarez-Valdes et al. (2005) was better in smaller instances such as 1, 3, 7, 15, and 16. In these cases, the plates have dimensions ranging from 10 x 10 to 40 x 70, and the number of types of parts varies from 5 to 20. These instances are considered small and medium-sized instances.
In cases 18 and 19, which are considered to be large, with plates of 100 x 100 dimensions and number of types of pieces reaching 30 different types, Systems II proposed by the author was better than the algorithm of Alvarez-Valdes et al. (2005), presenting, therefore, its contribution and improvement for the resolution of the two-dimensional non-guillotine cutting problem.
As previously mentioned, a specialized BRKGA was proposed for the two-dimensional nonguillotined cutting problem with free orientation of parts (System III). This way, a problem with search space larger than the problem with fixed orientation is analyzed. For this reason, our results with fixed orientation of parts cannot be compared directly with the results considering free orientation of parts. But the comparison is valid if it is observed that the results of System III should be greater than or equal to the results of System II.

CONCLUSIONS
This paper used a specialized metaheuristic, that is, the biased random key genetic algorithm, to solve the two-dimensional non-guillotine cutting problem considering the alternatives with and without orientation of parts. In the alternative with a smaller search space, the proposal was compared with results obtained by other optimization proposals. In the case of optimization considering free orientation, it was not possible to compare it with other proposals since these proposals are not found in the specialized literature. The specialized algorithm uses specific strategies to address the problem: the first strategy is the formation of blocks using the same type of parts, and the second strategy was the scanning of free rectangles on the plate.
The algorithm proposed in this work is considered contributes to the specialized literature because it presents combinations of strategies not yet tested to solve the problem under study.
A mathematical model was programmed in AMPL and solved using the CPLEX solver to aid in the comparisons between the results from the exact method and the results obtained by the specialized algorithm proposed by the current work, in addition to comparing the latter and the results obtained by works already published and used as a reference in the literature, making it simpler to check the quality of each one of the results. When comparing the results obtained by the specialized genetic algorithm proposed in this work with the results available in the literature and found in Table 1 of this paper, it is concluded that the proposed algorithm surpassed in two test cases the results already published, giving another novelty to the current work. Finally, a specialized algorithm was tested which was configured to turn the parts, if need be. The results of the twenty-one tests, in this case, were equal to or better than those already published in the literature but considering the fixed orientation parts.
As suggestion for future work, there is the possibility of extending the problem resolution to three dimensions, using the specialized algorithm developed in this work and implementing other metaheuristics, such as the variable neighborhood search algorithm, for the resolution of the two-dimensional non-guillotine cutting problem.

Supplementary Materials
The part and plate size data used to support the findings of this study are included in the supplementary information file. For a better understanding of the data from Table A1 through Table A21, the column headers are described below.
R = (lengthxheight): are the length and height dimensions of the board for each test case.