## 4 Combined Optimization of UAV Location, User Pairing, and Power Allocation
### UAV Transmission Power Optimization  
In the optimization subproblem of transmission power, considering the given UAV caching strategy, UAV location, and NOMA user pairing, the optimization of the transmission power \(p_{n,m}\) allocated by UAV to each user is formulated as:  
\[\begin{array}{l}\text{P4.1}\max\limits_{p_{n,m}}U_{cache}+\sum\limits_{m=1}^{M} \sum\limits_{n=1}^{N_{m}}(1-\mu)T\cdot v_{chur}-(\sum\limits_{m=1}^{M}\sum \limits_{n=1}^{N_{m}}p_{n,m}\tau_{n,m}+P_{chur}(1-\mu)T)\cdot v_{uav}\\ s.t.\sum\limits_{m=1}^{M}\sum\limits_{n=1}^{N_{m}}p_{n,m}=P_{\max}\\ \text{where }U_{cache}=\sum\limits_{m=1}^{M}\sum\limits_{n=1}^{N_{m}} \sum\limits_{f\in\mathcal{F}_{t}}c_{\kappa,f}q_{m,n,f}v_{cache}-\sum\limits_{ \kappa=1}^{2}\sum\limits_{f\in\mathcal{F}}c_{\kappa,f}v_{\kappa,f}\text{ represents the caching revenue}\\ \text{of the UAV. The total duration of UAV charging for users is denoted }(1-\mu)T\), with \((1-\mu)T=T-\max\limits_{m=1,...,M}\{\tau_{1,m},\tau_{2,m}\}\).  
From the optimization objective, it can be observed that due to varying channel conditions, each user obtains different throughput within the time duration \(T\), resulting in different file transmission durations and consequently influencing the proportion of communication service time in the total service cycle. To maximize UAV revenue, it is necessary to minimize the transmission task time for all users and reduce the proportion of communication service time. Therefore, by allocating power from UAV to users, the maximum communication time is minimized, i.e., minimizing the maximum transmission delay for all users requesting files. The optimization problem can be formulated as:  
\[\min\limits_{m=1,\ldots,M}\{\tau_{1,m},\tau_{2,m}\} \tag{21}\]  
From the expression of the transmission delay \(\tau_{t,m}=\frac{Q}{R_{t,m}}\), it is evident that the problem of minimizing the maximum delay in the above equation can be transformed into the problem of maximizing the minimum user transmission rate. Consequently, its formula can be represented as follows:  
\[\max\limits_{m=1,\ldots,M}\{R_{1,m},R_{2,m}\} \tag{22}\]  
It is noted that the problem of maximizing the minimum rate is equivalent to the max-min fairness (MMF) problem. Therefore, the original problem can be addressed by solving the MMF problem. Under the consideration of average channel bandwidth allocation and the determination of NOMA user pairing (where a NOMA user group consists of two users), the transmission rate \(R_{n,m}\) allocated by the UAV to users is given by (7) and (8). Thus, the MMF problem can be expressed as the following power allocation problem:  
\[ \begin{array}{l}\max\limits_{p_{1},p_{2}}\min\limits_{m=1,\ldots,M}\{R_{1,m }(p_{1,m},p_{2,m}),R_{2,m}(p_{1,m},p_{2,m})\}\\ s.t.\ \mathbf{0}\leq\boldsymbol{p}_{1}\leq\boldsymbol{p}_{2}\\ \sum_{m=1}^{M}\left(p_{1,m}+p_{2,m}\right)\leq P_{\max}\end{array}  \tag{23}\]  
where \(\boldsymbol{p}_{1}=\{p_{1,m}\}_{m=1}^{M}\) and \(\boldsymbol{p}_{2}=\{p_{2,m}\}_{m=1}^{M}\). However, as the optimization problem mentioned above is non-convex, its optimal solution can only be identified in the special scenario of a single channel [23; 24; 25]. To address this challenge, an auxiliary variable \(p=\{p_{m}\}_{m=1}^{M}\) is introduced, where \(p_{m}\) denotes the power budget of the UAV for channel \(m\), with \(p_{1,m}+p_{2,m}=p_{m}\). Assuming the power budget \(\{p_{m}\}_{m=1}^{M}\) for each channel is given, the original optimization problem can be decomposed into subproblems for each channel \(m\). The specific optimization problem for each channel \(m\) is formulated as:  
\[ \begin{array}{l}\max\limits_{p_{1,m},p_{2,m}}\min\{R_{1,m}(p_{1,m},p_{2,m}),R_{2,m}(p_{1,m},p_{2,m})\}\\ s.t.\ 0\leq p_{1,m}\leq p_{2,m}\\ p_{1,m}+p_{2,m}=p_{m}\end{array}  \tag{24}\]  
Substituting the user transmission rate \(R_{n,m}\) given by (7) and (8) into the aforementioned subproblem for solution, the optimal solution \(p_{1,m}^{*},p_{2,m}^{*}\) for this subproblem can be obtained.