# A Low Complexity Persistent Reconnaissance Algorithm for FANET
## 3 Algorithm Description
### Rudimentary PSO Algorithm  
PSO is a heuristic search algorithm proposed by [PERSON] and [PERSON] [32] in 1995. It is a random search algorithm that simulates biological activities and swarms intelligence in nature. The core idea is to use the information sharing of individuals in the group to guide the group's movement in the problem-solving space. In the process of evolution from disorder to order, a feasible solution to the problem will be obtained. In addition to considering the group activities of simulated organisms, it is a swarm intelligence algorithm integrating individual cognition and social influence.  
Each particle in PSO iterates to improve its location in the simulation space of the optimization problem, selecting the best position thus far as the final solution at the end of the iteration.  
For ease of understanding, we will use the following optimization problem to explain the PSO algorithm:  
\[\underset{x\in\mathbb{R}^{n}}{\text{minimize}}\ \ h(x), \tag{7}\]  
where \(h(\cdot):\mathbb{R}^{n}\mapsto\mathbb{R}\) is called an objective function, \(\mathbb{R}^{n}\) is the simulation space, and \(x\) is the decision variable.  
We suppose that the PSO algorithm operates on a swarm of particles, each of which is represented by its position and velocity, i.e., \((x_{i},v_{i})\in\mathbb{N}\). Each particle's position corresponds to one of the potential solutions to the problem, as was previously mentioned. So, two special parameters emerge: \(pBest\) and \(gBest\). The position that is the \(i\)th particle'spBest, represented by \(p_{i}\), is the best position that the particle has ever achieved. Analogously, the best position among the pBest of all particles is the unique gBest, represented by \(g\). The \(i\)th particle's velocity is updated by adding the stochastically weighted differences between its current position and both its pBest and the gBest, i.e.,  
\[v_{i}^{l+1}=wv_{i}^{l}+c_{1}u_{1}\circ\left(p_{i}^{l}-x_{i}^{l}\right)+c_{2}u_{ 2}\circ\left(g^{l}-x_{i}^{l}\right),\forall(x_{i},v_{i})\in\mathbb{N}, \tag{8}\]  
where \(w\) is the inertia weight, \(c_{1}\) and \(c_{2}\) are individual cognition parameter and social influence parameter, the index \(l\) indicates the PSO algorithm's \(l\)th iteration, both \(u_{1}\) and \(u_{2}\) are independent random vectors on \(\left[0,1\right]^{n}\) with uniform distribution, and the superscript \(n\) represents the dimension of the simulation space.  
In Equation (8), the inertia term controls the velocity's amplitude, while the cognitive and social terms strike a balance between local search and global search. Equation (9), i.e.,  
\[x_{i}^{l+1}=x_{i}^{l+1}+v_{i}^{l+1},\forall(x_{i},v_{i})\in\mathbb{N}, \tag{9}\]  
can be used to determine the new particle position based on the updated velocity.  
The positions of all the particles are updated iteratively in the simulation space by combining their velocities, which are modified in each iteration in accordance with Equation (8). The number of iterations, the swarm's pace of convergence, the algorithm's duration, and other factors can be used as termination conditions. The gBest becomes the top current solution to the unconstrained optimization problem (7) after the PSO algorithm terminates. Figure 3 shows the whole process of the rudimentary PSO algorithm.  
Specifically, for FANETs, each particle in the PSO algorithm represents a complete FANET topology distribution scheme. The particle contains information about the UAVs' position vector, the UAVs' velocity vector, the FANET's connectivity value, each UAV's threat value, and the total performance of the scheme. During each iteration, the position vector of UAVs is updated based on the UAVs' velocity vector in the previous round. The total performance values of all particles are compared, and the following iteration will be performed based on the particle with the best total performance.