# A Low Complexity Persistent Reconnaissance Algorithm for FANET
## 3 Algorithm Description
### PSO-Based TARFC  
The PSO algorithm is suitable for solving unconstrained optimization problems such as Equation (7). Hence, in order to use our PSO-based TARFC algorithm, the Lagrange Multiplier and Karush-Kuhn-Tucker (KKT) methods [33] are employed to transform the  
Figure 3: Flow chart of rudimentary PSO algorithm. constrained problem (5) into an unconstrained one. Thus, the reformulated problem is defined as  
\[ \begin{array}{c}\underset{(x_{i},v_{i})\in\mathbb{N},\forall x_{i}\in V}{\text{ maximize}}\quad\widetilde{f}\big{(}X_{V},\{\varepsilon_{m}\}_{m\in M},\varphi(x),r_{thr}, \rho\big{)}\\ \varepsilon_{m}\subset V,\forall m\in M\end{array}  \tag{10}\]  
As shown in Equation (11), \(\widetilde{f}\) is then obtained by converting the constraints into penalty terms and adding them to the objective function:  
\[ \begin{array}{l}\widetilde{f}\big{(}X_{V},\{\varepsilon_{m}\}_{m\in M}, \varphi(x),r_{thr},\rho\big{)}\\ =f\big{(}X_{V},\{\varepsilon_{m}\}_{m\in M},\varphi(x),r_{thr},\rho\big{)}\\ +\underset{m\in M}{\sum}\zeta_{m}\Bigg{(}\max_{k=1,\ldots,|\rho_{m}|-1}\delta \Big{(}\rho_{m}^{k},\rho_{m}^{k+1}\Big{)}-r^{\zeta}\Big{]}^{+}\Bigg{)}^{2}\\ +\xi\Bigg{(}\Bigg{(}r^{S}-\underset{u,v\in M\cup R}{\text{min}} \delta(u,v)\Bigg{)}^{+}\Bigg{)}^{2}\end{array}  \tag{11}\]  
Note that \(\zeta_{m}\) and \(\varsigma\) are negative penalty coefficients corresponding to the end-to-end communication constraint and the safety requirement, respectively. \([\bullet]^{+}\) stands for \(\max\{0,\bullet\}\), which means that if the communication distance and safety distance between two UAVs meet the corresponding constraints, then the penalty term takes the value of zero. The particle \(i\)'s individual pBest and the gBest are defined as \(x_{i}^{*}\) and \(x^{*}\), and the solution \(x^{*}\) that maximizes the \(\widetilde{f}\) would be the answer for the problem (5). Algorithm 1 describes the PSO-based TARFC algorithm in full. Lines 1-4 are the preliminary stage. We first establish some fundamental characteristics (line 1). Then, we set all particles' velocities to zero and their positions to random numbers evenly distributed over the defined simulation space. After that, we initialize all particles whose positions are to be random numbers uniformly distributed in the defined space of the problem (10) and whose velocities are to be all zeros. When the first time the particle \(i\) is initialized, its position automatically becomes its pBest position \(x_{i}^{*}\), and the routing function \(\{\rho_{m}\}_{i}^{*}\) determines its corresponding routing paths (lines 2-4). Following initialization, we identify the particle with the highest penalized performance metric value (since we defined \(\zeta_{m}\) and \(\varsigma\) are negative penalty coefficients). Then, change the particle \(g\)'s pBest position \(x_{g}^{*}\) to the gBest position \(x^{*}\), and its corresponding routing paths \(\{\rho_{m}\}_{g}^{*}\) are also changed as the gBest position's routing path \(\{\rho_{m}\}^{*}\). In the iterative stage (lines 5-19), we first obtain the current location of the ACP and mission-execution UAVs, \(X_{A}\) and \(X_{M}\), as well as the latest threat PDF, \(\varphi(x)\), in the scenario. Guided by the above, relay UAVs' velocity, position, routing, and other attributes are updated periodically. To be more specific, the particles' position and speed are changed stochastically based on both their unique pBest position and the overall gBest position as  
\[ \begin{bmatrix}\mathbf{x}^{l+1}\\ \mathbf{v}^{l+1}\end{bmatrix} = \begin{bmatrix}1-c_{1}\mathbf{u}_{1}-c_{2} \mathbf{u}_{2}&w\\ -c_{1}\mathbf{u}_{1}-c_{2}\mathbf{u}_{2}&w\end{bmatrix}\begin{bmatrix}\mathbf{x }^{l}\\ \mathbf{v}^{l}\end{bmatrix} +\mathbf{I}_{2}[c_{1}\mathbf{u}_{1}+c_{2}\mathbf{u}_ {2}] \begin{bmatrix}\mathbf{p}^{l}\\ \mathbf{g}^{l}\end{bmatrix}  \tag{12}\]  
The index \(l\) in Equation (12) is the algorithm's \(l\)th iteration. Both \(\mathbf{u}_{1}\) and \(\mathbf{u}_{2}\) are uniformly distributed random vectors.