## 3 UAV Path Planning Method Based Modified Fruit Fly Optimization Algorithm
### Msfoa
#### 3.1.3 Competitive Strategies of Offspring  
In order to avoid multi-swarm falling into local optimum, each swarm is independent in visual search and olfaction search, while the information exchange occurs in the competition of offspring, which is explained in detail below. In this way, not only can the multi-swarms not get into the local optimum at the same time, but also the information exchange between the species cannot be guaranteed. The competition strategy of the offspring uses the optimal individual to cross with other flies at random to generate a new swarm at the same scale and select a new optimal individual. That is, the swarm in the same number has two optimal individuals, one comes from the old swarm, the other from the new swarm. The optimal solution of the swarm is obtained after competition between two optimal individuals. The effect of this method is when fruit fly A is near the optimal solution but its smell concentration is high, but the individual from A hybridized with random fruit fly B has the path information of both fruit fly A and B; the path information of the fruit fly can be obtained by distributing the weight of the path data of the two flies. This strategy can increase the probability that the fruit fly near the optimal solution will be selected by the algorithm. The procedure for generating the \(i\)-th new individual of the \(g\)-th swarm is as follows:  
\[\left\{ \begin{array}{c}S^{(g)}_{\text{old, }i}=\sqrt{\left(X^{(g)}_{i}\right)^{2}+ \left(Y^{(g)}_{i}\right)^{2}}\\ \textit{s}\textit{mell}^{(g)}_{\text{old, }i}=F(S^{(g)}_{\text{old, }i})\end{array} \right. \tag{11}\]  
\[\textit{Index}^{(g)}_{\text{old}}=\underset{i}{\text{argmin}}(\textit{s} \textit{mell}^{(g)}_{\text{old, }i}) \tag{12}\]  
\[x^{(g)}_{\text{oldbest}}=X^{(g)}_{\textit{Index}^{(g)}_{\text{old}}}y^{(g)}_{ \text{oldbest}}=Y^{(g)}_{\textit{Index}^{(g)}_{\text{old}}} \tag{13}\]  
\[X^{(g)}_{\text{new, }i}=\textit{c}\textit{e}_{1}*x^{\text{random}(1,G)}_{ \text{oldbest}}+\textit{c}\textit{e}_{2}*X^{(g)}_{i}y^{(g)}_{\text{new, }i}=\textit{c}\textit{e}_{1}*y^{\text{random}(1,G)}_{\text{oldbest}}+\textit{c} \textit{e}_{2}*Y^{(g)}_{i} \tag{14}\]  
where \(\text{random}(1,\ G)\) produces random integers between 1 and \(G\). \(X^{(g)}_{\text{new, }i}\) and \(Y^{(g)}_{\text{new, }i}\) mean the position of the \(i\)-th fly in the \(g\)-th new swarm. \(\textit{c}\textit{e}_{1}\) and \(\textit{c}\textit{e}_{2}\) are the weights of parental path data, satisfying:  
\[\textit{c}\textit{e}_{1}+\textit{c}\textit{e}_{2}=1 \tag{15}\]  
The calculation of best smell concentration is given by:  
\[\left\{ \begin{array}{c}S^{(g)}_{\text{new, }i}=\sqrt{\left(X^{(g)}_{\text{new, }i}\right)^{2}+\left(Y^{(g)}_{\text{new, }i}\right)^{2}}\\ \textit{s}\textit{mell}^{(g)}_{\text{new, }i}=F(S^{(g)}_{\text{new, }i}) \end{array} \right. \tag{16}\]  
\[\textit{Index}^{(g)}_{\text{new}}=\underset{i}{\text{argmin}}(\textit{s} \textit{mell}^{(g)}_{\text{new,}i}) \tag{17}\]  
Then all the fruit flies in every swarm fly to the point with the minimum smell concentration of each swarm. If the smell concentration of the offspring is less than the smell concentration of their parent (\(\textit{s}\textit{mell}^{(g)}_{\text{new, }\textit{Index}^{(g)}_{\text{new}}}<\textit{s} \textit{mell}^{(g)}_{\text{old, }\textit{Index}^{(g)}_{\text{old}}}\)), then:  
\[\left\{ \begin{array}{c}x^{(g)}_{\text{best}}=X^{(g)}_{\text{new, }\textit{Index}^{(g)}_{\text{new}}}\\ y^{(g)}_{\text{best}}=Y^{(g)}_{\text{new, }\textit{Index}^{(g)}_{\text{new}}}\\ \textit{s}\textit{mell}^{(g)}_{\text{best}}=\textit{s}\textit{mell}^{(g)}_{ \text{new, }\textit{Index}^{(g)}_{\text{new}}}\end{array} \right. \tag{18}\]  
\[\text{Otherwise (\textit{s}\textit{mell}^{(g)}_{\text{old, }\textit{Index}^{(g)}_{\text{old}}}< \textit{s}\textit{mell}^{(g)}_{\text{new, }\textit{Index}^{(g)}_{\text{new}}}<\textit{s}\textit{mell}^{(g)}_{\text{best }}):}\]  
\[\left\{