## 3 Trajectory Optimization Design
### Adaptive Genetic Algorithm
#### 2.2.2 Mutation Operation  
Figure 4: Roulette selection diagram.  
Figure 5: Cross and mutation principle of genetic algorithms.  
In the process of genetic algorithm operation, mutation takes an important role in restoring the population diversity and ensuring the global convergence of the algorithm. The mutation is an operation that randomly changes a certain bit in the individual coding with a small probability, which is usually set to 0.001-0.1. That is to say, it randomly replaces one of the bits 0 into 1 or replaces 1 with 0 in the binary coding. The principle of the mutation operation is shown in Figure 5.  
(4) Termination Condition  
The selection of the termination condition of the genetic algorithm is very important in the genetic algorithm. Improper selection of the termination condition will make the genetic algorithm convergence to the local best and make genetic algorithm early-maturing. The termination condition of the genetic algorithm is set according to the precision of the working time of the pickup manipulator and the requirement for rapid convergence in this work. In order to avoid converging to the local best, the maximum evolution algebra selected is set to 50 after multiple experiments.  
(5) Adaptive Dynamic Adjustment  
For the adaptive genetic algorithm, the adaptive genetic algorithm proposed by [PERSON] et al. can dynamically adjust the value of \(p_{c}\) and \(p_{m}\) according to the fitness value [26]. In the traditional genetic algorithm, the crossover probability and the mutation probability are fixed. So it is difficult to adapt to the dynamic changes of the individual population and makes the search convergence and stability of the algorithm worse. In order to improve the optimization performance of the genetic algorithm, a cosine adaptive function is used to dynamically adjust the cross and mutation probability, as shown in the formula (22)-(23):  
\[p_{c}=\left\{\begin{array}{ll}\frac{p_{c1}+p_{c2}}{2}+\frac{(p_{c1}-p_{c2}) }{2}\cos(\frac{f-f_{avg}}{f_{\max}-f_{avg}}\pi),&f\geq f_{avg}\\ p_{c1},&f<f_{avg}\end{array}\right., \tag{22}\]  
\[p_{m}=\left\{\begin{array}{ll}\frac{p_{m1}+p_{m2}}{2}+\frac{(p_{m1}-p_{m2})}{ 2}\cos(\frac{f^{\prime}-f_{avg}}{f_{\max}-f_{avg}}\pi),&f^{\prime}\geq f_{avg} \\ p_{m1},&f^{\prime}<f_{avg}\end{array}\right., \tag{23}\]  
In the formula, \(p_{c1}\) is the cross probability when the individual fitness is the smallest, \(p_{c2}\) is the cross probability when the individual fitness is the largest. \(p_{m1}\) is the mutation probability when the individual fitness is the smallest, and \(p_{m2}\) is the mutation probability when the individual fitness is the largest.  
Figure 6 shows the cross and mutation probability adjustment curve made by the cosine adaptive function. When the individual fitness is greater than the average fitness and is nearby, the cosine curve declines gradually and improves the cross and mutation probability in the adjustment process. It is beneficial to promote the change of the genetic structure of the individual and improve the ability of the global search in the population. When the individual fitness is near the maximum fitness value, the cosine curve is also smooth and reduces the probability of cross and mutation. It is beneficial to retain the excellent individual gene structure and promote the evolution direction of the population. In addition, when the individual fitness in the population is smaller than the current average fitness, the individual maintains the maximum crossover and mutation probability. It is conducive to expanding the diversity of the population and improving the overall optimization ability. In general, the optimization of the genetic algorithm by the cosine adaptive function is beneficial to improve the time optimization ability of the algorithm for the trajectory planning of the pickup manipulator. In the cosine adaptive function of the crossover and mutation probability, take \(p_{c1}=0.7\), \(p_{c2}=0.1\), \(p_{m1}=0.08\), \(p_{m2}=0.01\) according to experience and repeated experiments.