# An Improved Adaptive Genetic Algorithm for Two-Dimensional Rectangular Packing Problem
## 3 Improved Adaptive Genetic Algorithm
### 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 [PERSON] 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 [PERSON] 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 [PERSON] and [PERSON], this paper proposes an improved method called hybrid adaptive genetic algorithm (HAGA) to solve the 2 DRP problem. The adaptive description of the crossover probability is as follows:  
\[P_{c}(t)=P_{c2}+(P_{c1}-P_{c2})\frac{1-e^{-ct}}{1+e^{-ct}},t\geq 0 \tag{2}\]  
\[P_{c}(f^{\prime})=\left\{ \begin{array}{ll}P_{c1}-\frac{(P_{c1}-P_{c2})(f^{ \prime}-f_{avg})}{f_{\max}-f_{avg}}&,f^{\prime}\geq f_{avg}\\ P_{c1}&,f^{\prime}<f_{avg}\end{array} \right. \tag{3}\]  
\[P_{c}=\lambda P_{c}(t)+(1-\lambda)P_{c}(f^{\prime}) \tag{4}\]  
where \(P_{c1}\) and \(P_{c2}\) are the upper bound and lower bound of \(P_{c}\). In general, the recommended parameters for these two crossover probabilities are 0.9 and 0.6 respectively [36]; i.e., \(P_{c1}=0.9\) and \(P_{c2}=0.6\). 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 of the \((1-e^{-ct})/(1+e^{-ct})\) function, and \(c=0.2\) in the experiment.