An Improved Adaptive Genetic Algorithm for Two-Dimensional Rectangular Packing Problem

: This paper proposes the hybrid adaptive genetic algorithm (HAGA) as an improved method for solving the NP-hard two-dimensional rectangular packing problem to maximize the filling rate of a rectangular sheet. The packing sequence and rotation state are encoded in a two-stage approach, and the initial population is constructed from random generation by a combination of sorting rules. After using the sort-based method as an improved selection operator for the hybrid adaptive genetic algorithm, the crossover probability and mutation probability are adjusted adaptively according to the joint action of individual fitness from the local perspective and the global perspective of population evolution. The approach not only can obtain differential performance for individuals but also deals with the impact of dynamic changes on population evolution to quickly find a further improved solution. The heuristic placement algorithm decodes the rectangular packing sequence and addresses the two-dimensional rectangular packing problem through continuous iterative optimization. The computational results of a wide range of benchmark instances from zero-waste to non-zero-waste problems show that the HAGA outperforms those of two adaptive genetic algorithms from the related literature. Compared with some recent algorithms, this algorithm, which can be increased by up to 1.6604% for the average filling rate, has great significance for improving the quality of work in fields such as packing and cutting.


Introduction
The two-dimensional rectangular packing (2DRP) problem is often involved in the manufacturing process of furniture, glass, metal, paper products, VLSI chip design, newspapers paging, and so on [1,2]. Consequently, optimized algorithms designed to improve the quality and efficiency of packing (therefore reducing the cost of the enterprises) are the subject of many researchers' explorations in recent years. The 2DRP problem can be described simply as this: rectangles of different sizes are put into a large two-dimensional rectangular container (which we call the sheet) in a certain way to maximize the filling rate of the sheet. The 2DRP is a representative NP-hard problem [3] with complex constraints, which means that there is no exact method to solve the problem in polynomial time. Thus, most researchers have devoted their efforts to fast approximate heuristics and meta-heuristics to obtain practical solutions with higher qualities.
In recent decades, in order to solve the optimal or nearly optimal packing scheme of the 2DRP problem in a compromise time and space, scholars have explored and studied many methods for solving the problem. Two types of representative approaches have been used to address the 2DRP problem: the first solves the problem directly by using different heuristics; the second uses meta-heuristic algorithms, such as Simulated Anneal-ing (SA) [4], Genetic Algorithm (GA) [5], Particle Swarm Optimization (PSO) [6], Ant Colony Optimization (ACO) [7], etc., combined with heuristic placement strategy. Recently, other introduced algorithms include whale optimization algorithm [8], dragonfly algorithm [9], naked mole-rat algorithm [10], moth flame optimization [11], etc.
The component in the first approach is the layout representation for packing sequence. The bottom-left (BL) algorithm [12] proposed by Baker et al. is the earliest heuristic. The main idea is to start from the top right corner of the container, making each item continuously slide as far as possible downwards and then as far as possible to the left until the item is placed in a stable position. Some BL algorithms have improved heuristic variants such as bottom-left-fill (BLF) [13], deepest bottom-left-fill (DBLF) [14], improved bottom-left (IBL) [15], and bottom-left decreasing (BLD) [16]. The lowest horizontal line algorithm (LHLA) [17] proposed by Jia et al. queries the horizontal line with the lowest height when laying out the rectangle and places the rectangle on it. However, taking account of the lack of iterative optimization, in general, the packing quality of the heuristic approach is poor.
In order to improve the packing quality, the key part of the second method is how to use meta-heuristics combined with a layout representation approach to optimize the packing sequence. Hopper et al. conducted empirical research, combining SA and GA with BL and BLF approaches [18]. The best fit algorithm (BF) [19] proposed by Burke et al. describes the sheet as a set of dynamic slots, places items on the lowest available slot at each iteration step, and then combines them together. Later, Burke's team also proposed a simulated annealing enhancement to the BF algorithm [20]. He et al. suggested an efficient deterministic heuristic [21] using the action space. Wei et al. investigated an adaptive selection approach [22] without any control parameter to address the 2D rectangle packing area minimization problem. Recently, Xia et al. proposed an adaptive genetic simulated annealing algorithm [23] applied to the problem of packing optimization of rectangles.
In view of the premature problem of Simple Genetic Algorithm (SGA) in practical applications, it is easy to fall into local optimal solution prematurely as well as poor local search ability [24]. Srinivas et al. [25] proposed an Adaptive Genetic Algorithm (AGA) that dynamically adjusts the crossover probability and mutation probability according to the fitness of the individual. However, if the fitness of the individual is close to or equal to the maximum fitness of the population, the crossover probability and mutation probability will be close or equal to zero, making the evolution of genetic algorithm stagnant. Ren proposed an improved AGA [26] for this problem. However, when the average fitness is close to the maximum fitness of the contemporary population, it is easy to cause a large number of individuals to have a lower crossover probability and mutation probability, which will stagnate the evolution. This improved AGA has also been applied to many fields such as the three-dimensional container loading problem [27] and the laminate stacking sequence optimization [28]. In addition, the algorithm proposed by Ren is only in view of individual fitness. This algorithm adaptively changes the crossover probability and mutation probability from the local perspective, but the dynamic adjustment of crossover and mutation are not considered whether they have a positive impact on the population evolution process from the overall perspective of population evolution. According to the evolution of later generations, the AGA [29] proposed by Jiang recorded the number of algebras in which the fitness of the optimal individual of the population did not change and dynamically adjusted the crossover and mutation probabilities. However, the algorithm has two shortcomings: (1) the incremental value and decrement value of crossover probability and mutation probability are greatly affected by fitness, and if the value range of the fitness function is not between 0 and 1, the adaptive algorithm will no longer be applicable; (2) although the crossover probability and mutation probability of each generation are dynamically adjusted, the crossover probability and mutation probability of all individuals in a certain generation are the same, and the performance is consistent for individuals with different fitness. In this paper, in order to overcome the shortcomings of the two kinds of adaptive genetic algorithms, an improved method called hybrid adaptive genetic algorithm (HAGA) is proposed to supplement Ren and Jiang's algorithms. It is the key for HAGA to work through the joint action of individual fitness from local perspective and the global perspective of population evolution. The presented algorithm not only can obtain differential performance for individuals but also deals with the impact of dynamic changes on population evolution to quickly find a further improved solution. First of all, through the research and analysis of the 2DRP, a two-dimensional packing model is established to maximize the filling rate with relevant constraints. Then, the initial population is constructed by two-stage encoding, and the heuristic lowest horizontal line algorithm is used in the process of placement to decode the packing solution and calculate the individual fitness. After the termination rules of the design are satisfied in the iterative optimization process of HAGA, the packing scheme with the largest filling rate is selected in the feasible solutions. To verify the performance of the proposed algorithm, zero-waste and non-zerowaste instances are tested. The computational results show that the proposed HAGA is more efficient than the compared algorithms.
The rest of this paper is organized as follows. In Section 2, the mathematical model of 2DRP is built. The improved method, HAGA, for the 2DRP problem is introduced in detail in Section 3. Then, Section 4 provides the computational results and comparisons. Finally, the conclusion of this paper is given in Section 5 with some closing remarks.

