# Resource Allocation of UAV-Assisted IoT Node Secure Communication System
## 3 Proposed Optimization Algorithm
### Overall Algorithm  
\(P_{1,1}\) is solved by the BCD and SCA method with the overall iterative solution in Algorithm 1. The convergence analysis of the proposed iterative algorithm is carried out as below. Let \(R(\mathbf{P},\Xi,\mathbf{Q})\), \(R_{p}(\mathbf{P},\Xi,\mathbf{Q})\), \(R_{\xi}(\mathbf{P},\Xi,\mathbf{Q})\), and \(R_{q}(\mathbf{P},\Xi,\mathbf{Q})\) denote the objective value of \(P_{1,1}\), \(P_{2}\), \(P_{3}\), and \(P_{4}\) for given conditions, respectively.  
\[R(\mathbf{P}^{m},\Xi^{m},\mathbf{Q}^{m})\leq R_{p}(\mathbf{P}^{m+1},\Xi^{m}, \mathbf{Q}^{m})=R(\mathbf{P}^{m+1},\Xi^{m},\mathbf{Q}^{m}) \tag{22}\]  
```
1. Setting: \(T\), \(N\), \(E_{min}\), \(E_{sen}\), \(V_{max}\), \(P_{max}\), \(\mathbf{q}_{0}\), \(\mathbf{q}_{F}\), and the tolerance error \(\epsilon\)
2. Initialization: The iteration index \(m=1\), \(\mathbf{q}^{m}[n]\).
3. Repeat: \(\mathbf{3.1}\). Calculate \(p^{opt}[n]\) according to (12) with the given \(\mathbf{q}^{m}[n],\xi[n]\). Update \(\mu\), \(\omega\), \(f_{k}\), \(\lambda_{k}\) by the subgradient algorithm
3.2. Calculate \(\xi^{opt}[n]\) according to (19) with the given \(\mathbf{q}^{m}[n],p^{opt}[n]\). Update \(l_{k}\), \(v\) and \(m_{k}\) by the subgradient algorithm
3. Solve P3 by CVX with given \(p^{opt}[n]\) and \(\xi^{opt}[n]\) if \(\sum m-\sum m-1\leq\epsilon\) where \(\sum m=\sum_{n=1}^{N}\tau[n]\) Break; else Update the iterative number \(m=m+1\); End if Until \(\sum m-\sum m-1\leq\epsilon\)
4. Obtain solutions:\(p^{opt}[n]\), \(\xi^{opt}[n]\) and \(\mathbf{q}^{opt}[n]\)
```  
**Algorithm 1** Alternative optimization algorithm for P1.1  
Similarly, with the given \(\mathbf{P}^{m+1}\) and \(\mathbf{Q}^{m}\), we obtain the optimal solution for \(\Xi\) by (17), then  
\[R(\mathbf{P}^{m+1},\Xi^{m},\mathbf{Q}^{m})\leq R_{\xi}(\mathbf{P}^{m+1},\Xi^ {m},\mathbf{Q}^{m})\leq R_{\xi}(\mathbf{P}^{m+1},\Xi^{m+1},\mathbf{Q}^{m})=R( \mathbf{P}^{m+1},\[PERSON]^{m+1},\mathbf{Q}^{m}) \tag{23}\]  
where \(\Xi^{m+1}\) is the optimal PSR of \(DN\) and \(ENs\) by (19). Since Taylor expansion is tight, it follows  
\[R(\mathbf{P}^{m+1},\[PERSON]^{m+1},\mathbf{Q}^{m})=R_{q}(\mathbf{P}^{m+1},\[PERSON]^{m+1},\mathbf{Q}^{m}) \tag{24}\]  
Then for the given feasible \(\mathbf{P}^{m+1},\[PERSON]^{m+1}\), it follows  
\[R_{q}(\mathbf{P}^{m+1},\[PERSON]^{m+1},\mathbf{Q}^{m})\overset{(a)}{\leq}R_{q}( \mathbf{P}^{m+1},\[PERSON]^{m+1},\mathbf{Q}^{m+1})\overset{(b)}{\leq}R(\mathbf{P}^{ m+1},\Xi^{m+1},\mathbf{Q}^{m+1}) \tag{25}\]where (a) holds since problem P4 is solved optimally with solution \(\mathbf{P}^{m+1}\), \(\Xi^{m+1}\), and (b) holds since the objective value of \(P_{4}\) is the lower bound of the original problem. Based on (22)-(25), we can obtain that  
\[R(p^{m},\xi^{m},q^{m})\leq R(p^{m+1},\xi^{m+1},q^{m+1}) \tag{26}\]  
Equation (26) indicates that the objective value of \(P_{1,1}\) does not decrease after each iteration, which guarantees the convergence of the algorithm. Let \(L_{1}\) and \(L_{2}\) denote the number of iterations required for the outer loop and the inner loop of the proposed algorithm, respectively, and the total complexity of ours is \(\mathcal{O}\left[L_{1}L_{2}N^{3}\right]\). Compared with the algorithm complexity \(\mathcal{O}\left[L_{1}\left(N+\frac{1}{\xi^{2}}+L_{2}N^{3}\right)\right]\) provided by the baseline [10], the complexity of our proposed method is much lower.