# Joint Trajectory and Communication Design for Buffer-Aided Multi-UAV Relaying Networks
## 3 The Proposed Algorithm
### Overall Algorithm and Convergence  
In summary, the proposed algorithm can apply the block coordinate descent method to find a suboptimal solution of Problem (18) with alternately solving the two sub-problems (25) and (32) in an iterative manner. Specifically, we divide the entire optimization variables in the original problem (18) into three blocks, i.e., the relay selection \(A\), UAV transmit power \(P\), and UAV trajectory \(Q\). Then, we alternately optimize the two sub-problems (25) and (32) to obtain the optimal solutions of block variables \(A\), \(P\), and \(Q\). Algorithm 1 details the steps of the proposed algorithm, in which \(R^{l}=f\left(A^{l},P^{l},Q^{l}\right)\) is the objective value of Problem (18) with variables \(A^{l}\), \(P^{l}\), and \(Q^{l}\) in iteration \(l\), and \(\varepsilon\) is defined as the accuracy of convergence, \(\varepsilon>0\). ```
1:initialization: Set the initial feasible solution \(\left\{A^{0},P^{0},Q^{0}\right\}\). Set the accuracy tolerance \(\varepsilon\), the iteration number \(l=0\), and \(R^{l}=f\left(A^{l},P^{l},Q^{l}\right)\). 2:repeat
3: Solve Problem (25) with given \(A^{l},P^{l},Q^{l}\) and feasible solution \(a_{k,D}^{f}\left[n\right]=a_{k,D}\left[n-1\right]\), \(u_{k,D}^{f}\left[n\right]=u_{k,D}\left[n-1\right]\), and find the optimal solution \(\left\{A^{l+1},P^{l+1}\right\}\). 4: Solve Problem (32) with given \(\left\{A^{l+1},P^{l+1},Q^{l}\right\}\) and feasible solution \(t_{k,m}^{f}\left[n\right]=t_{k,m}\left[n-1\right]\), and find the optimal solution \(\left\{A^{l+1},P^{l+1},Q^{l+1}\right\}\). 5: Update \(l=l+1\). 6:until\(\frac{R^{l}-R^{l-1}}{R^{l}}\leq\varepsilon\). ```  
**Algorithm 1** Proposed joint relay selection, power allocation, and trajectory optimization algorithm. Next, we show the convergence of the proposed algorithm. Let us define \(R_{A,P}^{lb,l}\left(A,P,Q\right)=R_{A,P}^{l}\) and \(R_{Q}^{lb,l}\left(A,P,Q\right)=R_{Q}^{l}\) as the objective value of Problem (25) and (32) based on A, P, and Q, respectively. In general, we consider a bounded function that is non-negative monotonic and undiminished to be convergent. First, it is obvious that the objective values we solve are all non-negative. For given \(A^{l}\), \(P^{l}\), and \(Q^{l}\), the details of obtaining the optimal solution of (25) in Step 3 can be written as [26]:  
\[R\left(A^{l},P^{l},Q^{l}\right)\overset{(a)}{=}R_{A,P}^{lb,l}\left(A^{l},P^{l },Q^{l}\right)\overset{(b)}{\leq}R_{A,P}^{lb,l}\left(A^{l+1},P^{l+1},Q^{l} \right)\overset{(c)}{\leq}R\left(A^{l+1},P^{l+1},Q^{l}\right) \tag{33}\]  
where \(R\left(A^{l},P^{l},Q^{l}\right)\) is the pre-defined initial solution of Problem (18). Since Inequality (23) is obtained by the first-order [PERSON] expansion approximation of the objective function, it has the same optimal solution and optimal objective value as the original problem at \(\left\{A^{l},P^{l}\right\}\). Therefore, Equation \((a)\) is satisfied. For given \(\left\{A^{l},P^{l},Q^{l}\right\}\), \(\left\{A^{l+1},P^{l+1}\right\}\) is the optimal solution for Problem (25), so Inequation \((b)\) holds. According to the previous discussions, Problem (25) provides a lower bound solution for Problem (19) at \(\left\{A^{l+1},P^{l+1}\right\}\); hence, Inequation \((c)\) is established. According to the inequality in (33), although Problem (25) is an approximate optimal problem for obtaining the relay selection and UAV transmit power, the objective value of the original Problem (18) is still non-decreasing.