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.
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  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 Annealing (SA) , Genetic Algorithm (GA) , Particle Swarm Optimization (PSO) , Ant Colony Optimization (ACO) , etc., combined with heuristic placement strategy. Recently, other introduced algorithms include whale optimization algorithm , dragonfly algorithm , naked mole-rat algorithm , moth flame optimization , etc.
The component in the first approach is the layout representation for packing sequence. The bottom-left (BL) algorithm  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) , deepest bottom-left-fill (DBLF) , improved bottom-left (IBL) , and bottom-left decreasing (BLD) . The lowest horizontal line algorithm (LHLA)  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 . The best fit algorithm (BF)  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 . He et al. suggested an efficient deterministic heuristic  using the action space. Wei et al. investigated an adaptive selection approach  without any control parameter to address the 2D rectangle packing area minimization problem. Recently, Xia et al. proposed an adaptive genetic simulated annealing algorithm  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 . Srinivas et al.  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  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  and the laminate stacking sequence optimization . 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  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-zero-waste 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.
2. Problem Statement
Assume that there is a set of rectangle () items with for . The task is to orthogonally place the items without overlapping in the sheet with 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]:
For any two rectangular items put in, they cannot overlap each other.
When the rectangle is put into the sheet, it cannot exceed the boundary of the sheet.
The side of the rectangular items must be parallel to the side of the sheet.
The rectangular can be rotated .
Based on the problem description and assumptions, a two-dimensional rectangular coordinate system is established with the bottom left corner of the sheet as the origin of the coordinates, and the coordinates of the bottom left corner of the rectangle are , as shown in Figure 1. Use variable to indicate whether the rectangle is rotated; means no rotation, and means rotation. If the rectangle is rotated, the width and height of the rectangle are interchanged.
Therefore, the actual width and height of the rectangle placed change to and respectively, and the coordinates of the top right corner of the rectangle are . It can be seen that the rectangle is represented by , which can determine the accurate position of the rectangle in the sheet.
Let be a decision variable, taking the value 1 or 0 accordingly as rectangle is or is not placed. The filling rate 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:
In constraints (1)–(4), , applies to and . 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. and represent the coordinates of the bottom left corner and the top right corner of the placed rectangles, respectively. The coordinates of the top right corner can be calculated with the coordinates of the bottom left corner and the width and height of the actual size of the rectangle. Constraint (3) implies that the placed rectangle is parallel to the side of the sheet and can be rotated by . 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.
3. Improved Adaptive Genetic Algorithm
It is representative for 2DRP to combine heuristic placement strategies and meta-heuristic 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 , AGA , and AGA  were proposed to solve this problem. However, these also have some problems. Since the AGA  is an improvement to the AGA , this section mainly focuses on some problems in AGA  and AGA , 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 , 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.
3.1. Encoding and Population Initialization
Assuming there are rectangles 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 . The former uses an integer permutation code, and the packing sequence adopts integer numbers, which is the order of the rectangles to be packed. The latter 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, are the rotation state of rectangles to be packed. The overall encoding of individual chromosomes are as follows:
where , , and . For example, there are eight rectangles numbered 1, 2, 3, 4, 5, 6, 7, and 8 to be loaded into the sheet, and each rectangle can be rotated. The packing sequence and rotation status of the two-stage encoding approach for individual chromosome are shown in 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  are fully utilized to generate the initial population in combination with random generation to speed up the algorithm when initializing the population.
Sort by area in decreasing order.
Sort by width in decreasing order.
Sort by height in decreasing order.
Sort by perimeter in decreasing order.
Sort by maximum of width and height in decreasing order.
Sort by length of diagonal + width + height in decreasing order.
Figure 3 shows the initial population constructed by individuals. The individuals from to 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 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.
3.2. 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  to solve the problem that the left side of the BL algorithm  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 . Therefore, the placement algorithm in this paper adopts the heuristic lowest horizontal line algorithm of Ref. , and the procedure is as follows in Algorithm 1.
Algorithm 1 Heuristic packing procedure
1 Initialize the lowest level line is 0
2 whileR is not empty or is beyond the sheet H:
3 Get filling area on and hollow area under , the area size store 2-tuple set (AW, AH)
4 Priority to sorting hollow area in increasing order of AW for (AW, AH)
5 Prepare to place from R in order and rotation state
6 if need to rotate:
7 Exchange the width and height of
8 ifAW and AH :
9 Place , update area size (AW, AH)
10 Record the left-bottom corner position coordinates ,
placed state, size, rotation state, etc.
11 Remove from R
13 If exist the next area:
14 Move the next area to continue placing
16 Sort these placed in increasing order of
17 Update and the area size (AL, AH)
18 return the placed information for R
3.3. 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  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  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.
3.4. 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  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  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  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 and are the upper bound and lower bound of . In general, the recommended parameters for these two crossover probabilities are 0.9 and 0.6 respectively ; i.e., and . The parameter 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 is set to 10. The parameter is a constant to determine the slope of the function, and in the experiment. is the fitness value of the larger individuals that are ready to implement crossover; is the maximum fitness value of the current population; is the average fitness value of the current population. The is an adjustable weight parameter with the range of , and in the experiment.
in Formula (2) has a value range of 0–1 when is greater than or equal to 0, which ensures that changes between and . It also helps to solve the problem for AGA  that is greatly affected by the contemporary optimal fitness, representing the fitness function range with appropriately adjusting and . It is beneficial to combine with AGA . The is recorded after each iteration to determine the change of . If 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 , it reveals that the optimal fitness of the population evolution has increased, and the crossover probability will drop to 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 is close to . 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.
Algorithm 2 Hybrid adaptive crossover algorithm
1 Initialize the parameter
2 Copy population from the population with individuals
3 Compute with formula (2)
4 Compute for
5 foriin range():
6 Randomly select two different parents from
7 Compute greater fitness from
8 Compute with formula (3) and with formula (4)
9 Generate a random number between [0, 1] with rand() function
10 if :
11 Generate different random numbers within and within
12 Get two crossed children using the same method of Figure 4
13 Put two crossed children with Heuristic Packing Procedure
14 Update using two crossed children
15 Add to , Sort them in decreasing order of fitness
16 Delete individuals with small fitness and get crossed population
17 return crossed population
The adaptive description of mutation probability is as follows:
where and are the upper bound and lower bound of . In the experiment, these two mutation probability parameters recommended are 0.1 and 0.5 respectively ; i.e., and . is the fitness value of the individual to be mutated; is the maximum fitness value of the current population; and is the average fitness value of the current population. For other parameters, refer to the section on adaptive crossover probability. 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, represents the population in the genetic algorithm; means the size of the population, i.e., the number of individuals in the population; The parameter 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, ; otherwise, is reset to 0.
Algorithm 3 Hybrid adaptive mutation algorithm
1 Initialize the parameter
2 Copy population from the population with individuals
3 Compute with formula (5)
4 Compute for
5 foriin range():
6 Get parent from and compute its fitness
7 Compute with formula (6) and with formula (7)
8 Generate a random number between [0, 1] with rand() function
9 if :
10 Generate different random numbers within and within
11 Get mutated child using the same method of Figure 5
12 Put mutated child with Heuristic Packing Procedure
13 Update using mutated child
14 Add to , Sort them in decreasing order of fitness
15 Delete individuals with small fitness and get mutated population
16 return mutated population
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.
3.5. 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 iterations, and the calculation can be stopped in advance. For example, the 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 benchmark instances proposed by Hopper is 100% , 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.
3.6. Related Discussion
The proposed algorithm firstly overcomes the problem that is greatly affected by the contemporary optimal fitness and fitness function range for AGA  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  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 , , , , , and . The , , , and may be obtained through existing experience. It is necessary to do sets of comparative experiments to establish consistent parameters , to obtain good benefits.
(2) From Formulas (2) and (5), if , it can be concluded that suddenly drops to the minimum of crossover probability and mutation probability and . In the early stage of evolution, the optimal individual is easy to change frequently; that is, there are more times where , which leads to lower crossover probability and mutation probability that are not beneficial to rapid population evolution.
We can set up a series and to determine the appropriate parameters through many experiments. In addition, it is possible for to make continuous descent changes for different evolutionary periods.
4. 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 instances () proposed by Jakobs , the instances () proposed by Hopper et al. , and the instances () proposed by Burke et al. . 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. , 13 instances (gcut1-gcut13) in Ref. , 12 instances (ngcut1-ngcut12) in Ref. , and 10 instances (beng1-beng10) in Ref. , are used for further testing.
The SGA, AGA , AGA , 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  for each individual fitness proposed by Ren, AGA  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 is set to 2000, and the calculation result is the average of twenty operations.
4.1. Computational Experiment for Zero-Waste Instances
4.1.1. Computational Experiment for Instances
We know that Ref.  divides the benchmark instances into two groups of problem instances, which are called and . The size of the large rectangular sheet is . 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 .
In this subsection, we compare the performance of the proposed HAGA with SGA, AGA , and AGA  on the instances. The AGA  is an adaptive genetic algorithm that dynamically adjusts the crossover probability and mutation probability for each individual. The AGA  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 , , and of the AGA  remain consistent with that in this paper, and the parameter in AGA  also remains consistent with this paper. The computational results are shown in Table 1, where F represents the filling rate of the sheet. Figure 6 and Figure 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 , AGA , 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 instances, but the average time consumed for HAGA is 2 s, which is less than AGA  and 1.95 s less than AGA . The results show that the HAGA can overcome the shortcomings of the two types of adaptive genetic algorithms including AGA  and AGA  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.
4.1.2. Computational Experiment for Instances
The number of items per instance for 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 instances, refer to Hopper et al. . The experimental comparison results are shown in Table 2.
It can be inferred from the results in Table 2 that as the scale 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  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  fails to obtain a 100% filling rate for C71, C72, and C73. It is obvious that the HAGA is better than AGA  and AGA .
Then, by comparing SGA and the adaptive genetic algorithm, it can be realized that AGA , AGA , 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  and AGA  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.
4.1.3. Computational Experiment for Instances
The 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 instances, refer to Burke et al. . 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  and AGA  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  is 22.37 s on the C43 instance, but it takes 33.98 s on the N5 instance. These indicate that solving instances is more difficult than solving the instances, but the HAGA is still better than the two types of adaptive methods AGA  and AGA  to solve the 2DRP problem.
Then, by comparing SGA and the adaptive genetic algorithm, we figure out that AGA , AGA , 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  and AGA , 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.
4.2. 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. . It should be noted that the filling rate needs to be obtained through the formula conversion for the trim loss indicator in Ref. . The data can be downloaded from http://people.brunel.ac.uk/~mastjjb/jeb/info.html.
Table 4 reports the comparison results of AGA , AGA , and HAGA for non-zero-waste instances. From Table 4, we can observe that the number of instances in which HAGA, AGA , and AGA  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  except for five instances (gcut5, gcut9, gcut11, gcut12, ngcut11). Similarly, the filling rate of HAGA is not lower than that of AGA  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  and AGA , 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.
4.3. 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.  uses a greedy strategy and simulated annealing to obtain an improved solution. A least-waste-first heuristic algorithm (LWF) proposed by Wei et al.  presents a least wasted first heuristic algorithm to find the desirable solution. An iterative bidirectional heuristic placement (IBHP) proposed by Shiangjen et al.  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.  lacks some test instances, the results of LWF and HSA are taken directly from Ref. . 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 and perform the experiments with . For each , the calculation result is the average of twenty operations for each instance. Figure 8 with the y-axis representing the average filling rate reports the results of different . From Figure 8, we can observe that is better. Now, we fix and perform the experiments with . Similarly, Figure 9 shows the computational results of different . From Figure 9, we can observe that is better.
Furthermore, from Figure 8 and Figure 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 , the algorithm just changes to AGA  from the local perspective of the individual fitness; if , 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.
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 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.
Conceptualization, Y.-B.L. and X.X.; methodology, H.-B.S. and Y.-B.L.; software, H.-B.S. and X.X.; validation, H.-B.S. and Y.-B.L.; data curation, Y.-R.L. and X.X.; writing—original draft, Y.-R.L. and H.-B.S.; writing—review and editing, H.-B.S. and Y.-B.L.; supervision, Y.-B.L. and X.X. All authors have read and agreed to the published version of the manuscript.
This work was supported by National Key Research and Development Program of China (No.2018YFF0212201).
Institutional Review Board Statement
Informed Consent Statement
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.
Chen, M.; Tang, X.; Zeng, Z.; Liu, S. An efficient heuristic algorithm for two-dimensional rectangular packing problem with central rectangle. J. Ind. Manag. Optim.2020, 16, 495. [Google Scholar] [CrossRef]
He, K.; Ji, P.; Li, C. Dynamic reduction heuristics for the rectangle packing area minimization problem. Eur. J. Oper. Res.2015, 241, 674–685. [Google Scholar] [CrossRef]
Chen, M.; Wu, C.; Tang, X.; Peng, Z.; Liu, S. An efficient deterministic heuristic algorithm for the rectangular packing problem. Comput. Ind. Eng.2019, 137, 106097. [Google Scholar] [CrossRef]
Leung, T.W.; Chan, C.K.; Troutt, M.D. Application of a mixed simulated annealing-genetic algorithm heuristic for the two-dimensional orthogonal packing problem. Eur. J. Oper. Res.2003, 145, 530–542. [Google Scholar] [CrossRef]
Bortfeldt, A. A genetic algorithm for the two-dimensional strip packing problem with rectangular pieces. Eur. J. Oper. Res.2006, 172, 814–837. [Google Scholar] [CrossRef]
Bansal, J.C.; Deep, K. A modified binary particle swarm optimization for knapsack problems. Appl. Math. Comput.2012, 218, 11042–11061. [Google Scholar] [CrossRef]
Zhu, Y.; Luo, Y.; Tan, K.C.; Qiu, X. An intelligent packing programming for space station extravehicular missions. IEEE Comput. Intell. Mag.2017, 12, 38–47. [Google Scholar] [CrossRef]
Aljarah, I.; Faris, H.; Mirjalili, S. Optimizing connection weights in neural networks using the whale optimization algorithm. Soft Comput.2018, 22, 1–15. [Google Scholar] [CrossRef]
Khalilpourazari, S.; Khalilpourazary, S. Optimization of time, cost and surface roughness in grinding process using a robust multi-objective dragonfly algorithm. Neural Comput. Appl.2020, 32, 3987–3998. [Google Scholar] [CrossRef]
Salgotra, R.; Singh, U. The naked mole-rat algorithm. Neural Comput. Appl.2019, 31, 8837–8857. [Google Scholar] [CrossRef]
Kaur, K.; Singh, U.; Salgotra, R. An enhanced moth flame optimization. Neural Comput. Appl.2020, 32, 2315–2349. [Google Scholar] [CrossRef]
Baker, B.S.; Coffman, E.G., Jr.; Rivest, R.L. Orthogonal packings in two dimensions. SIAM J. Comput.1980, 9, 846–855. [Google Scholar] [CrossRef]
Fırat, H.; Alpaslan, N. An effective approach to the two-dimensional rectangular packing problem in the manufacturing industry. Comput. Ind. Eng.2020, 148, 106687. [Google Scholar] [CrossRef]
Araujo, L.J.P.; Panesar, A.; Ozcan, E.; Atkin, J.; Baumers, M.; Ashcroft, I. An experimental analysis of deepest bottom-left-fill packing methods for additive manufacturing. Int. J. Prod. Res.2019, 58, 6917–6933. [Google Scholar] [CrossRef]
Liu, D.; Teng, H. An improved BL-algorithm for genetic algorithm of the orthogonal packing of rectangles. Eur. J. Oper. Res.1999, 112, 413–420. [Google Scholar] [CrossRef]
Burke, E.K.; Kendall, G.; Whitwell, G. A new placement heuristic for the orthogonal stock-cutting problem. Oper. Res.2004, 52, 655–671. [Google Scholar] [CrossRef]
Yang, J. Two-dimensional irregular parts packing with genetic algorithm. J. Comput. Des. Comput. Graph.2002, 14, 467–470. [Google Scholar]
Hopper, E.; Turton, B.C.H. An empirical investigation of meta-heuristic and heuristic algorithms for a 2D packing problem. Eur. J. Oper. Res.2001, 128, 34–57. [Google Scholar] [CrossRef]
Hopper, E. Two-Dimensional Packing Utilising Evolutionary Algorithms and Other Meta-Heuristic Methods. Ph.D. Thesis, University of Wales, Cardiff, UK, 2000. [Google Scholar]
Burke, E.K.; Kendall, G.; Whitwell, G. A simulated annealing enhancement of the best-fit heuristic for the orthogonal stock-cutting problem. INFORMS J. Comput.2009, 21, 505–516. [Google Scholar] [CrossRef]
He, K.; Huang, W.; Jin, Y. An efficient deterministic heuristic for two-dimensional rectangular packing. Comput. Oper. Res.2012, 39, 1355–1363. [Google Scholar] [CrossRef]
Wei, L.; Zhu, W.; Lim, A.; Chen, X. An adaptive selection approach for the 2D rectangle packing area minimization problem. Omega2018, 80, 22–30. [Google Scholar] [CrossRef]
The statements, opinions and data contained in the journal Applied Sciences are solely
those of the individual authors and contributors and not of the publisher and the editor(s).
MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.
The statements, opinions and data contained in the journals are solely
those of the individual authors and contributors and not of the publisher and the editor(s).
MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.