# The Path Planning of Mobile Robots Based on an Improved Genetic Algorithm
## 3 Improved Genetic Algorithm
### Improved Crossover Strategy  
In traditional genetic algorithms, crossover operations typically involve a fixed number of crossover points and randomly selected parents. This fixed crossover point approach lacks flexibility. In the early stages of the algorithm, strong exploration capabilities are usually needed to broaden the search space, whereas in the later stages, more refined exploitation capabilities are required to fine-tune the solution. Fixed crossover points do not meet these dynamic needs. Additionally, the completely random selection of parents may lead to the crossover of individuals with significantly different fitness levels, which can dilute or even destroy superior genes with superior ones, thereby reducing the quality of new individuals and hindering the algorithm's evolution toward the optimal solution. To address these issues, this paper proposes adaptive crossover point numbers and dynamic threshold selection. The adaptive number of crossover points is determined by the following formula:  
\[\text{P}=\text{floor}(\text{n}_{\text{max}}*\cos\left(\frac{\text{t}-1}{ \text{T}}\right)*\frac{\pi}{2}) \tag{4}\]  
where P is the number of crossover points; floor is the floor function (which rounds down to the nearest integer), \(n_{max}\) is the maximum number of crossover points, t is the current iteration number, and T is the maximum number of iterations. To promote the rapid convergence of the population and improve the quality of offspring, when selecting parents, the first parent is chosen from the top 30% of individuals based on fitness rankings, while the second parent is selected randomly. However, the difference in fitness values between these two parents must satisfy the following formula:  
\[\Delta\text{F}\in\left[0,\Delta\text{F}_{\text{H}}\right] \tag{5}\]  
\[\Delta\text{F}_{\text{H}}=\Delta\text{F}_{\text{max}}*\left(0.7+0.3*\cos \left(\frac{t-1}{T-1}\right)*\frac{\pi}{2}+\alpha(\text{CV})\right) \tag{6}\]  
where \(\Delta\text{F}\) is the fitness difference between the two parents, \(\Delta F_{H}\) is the upper limit of the threshold, \(\Delta F_{max}\) is the maximum fitness difference in the current iteration, \(\alpha(CV)\) is a function of the coefficient of variation CV, 0.7 is the base threshold to ensure that individuals with lower fitness have a chance to participate in crossover in the early stages, maintaining the diversity of the population, and 0.3 is the dynamic adjustment coefficient, which gradually tightens the selection criteria as iterations progress, avoiding premature strict selection or the participation of individuals with large fitness differences in crossover, thereby ensuring the quality of the population. When the fitness values of the population individuals are too dispersed, it leads to a large number of individuals failing to meet \(\Delta\text{F}\in\left[0,\Delta F_{H}\right]\), thereby reducing population diversity. On the other hand, if the fitness is too concentrated, a large number of individuals will easily satisfy \(\Delta\text{F}\in\left[0,\Delta F_{H}\right]\), causing individuals with significant fitness differences to participate in crossover, which reduces the quality of the new offspring. To address this, the coefficient of variation CV is introduced in this paper to measure the degree of dispersion of the population's fitness, and its calculation formula is  
\[\text{CV}=\frac{\sqrt{\frac{\sum\limits_{\text{i}=1}^{\text{n}}\left(F_{ \text{i}}-\text{\ }\overline{\text{F}}\right)^{2}}{\overline{\text{F}}}}}{\overline{\text{F}} } \tag{7}\]  
\[\overline{\text{F}}=\frac{\sum\limits_{\text{i}=1}^{\text{n}}F_{\text{i}}}{ \text{n}} \tag{8}\]  
where \(F_{i}\) is the fitness value of the i-th individual, \(\overline{\text{F}}\) is the average fitness value of the individuals after selection in the current iteration, and n is the number of individuals in the population. \(\alpha(\mathrm{CV})\) can adjust \(\Delta\mathrm{F_{H}}\) appropriately based on the population's dispersion.