Problem Statement
Assume that there is a set of n rectangle ( { } 1 2 , ,..., n R r r r = The task is to orthogonally place the items without overlapping in the sheet with W H × to maximize the filling rate of the sheet, i.e., to maximize the total area of the placed items divided by the area of the sheet. The paper addresses the 2DRP with the following assumptions [30,31]: (1) For any two rectangular items put in, they cannot overlap each other.
(2) When the rectangle is put into the sheet, it cannot exceed the boundary of the sheet.
(3) The side of the rectangular items must be parallel to the side of the sheet.   Let i θ be a decision variable, taking the value 1 or 0 accordingly as rectangle i r is or is not placed. The filling rate F of the sheet is defined as the ratio of the total area of the rectangles placed in it to the area of the sheet. The mathematical model of the 2DRP is as follows: (1) In constraints (1)-(4), i , j applies to 1, 2,..., n and i j ≠ . Constraint (1) implies that the boundaries of the placed rectangles do not exceed the width and height boundaries of the sheet. Constraint (2) means that the placed rectangles cannot overlap each other.  (3) implies that the placed rectangle is parallel to the side of the sheet and can be rotated by 9 0  . To sum up, the 2DRP problem can be described as figuring out the best packing solution that satisfies the constraints and maximizes the filling rate of the sheet.

Improved Adaptive Genetic Algorithm
It is representative for 2DRP to combine heuristic placement strategies and metaheuristic algorithms such as GA. The GA usually includes SGA and various improved genetic algorithms such as AGA. The SGA is prone to premature problems that cannot escape the local optimal solution. Then, some adaptive genetic algorithms such as AGA [25], AGA [26], and AGA [29] were proposed to solve this problem. However, these also have some problems. Since the AGA [26] is an improvement to the AGA [25], this section mainly focuses on some problems in AGA [26] and AGA [29], presenting further improved AGA for 2DRP by combining heuristic placement strategy.
The packing sequence of rectangles and whether they are rotated are the most important factors that affect the results of the final packing solution. This paper proposes an improved adaptive genetic algorithm as a rectangle sequencing algorithm to determine the packing sequence and rotation state of the rectangles, with the heuristic lowest horizontal line algorithm used as the placement algorithm to determine the position coordinates of the rectangle. First of all, in terms of the genetic algorithm, two-stage encoding is constructed, i.e., the packing sequence is coded by continuous integers from 1 to n , and the rotation state is coded with 0 and 1. The initial population is constructed through a combination of sorting rules and random generation. The heuristic lowest horizontal line algorithm is applied to decode, so as to provide the packing solution and calculate the individual fitness. Then, it uses a sort-based method for selection and improved adaptive crossover and mutation operations for evolution. The process of iterative optimization continues until the designed termination rule is reached, and finally, the result decoded by the optimal individual is taken as the final packing solution.

Encoding and Population Initialization
Assuming there are n rectangles 1 2 { , ,..., } n r r r to be packed, the chromosome adopts a two-stage encoding method consisting of the packing sequence and placement state of the rectangles, and the encoding length is 2n . The former n uses an integer permutation code, and the packing sequence adopts integer numbers, which is the order of the rectangles to be packed. The latter n uses integer coding, and the rectangle placement status is numbered with 0 and 1, in which 1 means the placement rectangle rotates, and 0 represents that it does not rotate. So,  Figure 2. The order of rectangular packing is 4, 2, 5, 1, 8, 6, 3, and 7, and the rectangles numbered 2, 5, 6, and 7 need to be rotated during the packing process. The above encoding approach accurately describes the factors that affect the packing solution. Considering that the packing sequence sorted by certain attributes tends to be the optimal solution, the following sorting rules [32] are fully utilized to generate the initial population in combination with random generation to speed up the algorithm when initializing the population.       E − are generated randomly. The packing sequence of the remaining six individuals is generated by the six sorting rules, and the corresponding rotation state of the rectangles is generated randomly. The PS is set to 100 in this paper.
Once the chromosome encoding sequence of the individuals in the population is determined, the heuristic placement algorithm can be used to decode and place, and then the individuals can be evaluated through the fitness function.

Heuristic Placement Algorithm
When using the fitness function to evaluate individuals in the population, it is necessary to arrange the rectangles into the sheet according to a certain heuristic algorithm for the packing sequence, rotation state, the width and height of rectangles, and the width and height of the sheet to calculate the sheet filling rate and figure out the fitness.
Liu proposed the IBL algorithm [15] to solve the problem that the left side of the BL algorithm [12] is too high and the unfilled cavity area can not be effectively used. Although it can overcome the disadvantage of the BL algorithm, which is prone to the waste area of the sheet, it will lead to the problem of a high right side. In contrast, the lowest horizontal line algorithm proposed in this paper can effectively solve the shortcomings of the BL and IBL algorithms and improve the filling rate [33]. Therefore, the placement algorithm in this paper adopts the heuristic lowest horizontal line algorithm of Ref. [23], and the procedure is as follows in Algorithm 1.
Algorithm 1 Heuristic packing procedure HeuristicPacking(R, sheet): 1 Initialize the lowest level line l is 0 2 while R is not empty or l is beyond the sheet H: 3 Get filling area on l and hollow area under l , the area size store 2-tuple set (AW, AH) 4 Priority to sorting hollow area in increasing order of AW for (AW, AH) If exist the next area: 14 Move the next area to continue placing 15 else: 16 Sort these placed i r in increasing order of i y 17 Update l and the area size (AL, AH) 18 return the placed information for R

Fitness Function and Selection Operator
Generally, the fitness function of the genetic algorithm is often determined by the objective function. In this paper, the fitness function refers to the sheet filling rate of the objective function, and its definition can be seen in the 2DRP mathematical model in Section 2.
Selection operation is the process of the genetic algorithm to evaluate the survival of the fittest. Its purpose is to keep the individuals with better fitness in the parent population as much as possible to keep good genes. The traditional roulette [34] selection method gives every individual the opportunity to make a copy, which does not reflect the competitiveness of excellent individuals and cannot realize the principle of survival of the fittest by the genetic algorithm. This paper uses an improved selection method sorted by individual fitness [35] to replace the roulette selection method. The sort-based selection method is described as follows: Step1. Calculate the fitness of each individual in the population.
Step2. Sort the individuals in the population in descending order of fitness.
Step3. Divide the sorted individuals into three parts, and the first one was duplicated into two copies.
Step4. Make a copy of the individuals in the middle.
Step5. The remaining individuals ranked behind are not copied.

Adaptive Crossover Operator and Mutation Operator
This subsection gives an improved genetic algorithm, in which the crossover probability and mutation probability can be adjusted adaptively. The crossover operation is to randomly exchange some genes between two individuals in the population based on the crossover probability so as to combine excellent genes to produce new and better individuals, which is the main part of the genetic algorithm. The mutation operation is to replace genes of an individual with other alleles under a certain mutation probability, thereby forming a new individual, ensuring the diversity of the population and preventing the phenomenon of premature.
Crossover probability and mutation probability are the most important parameters for crossover and mutation operations. Their selection is the key to influencing the behavior and performance of the algorithm and directly affecting the convergence of the algorithm. Regarding the crossover probability, if the crossover probability is too small, the search process will be slow and will easily cause stagnation. However, if the crossover probability is too large, the chromosomal structure of an individual with high fitness will be quickly destroyed and replaced. For the mutation probability, if it is too small, a new individual chromosome structure is not easy to be generated, and the search space will become narrower. Otherwise, if the mutation probability is too large, the genetic algorithm becomes a purely random search algorithm, which makes it easy to fall into a local optimal solution.
The AGA [26] proposed by Ren is to adaptively change the crossover probability and mutation probability from the local point according to individual fitness without considering whether the dynamic adjustment of crossover and mutation has a positive impact on population evolution from the whole point of population evolution. The AGA [29] proposed by Jiang dynamically adjusts the crossover probability and mutation probability according to the fitness changes of the optimal individual from the whole point of the evolution of the population offspring. However, the crossover probability and mutation probability of all individuals of a certain generation of population are still the same, and the performance of individuals with different fitness of the generation is consistent, so there is no difference. Moreover, the AGA [29] is greatly affected by the contemporary optimal fitness and the range of fitness function, which will limit the wide application of the algorithm.
Inspired by Ren and Jiang, this paper proposes an improved method called hybrid adaptive genetic algorithm (HAGA) to solve the 2DRP problem. The adaptive description of the crossover probability is as follows: where 1 c P and 2 c P are the upper bound and lower bound of c P . In general, the recommended parameters for these two crossover probabilities are 0.9 and 0.6 respectively [36]; i.e., 1 0.9 c P = and 2 0.6 c P = . The parameter t is the cumulative number of generations in which the optimal fitness value of the population has not changed. When the optimal fitness value of a certain generation changes, it will be set to 0 for re-accumulation. For example, in the process of iterative optimization, if the best fitness value lasts for ten times without changing, the t is set to 10. The parameter c is a constant to determine the slope  It also helps to solve the problem for AGA [29] that is greatly affected by the contemporary optimal fitness, representing the fitness function range with appropriately adjusting 1 c P and 2 c P . It is beneficial to combine with AGA [26]. The t is recorded after each iteration to determine the change of ( ) c P t . If t becomes larger, it shows that the optimal fitness of the population evolution has not changed, and the crossover probability needs to be increased to promote the change of the optimal fitness. If 0 t = , it reveals that the optimal fitness of the population evolution has increased, and the crossover probability ( ) c P t will drop to 2 c P for increasing more possible solutions. Then, combining Formula (3) to increase the difference of crossover operation for different individuals. Combining Formula (2) and Formula (3), it works together to find a better solution from the global perspective of population evolution and the local perspective of individual fitness. In addition, because it can increase the crossover probability from the perspective of the population evolution process, it is also helpful to overcome the problem that evolution is likely to stagnate when avg f is close to max f . The effect of the adaptive mutation probability change in the latter part is similar to this.
When carrying out crossover, the packing sequence gene string adopts the partial matching crossover (PMX), and the rotating state gene string adopts the two-point crossover method. An example of the crossover process is shown in Figure 4. The procedure of the hybrid adaptive crossover algorithm is described in Algorithm 2.

12
Get two crossed children using the same method of Figure   a v g Similarly, we can be aware that Formula (5) is the adaptive mutation probability from the whole point of population offspring evolution, and Formula (6) is the adaptive mutation probability for individual fitness from a local perspective. The hybrid adaptive mutation probability is used to work together to dynamically adjust the mutation probability. When mutating, the packing sequence gene string adopts the exchange mutation method, and the rotating state gene string takes the two-point basic position mutation method. An example of the mutation process is shown in Figure 5. The procedure of the hybrid adaptive mutation algorithm is described in Algorithm 3. In Algorithms 2 and 3, P represents the population in the genetic algorithm; PS means the size of the population, i.e., the number of individuals in the population; The parameter t is obtained by comparing the fitness of the best individual in the previous and next generations in the population evolution process. If the optimal individual fitness of the previous generation and the next generation are equal, 1 t t = + ; otherwise, t is reset to 0.

11
Get mutated child using the same method of Figure 5  12 Put mutated child with Heuristic Packing Procedure 13 Update ' [ ] P i using mutated child 14 Add ' P to P , Sort them in decreasing order of fitness In summary, Algorithm 2 plays a role of constructing the hybrid adaptive crossover algorithm (HACA) and Algorithm 3 structures the hybrid adaptive mutation algorithm (HAMA), which are two main parts of HAGA. From the local aspect of individual fitness and the whole evolution of later generations' population, the crossover probability and mutation probability can be adjusted adaptively to quickly find a further improved solution.

Termination Rules
The improved adaptive genetic algorithm we proposed shows a convergence trend in the process of searching and optimizing the solution space. For the iterative optimization calculation of 2DRP problem, there are the following termination rules: (1) After the iterative calculation reaches a certain level, the optimal fitness value has no obvious change in the continuous T iterations, and the calculation can be stopped in advance. For example, the T is set to 150 in this paper, which means the calculation is terminated if the optimal fitness value does not change through 150 continuous iterations; (2) Set the desired packing rate in advance. In the process of calculating, the pre-set filling rate is reached, and the calculation can be terminated early. For the expected filling rate, if the theoretical filling rate is known before the experiment, e.g., the theoretical filling rate of the C benchmark instances proposed by Hopper is 100% [18], it can be set to the theoretical value; otherwise, the user's expected value can be set according to actual needs; (3) Set the maximum number of iterations in advance. If the algorithm does not terminate prematurely, when the genetic algebra reaches the maximum number of iterations, the calculation is terminated, and the packing solution and filling rate are obtained.
The combination of the above three termination rules can not only fully optimize within the maximum number of iterations but also terminate the iterative optimization of the algorithm early when the expected value or fitness value is reached and there is no obvious change, which is beneficial to reduce the calculation time of the algorithm. When the iterative optimization of the algorithm is terminated, the packing solution corresponding to the chromosome with the largest fitness value is the optimal packing solution, and the corresponding filling rate is calculated.

Related Discussion
The proposed algorithm firstly overcomes the problem that is greatly affected by the contemporary optimal fitness and fitness function range for AGA [29] to expand its application; especially, the fitness function range is not between 0 and 1. Moreover, this algorithm not only obtains the differential performance of a certain generation of individuals by combining AGA [26] but also handles the impact of dynamic changes on population evolution to find adaptively an improved solution. However, the presented algorithm is not perfect in this paper; it has the following drawbacks: (1) There are some parameters that need to be controlled, including  P . In the early stage of evolution, the optimal individual is easy to change frequently; that is, there are more times where 0 t = , which leads to lower crossover probability and mutation probability that are not beneficial to rapid population evolution.
We can set up a series λ and c to determine the appropriate parameters through many experiments. In addition, it is possible for 0 t = to make continuous descent changes for different evolutionary periods.

Computational Experiments
In this section, to evaluate the effectiveness of the proposed improved method, HAGA, four computational experiments are designed and implemented. The rectangle packing instances, which include zero-waste and non-zero-waste datasets, are used for testing. The first three benchmark instances as zero-waste are the J instances ( 1 2 J J − ) proposed by Jakobs [37], the C instances ( 11 73 C C − ) proposed by Hopper et al. [18], and the N instances ( 1 13 N N − ) proposed by Burke et al. [19]. The scale and optimization difficulty of these three benchmark instances increase sequentially. The optimal solution for each instance is known beforehand, in which the total area of the given items is equivalent to the area of the sheet, resulting in a 100% filling rate. So, they all theoretically have a 100% filling rate but are not balanced dimensionally. However, considering that non-zero-waste problems often occur in real application, the non-zero-waste datasets, including 4 instances (cgcut1-cgcut3) given in Ref. [38], 13 instances (gcut1-gcut13) in Ref. [39], 12 instances (ngcut1-ngcut12) in Ref. [40], and 10 instances (beng1-beng10) in Ref. [41], are used for further testing.
The SGA, AGA [26], AGA [29], and HAGA involved in the experiment are implemented in Python language programming and calculated on an Intel Core i5 CPU at 2.5 GHz with 8 GB memory. We tested the effects of SGA and AGA [26] for each individual fitness proposed by Ren, AGA [29] for the evolutionary process proposed by Jiang, and the HAGA proposed in this paper. Then, a comparison of HAGA with some recent algorithms is provided. In order to balance the calculation accuracy and efficiency of the test algorithm, the number of iterations NIND is set to 2000, and the calculation result is the average of twenty operations.

Computational Experiment for J Instances
We know that Ref. [42] divides the J benchmark instances into two groups of problem instances, which are called 1 J and 2 J . The size of the large rectangular sheet is 40 15 × . The number of items in the first group is 25, and the number of items in the second group is 50. For more detailed information on the instances, refer to the original paper published by Jakobs [37].
In this subsection, we compare the performance of the proposed HAGA with SGA, AGA [26], and AGA [29] on the J instances. The AGA [26] is an adaptive genetic algorithm that dynamically adjusts the crossover probability and mutation probability for each individual. The AGA [29] is an adaptive genetic algorithm that dynamically adjusts the crossover probability and mutation probability for the evolution process. In the comparative experiment, the crossover probability and mutation probability in SGA are 0.9 and 0.1, respectively. The parameters 1 c P , 2 c P , 1 m P and 2 m P of the AGA [26] remain consistent with that in this paper, and the parameter c in AGA [29] also remains consistent with this paper. The computational results are shown in Table 1, where F represents the filling rate of the sheet. Figures 6 and 7 show the rectangular packing layouts corresponding to the optimal solution obtained by the HAGA. From the results shown in Table 1, it can be seen that the average calculation time of the three adaptive genetic algorithms of AGA [26], AGA [29], and HAGA are 16.45 s, 16.4 s, and 14.45 s respectively, which is less than that of the SGA. It shows that the adaptive genetic algorithm can accelerate the convergence speed of the algorithm by dynamically adjusting the crossover probability and mutation probability. The average filling rate of the adaptive genetic algorithm is higher than that of SGA, which shows that the adaptive genetic algorithm can address the problem that SGA may fall into a local optimal solution. Next, by comparing three adaptive genetic algorithms, we can realize that they have almost the same average filling rate on the J instances, but the average time consumed for HAGA is 2 s, which is less than AGA [26] and 1.95 s less than AGA [29]. The results show that the HAGA can overcome the shortcomings of the two types of adaptive genetic algorithms including AGA [26] and AGA [29] through the joint effect of the local aspects of individual and the overall aspects of evolution, and the convergence speed of the algorithm is accelerated to show the effectiveness of the proposed algorithm.

Computational Experiment for C Instances
The number of items per instance for C benchmark instances ranges from 16 to 197. According to the area of the sheet, these instances can be classified into seven groups with three instances each. For detailed information on the C instances, refer to Hopper et al. [18]. The experimental comparison results are shown in Table 2. It can be inferred from the results in Table 2 that as the scale n of the problem instances becomes larger and larger, the difficulty of the algorithm convergence increases, and some instances cannot achieve a 100% filling rate. The HAGA can obtain a 100% filling rate for all instances except for C71, but AGA [26] fails to obtain a 100% filling rate for C13, C71, C72, and C73. The scale of the C13 instance is not large, but the 100% filling rate is not obtained because the algorithm fell into a possible local optimal solution during a certain test. In addition, the AGA [29] fails to obtain a 100% filling rate for C71, C72, and C73. It is obvious that the HAGA is better than AGA [26] and AGA [29].
Then, by comparing SGA and the adaptive genetic algorithm, it can be realized that AGA [26], AGA [29], and HAGA save 74.59, 71.9, and 108.91 s respectively in comparison to SGA. The average filling rate of the adaptive genetic algorithm is generally higher than that of SGA, which shows that the adaptive genetic algorithm can overcome the "premature" phenomenon to which SGA is prone. Through the analysis of the results of the three adaptive genetic algorithms, it can be found that the HAGA uses 34.32 s and 37.01 s less than AGA [26] and AGA [29] in the average calculation time, and it increases the average filling rate by 0.15% and 0.11%, respectively. This shows that the improved method, HAGA, can speed up the convergence of the algorithm and relatively increase the filling rate of the sheet.

Computational Experiment for N Instances
The N benchmark instances were generated by Burke et al., and optimal solutions were also known beforehand. It includes 13 groups of test instances, and the number of items to be packed increases from 10 in the first group to 3152 in the thirteenth group. For detailed information on N instances, refer to Burke et al. [19]. The comparison results of our experiments are shown in Table 3. It should be noted that the '-' in N13 means that no experimental calculation has been performed. We can recognize from the results shown in Table 3 that SGA can only obtain a 100% filling rate for N1-N3 instances with a small scale. Both AGA [26] and AGA [29] fail to obtain a 100% filling rate in five instances, and HAGA fails to obtain a 100% filling rate in three instances N10~N12. Comparing the N5 and C41-C43 instances of almost the same scale, you will find that the N5 instance consumes a lot more time than the C41-C43 instances. For example, the calculation time of AGA [26] is 22.37 s on the C43 instance, but it takes 33.98 s on the N5 instance. These indicate that solving N instances is more difficult than solving the C instances, but the HAGA is still better than the two types of adaptive methods AGA [26] and AGA [29] to solve the 2DRP problem.
Then, by comparing SGA and the adaptive genetic algorithm, we figure out that AGA [26], AGA [29], and HAGA reduce the time by 90.46, 114.08, and 154.49 s, respectively compared with SGA, and the average filling rate of the adaptive genetic algorithm is generally higher than that of SGA. We compare the computational results of the three adaptive genetic algorithms again, and it can be seen that the HAGA saves 64.03 s and 40.41 s in the average calculation time than AGA [26] and AGA [29], and it increases the average filling rate by 0.1% and 0.05%, respectively. Therefore, it further shows that the HAGA can better improve the convergence speed and filling rate for 2DRP, thereby improving the packing efficiency and quality.

Computational Experiment for Non-Zero-Waste Instances
The 38 non-zero-waste instances including cgcut1-cgcut3, gcut1-gcut13, ngcut1-ngcut12, and beng1-beng10 are evaluated to further verify the effectiveness of the HAGA. These datasets have been used by other authors to verify the performance of the algorithm. Although some of the area of the stock sheet is wasted in these instances, the optimal solution of problem can be known from Ref. [43]. It should be noted that the filling rate needs to be obtained through the (1 ) 100 trim loss − × formula conversion for the trim loss indicator in Ref. [43]. The data can be downloaded from http://people.brunel.ac.uk/~mastjjb/jeb/info.html. Table 4 reports the comparison results of AGA [26], AGA [29], and HAGA for nonzero-waste instances. From Table 4, we can observe that the number of instances in which HAGA, AGA [26], and AGA [29] obtained the optimal filling rate is 22, 20, and 21, respectively. The HAGA obtains the optimal filling rate except for cgcut3 on the cgcut1-cgcut3 instances, ngcut6, ngcut9, and ngcut11 on the ngcut1-gcut12 instances, and beng10 on the beng1-beng10 instances. The worst performance of HAGA is that it only obtains the optimal filling rate on gcut1 and gcut3 for the gcut1-gcut13 instances. The filling rate of HAGA is not lower than that of AGA [26] except for five instances (gcut5, gcut9, gcut11, gcut12, ngcut11). Similarly, the filling rate of HAGA is not lower than that of AGA [29] except for six instances (gcut2, gcut7, gcut9, gcut10, ngcut12, beng10). By comparing the computational results of the three adaptive genetic algorithms, it can be observed that the HAGA saves 19.5 s and 15.8 s in average calculation time compared with AGA [26] and AGA [29], and it improves the average filling rate by 0.2% and 0.06%, respectively. The computational results show that the HAGA is still effective for non-zero-waste instances.

Compare the Results with Other Algorithms
We compare the proposed algorithm with the algorithms in Ref. [43][44][45]. A hybrid simulated annealing algorithm (HSA) proposed by Leung et al. [43] uses a greedy strategy and simulated annealing to obtain an improved solution. A least-waste-first heuristic algorithm (LWF) proposed by Wei et al. [44] presents a least wasted first heuristic algorithm to find the desirable solution. An iterative bidirectional heuristic placement (IBHP) proposed by Shiangjen et al. [45] combines the constructive heuristic algorithms of bidirectional heuristic placement (BHP) and iterated local search (ILS) with a shift strategy to improve the solution. Considering that Ref. [44] lacks some test instances, the results of LWF and HSA are taken directly from Ref. [43]. The HSA and LWF in C++ programming language were run on a Dell GX270 with 2.60 GHz CPU and 512 MB memory. The IBHP in C programming language was performed on an Intel Core i5 CPU at 2.90 GHz with 4 GB of RAM running on the Ubuntu 12.04 operating system. The comparisons of the average filling rate and the average calculation time between LWF, HSA, IBHP, and HAGA are shown in Table 5. The '-' in Table 5 means that the results are not reported by the corresponding algorithm. From Table 5, it can be observed that the average filling rate of HAGA on the C11-C73, cgcut1-cgcut3, and ngcut1-ngcut12 instances is 99.8%, 97.5755%, and 86.5549%, respectively, which outperforms LWF, HSA, and IBHP. Compared with LWF for these instances, the average filling rate of HAGA can be increased by 0.5356%, 1.6604%, and 0.999%, respectively. The maximum average filling rate can be improved by 1.6604% on cgcut1-cgcut3 for LWF. The average filling rate of HAGA is better than HSA except for N1-N12. Compared with IBHP for C11-C73, cgcut1-cgcut3, and ngcut1-ngcut12 instances, the average filling rate of HAGA can be increased by 0.0527%, 0.486%, and 1.1835%, respectively. Therefore, the HAGA achieved better quality for C11-C73, cgcut1-cgcut3, and ngcut1-ngcut12 instances within reasonable time, with the elimination of equipment and language differences. However, the average filling rate of HAGA on the N1-N12, gcut1-gcut13, and beng1-beng10 instances is worse than LWF and IBHP. For example, the average filling rate of HAGA is only 0.23%, 0.0252%, and 0.0897% lower on these instances for IBHP, respectively. Overall, the HAGA is relatively superior to these three algorithms within a reasonable duration of computational time, especially on the C11-C73, cgcut1-cgcut3, and ngcut1-ngcut12 instances.
In order to observe the performance of different changes of the proposed algorithm, we just run the proposed algorithm on the N1-N12 instances. We first set 0. . Similarly, Figure 9 shows the computational results of different c . From Figure 9, we can observe that 0.2 c = is better. Furthermore, from Figures 8 and 9, it can be seen that the change of parameters has a greater impact on the performance of HAGA as the scale of the instance increases. However, the parameter changes for different problems may achieve better results. In addition, if =0 λ , the algorithm just changes to AGA [26] from the local perspective of the individual fitness; if =1 λ , the algorithm happens to be an adaptive genetic algorithm that changes from the overall perspective of the population evolution. We can see that the proposed algorithm, HAGA, has better performance. According to the results of parameter changes, we can establish a consistent parameter setting for HAGA to obtain good benefits.

Conclusions
In this paper, in order to better solve the 2DRP problem, we analyzed the respective shortcomings of the current two types of adaptive genetic algorithms in detail and proposed an improved method named hybrid adaptive genetic algorithm (HAGA). In the process of providing the solution, the crossover probability and mutation probability of chromosomes are adaptively adjusted according to the collective effect of individual fitness and population evolution process. When using HAGA, the initial population is constructed through a combination of sorting rules and random generation, and operators with better performance are fully used for selection, crossover, and mutation. The heuristic lowest horizontal line algorithm is used as the positioning algorithm to place rectangles. Through continuous iterative optimization of the algorithm, the final packing layout and sheet filling rate are obtained.
The proposed improved method is compared with other representative algorithms. The computational experiments on a wide range of benchmark instances from zero-waste to non-zero-waste problems are implemented. The computational results show that HAGA outperforms the comparison of two adaptive genetic algorithms. Compared with some recent algorithms, the results reveal that HAGA is relatively better than HSA, LWF, and IBHP, especially on the C11-C73, cgcut1-cgcut3, and ngcut1-ngcut12 instances. Moreover, in view of observing the performance of different changes, the experiments were designed a series of λ and c parameters to determine the consistent parameter settings for HAGA. The presented algorithm, which works adaptively through the two perspectives of individual and population evolution, can also be applied to cutting, the Travelling Salesman Problem (TSP), Vehicle Routing Problem (VRP), etc. In the future, the focus of research is to further improve the calculation speed and filling rate of the algorithm for 2DRP problem and strive to find a satisfactory solution for larger scale and difficult benchmark instances.

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

Data Availability Statement:
The test source data comes from an existing data set. The test source data can be downloaded from http://people.brnel.ac.uk/~mastjjb/jeb/info.html or related literature. The test source data does not belong to us. The experimental result data is calculated by applying the algorithm of this paper to the test source data.

Conflicts of Interest:
The authors declare no conflict of interest.