## 3 Problem Formulation and Solution  
We minimize the average transmission latency of the network, which is related to locations, beamforming and caching strategies of UAVs. Specifically, the calculation of average latency is  
\[\tau(\mathbf{w},\mathbf{u},\mathbf{z})=\sum\limits_{k=1}^{K}\sum\limits_{j=1}^ {N}p_{k}\left(\frac{z_{0k}L_{k}}{R_{0}}+\sum\limits_{i=1}^{M}q_{ij}\frac{z_{ik} L_{k}}{R_{ij}(\mathbf{w}_{ij},\mathbf{\theta}_{ij})}\right), \tag{9}\]where \(R\) is the data rate, which is related to the beamforming weight \(\mathbf{w}\) and path loss \(\theta\), and \(\theta\) is mapped to UAV locations \(\mathbf{v}\). The system latency consists of two parts: MBS transmission latency and UAV transmission latency. The related latency minimization problem is formulated as follows:  
\[\min_{\mathbf{w},\theta,\mathbf{v},\mathbf{z}} \sum_{k=1}^{K}\sum_{j=1}^{N}p_{k}\Bigg{(}\frac{z_{0k}L_{k}}{R_{0}}+ \sum_{i=1}^{M}q_{ij}\frac{z_{ik}L_{k}}{R_{ij}(\mathbf{w}_{ij},\theta_{ij})} \Bigg{)}, \tag{10a}\] \[\text{where}\;\;R_{ij}=\log_{2}\Bigg{(}1+\frac{|\mathbf{h}_{ij}^{ H}\mathbf{w}_{ij}|^{2}}{\sum\limits_{m\
eq i}\sum\limits_{n\in A_{m},n\
eq j}| \mathbf{h}_{m}^{H}\mathbf{w}_{mn}|^{2}+\sigma^{2}}\Bigg{)}.\] \[\text{\bf s.f.} \sum_{j=1}^{N}||\mathbf{w}_{ij}||^{2}\leq P,\,\forall i\in\mathcal{ M},\] (10b) \[\theta_{ijn_{t}}^{-1}=\sqrt{\left(x_{in_{t_{t}}}-x_{jk}\right)^{ 2}+\left(y_{in_{t_{t}}}-y_{jk}\right)^{2}+H^{2}},\,\forall i\in\mathcal{M}, \forall j\in\mathcal{N},\] (10c) \[\sum_{k=1}^{M}z_{ik}L_{k}\leq L_{\text{max}},\,\forall i\in \mathcal{M},\] (10d) \[z_{0k}+\sum_{i=1}^{M}z_{ik}\geq 1,\,\forall k\in\mathcal{K},\] (10e) \[0\leq z_{ik}\leq 1,0\leq z_{0k}\leq 1,\forall i\in\mathcal{M}, \forall k\in\mathcal{K}. \tag{10f}\]  
Here, inequality (10b) is the power constraint. The transmit power of UAV is limited, and we assume that the maximum power budget of every UAV is \(P\). Equation constraint (10c) reflects the relationship between path loss \(\theta\) and UAV location \(\mathbf{v}\). Inequality (10d) is the capacity constraint of every UAV, ensuring the cached contents are not larger than the capacity \(L_{\text{max}}\). Inequality (10e) represents the content integrity constraint. For all popular content, the data transmitted by MBS should be able to be combined into complete content with the data transmitted by UAVs, as is shown in (10e). Furthermore, (10f) reflects the physical meaning of \(\mathbf{z}\) as the caching proportions. As shown in (10a), caching variable \(\mathbf{z}\), UAV location variable \(\mathbf{v}\) and beamforming variable \(\mathbf{w}\) in the objective function are coupled, which means that it would be quite difficult to solve the problem directly. In order to reduce the complexity of the solution, a step-by-step iterative optimization method is adopted. We fix one of the variables, solve the remaining variables and iteratively solve the original problem. We fix the caching variable \(\mathbf{z}\) first, and the proportion of the content \(k\) cached in UAV\({}_{i}\) is set as \(z_{ik}^{*}\). Then, the optimization problem becomes  
\[\min_{\mathbf{w},\theta,\mathbf{R}} \sum_{k=1}^{K}\sum_{j=1}^{N}\frac{p_{k}q_{ij}z_{ik}^{*}L_{k}}{R_{ ij}}, \tag{11a}\] \[\text{\bf s.f.} \sum_{j=1}^{N}||\mathbf{w}_{ij}||^{2}\leq P,\,\forall i\in\mathcal{ M},\] (11b) \[\min_{\mathbf{w},\theta,\mathbf{v},\mathbf{z}} \sum_{k=1}^{K}\sum_{j=1}^{N}p_{k}\Bigg{(}\frac{z_{0k}L_{k}}{R_{0}}+ \sum_{i=1}^{M}q_{ij}\frac{z_{ik}L_{k}}{R_{ij}(\mathbf{w}_{ij},\theta_{ij})} \Bigg{)}, \tag{10a}\]0 (11c) \[\min_{\mathbf{w},\theta,\mathbf{v},\mathbf{z}} \sum_{k=1}^{K}\sum_{j=1}^{N}p_{k}\Bigg{(}\frac{z_{0k}L_{k}}{R_{0}}+ \sum_{i=1}^{M}q_{ij}\frac{z_{ik}L_{k}}{R_{ij}(\mathbf{w}_{ij},\theta_{ij})} \Bigg{)}, \tag{10a}\]1  
Here, inequality (11c) is the relaxed version of the equality constraint (10c). Since the optimality always occurs at the equality, the relax of the constraint would not cause any loss of generality, and this treatment could reduce the complexity of the problem.