## 4 Cleaning Plan for Photovoltaic Robot Arm
### Trajectory Optimization of Improved Sparrow Algorithm
#### 4.3.2 Improved Sparrow Algorithm  
In general, the limitations of conventional sparrow algorithms were elucidated as follows. (1) At the population initialization stage, sparrow individuals were generated at random positions in the solution space. Under the good initial position of the randomly generated population, the algorithm was more likely to find the optimal position. In contrast, the optimization efficiency of the algorithm was likely to decline, which cannot ensure the diversity of the population and the stability of the algorithm. (2) The decrease in population diversity at the discoverer and follower stages, as well as the decrease in communication between groups at the vigilance stage, could result in the reduced local search ability of the algorithm [38; 39]. To address the limitation of the algorithm, the Circle chaotic map was introduced to initialize the population and increase the population diversity for improving the quality of the initial solution. The nonlinear weight factor was introduced to enhance the search ability and convergence speed. The position update method of followers and early warnings was adjusted to solve the problem of sparrow algorithm falling into local optima. (1) Improved Circle chaotic map initialization  
The sparrow algorithm was randomly generated during initialization so that the initial solution turned out to be easy to aggregate, the solution space coverage was not high, and the difference between individuals was low. The abovementioned phenomenon can be improved by the chaotic map initialization population. Currently, there are many types of chaotic maps, and Circle maps have been extensively used for their stability and high coverage of chaotic values. However, the chaotic values of the Circle map remained unevenly distributed, and the values between [0.2, 0.6] were denser. The Circle map equation should be optimized to make the chaotic value distribution more uniform [40; 41]. \[x_{n+1}=\text{mod}(2x_{n}+0.5-(\frac{0.7}{2\pi})\sin(2\pi x_{n}),1), \tag{31}\]  
where \(n\) denotes the dimension of the solution, \(x_{n}\in[0,\,1]\). \(n\) was taken as 5000 to display the improvement effect visually and clearly. The optimized initial solution dimension distribution and initial solution dimension distribution histogram are presented below. (3) Updates of leaders, followers and alerters [42]  
By introducing the previous generation of global optimal solution and dynamic weight factor into the leader update equation, the algorithm can avoid falling into local optimum and improve the convergence speed. The optimized equation is as follows:  
\[X_{i,j}^{t+1}=\left\{ \begin{array}{c}(X_{i,j}^{t}+\omega(f_{j,g}^{t}-X_{i,j}^{ t}))\cdot rand,\ R_{2}<ST\\ X_{i,j}^{t}+Q,\ R_{2}\geq ST\end{array} \right., \tag{33}\]  
where \(X_{i,j}^{t}\) We represents the position of the \(i\)th sparrow in the \(j\)th dimension when the number of iterations is \(t\), \(f_{i,j}^{t}\) is the global optimal solution of the \(j\)th dimension in the previous generation, \(Q\) is a random number obeying (0, 1) normal random distribution, \(R_{2}\) represents the warning value, and \(ST\) is the safety value. The iterative equation for follower position is as follows:  
\[X_{i,j}^{t+1}=\left\{ \begin{array}{c}Q\cdot\exp((X_{worst}^{t}-X_{i,j}^{t}) /i^{2}),\ i>\frac{N}{2}\\ X_{p}^{t+1}+\left|X_{i,j}^{t}-X_{p}^{t+1}\right|\cdot A^{+}\cdot L,\ i\leq \frac{N}{2}\end{array} \right., \tag{34}\]  
where \(X_{worst}^{t}\) denotes the position of the sparrow with the worst fitness when the number of iterations is \(t\); \(X_{p}^{t+1}\) represents the position of the sparrow with the best fitness when the number of iterations is \(t+1\). If \(A\) refers to a matrix of 1 row and \(d\) columns, and the respective element is randomly set to 1 or \(-1\), \(A^{+}=A^{T}(AA^{T})^{-1}\), \(N\) represents the population size, \(L\) represents a matrix with 1 row and \(d\) columns, and each element is 1.