## 3 Improved Mayfly Algorithm  
### Traditional Mayfly Algorithm  
The MA is a bionics algorithm derived from the social behavior of the mayfly. Inspired by the movement mode and reproduction process of female and male populations, the optimal and suboptimal individuals in each population are selected. Meanwhile, the optimal offspring generation is obtained through mating between the optimal male and female individuals, and the suboptimal offspring generation is obtained in the same way. The direction of movement of each mayfly is influenced by the dynamics of individual and collective optimal positions, and female mayflies target male mayflies towards their positions. a. The movement of male mayfly  
The flight mode of male mayflies is similar to the movement mode of birds in a particle swarm algorithm, and the direction and distance of male mayflies are adjusted according to their own flight experiences and that of individuals around them. The specific method is shown as follows:  
\[x_{i}^{n+1}=x_{i}^{n}+v_{i}^{n+1} \tag{14}\]  
where \(x_{i}^{n}\) and \(v_{i}^{n}\) are the current position and speed, respectively, of the male mayfly \(i\) on the \(n\)th search. The values are calculated as follows:  
\[v_{ij}^{n+1}=v_{ij}^{n}+\alpha_{1}e^{-\beta_{p}^{2}}(p_{besi_{i}^{i}}-X_{ij}^{ n})+\alpha_{2}e^{-\beta_{g}^{2}}(g_{besi_{i}^{i}}-X_{ij}^{n}) \tag{15}\]  
Because male mayflies perform a dance on the surface of water to attract females, the position of the male mayflies is constantly changing, meaning they do not build a high speed. \(v_{ij}^{n}\) is the speed of the \(n\)th search of the mayfly \(i\) at \(j\) dimension, and \(x_{ij}^{n}\) is the position at that time. \(\alpha_{1}\) and \(\alpha_{2}\) are estimated from the positive attraction coefficients of social interaction, and \(\beta\) is the visibility coefficient of the mayfly. Meanwhile, the optimal locations of the individual and collective mayflies are expressed as \(p_{besi_{i}^{j}}\) and \(g_{besi_{i}^{j}}\) respectively. Additionally, the distances from current position to \(p_{besi_{i}^{j}}\) and \(g_{besi_{i}^{j}}\) are defined as \(l_{p}\) and \(l_{g}\), respectively, and are calculated as follows:  
\[\|x_{i}-X_{i}\|=\sqrt[2]{\sum_{j=1}^{n}(x_{ij}-X_{ij})^{2}} \tag{16}\]  
For the best mayfly in the population, a fixed dance pattern is needed to be maintained. Meanwhile, a random element is introduced to ensure that the speed is constantly changing. The calculation is described in this case as follows:  
\[v_{ij}^{n+1}=v_{ij}^{n}+d\times r \tag{17}\]  
where the dance coefficient is simplified as \(d\), and \(r\) is the random natural number within \([-1,1]\). b. The movement of female mayfly  
The movement of the female mayfly depends on the attraction of the male mayfly, and their position renewal depends on the increase of speed, which can be expressed as follows:  
\[y_{i}^{n+1}=y_{i}^{n}+v_{i}^{n+1} \tag{18}\]  
The speed update is a certain process, which means that in order to ensure the quality of offspring, the best female needs to be attracted by the best male, the second-best female by the second-best male, and so on. The speed update expression is given as follows:  
\[v_{ij}^{n+1}=\left\{ \begin{array}{c}v_{ij}^{n}+\alpha_{2}e^{-\beta_{f}^{2}} (x_{ij}^{n}-y_{ij}^{n})\\ v_{ij}^{n}+g\times r\end{array} \right. \tag{19}\]  
where the position of the female mayfly is expressed as \(y_{ij}^{n}\), the random walk coefficient of the female mayfly is represented as \(g\), and \(l_{f}\) is determined by the distance between the male and female mayflies. c. The mating of male and female mayflies  
In the process of parent mating, the optimal and suboptimal individuals in the male and female populations should be selected for mating and reproduction based on their fitness functions. The results of interbreeding, which produces the optimal and suboptimal offspring, are calculated as follows:  
\[\left\{ \begin{array}{l}\ offspring1=L\times m+(1-L)\times f_{m}\\ offspring2=L\times f_{m}+(1-L)\times m\end{array} \right.