# PPO-Based Joint Optimization for UAV-Assisted Edge Computing Networks
## 3 System Model and Problem Formulation
Define the transmit power as \(p\), the bandwidth as \(B\), and the variance of add white Gaussian noise (AWGN) as \(\sigma^{2}\); then, the maximum transmit rate at UE \(k\) can be expressed as  
\[R_{k}=B\log\left(\frac{p\times 10^{-\frac{\zeta(k)}{10}}}{\sigma^{2}}\right). \tag{7}\]  
From Figure 1, it can be seen that the computational task from generation to completion contains a total of sending delay, propagation delay, waiting delay, and processing delay, which can be expressed by the following equation:  
\[Delay_{total}=Delay_{trn}+Delay_{perp}+Delay_{wait}+Delay_{comp}. \tag{8}\]  
Considering that the range of this edge computing network is usually small and the signal propagation speed is fast, the propagation delay \(Delay_{porp}\) in it is negligible. The sending delay, on the other hand, is determined by the size of the computing task and the sending rate. Suppose that end user \(k\) generates a computation task with task size \(L_{k}\). In the case that the sending rate of the UE \(k\) is \(R_{k}^{UE}\), and the sending rate is \(R_{k}^{UAV}\) when the UAV relays, the sending delay of this computational task can be expressed as  
\[P_{k}^{\text{LoS}}=\frac{1}{1+a\exp\Bigl{(}-b\Bigl{(}\frac{180}{\pi}\text{tan }^{-1}\Bigl{(}\frac{z}{d_{k}}\Bigr{)}-a\Bigr{)}\Bigr{)}}, \tag{1}\]0  
where the sending delay in the link from the ECS to the UE is ignored, considering that the computation results returned from the ECS are usually small. Define the ECS matched by UE \(k\) as \(m\), and define its corresponding computing power as \(C_{m}\); then, the processing delay of the computing task of UE \(k\) can be obtained as  
\[P_{k}^{\text{LoS}}=\frac{1}{1+a\exp\Bigl{(}-b\Bigl{(}\frac{180}{\pi}\text{tan }^{-1}\Bigl{(}\frac{z}{d_{k}}\Bigr{)}-a\Bigr{)}\Bigr{)}}, \tag{1}\]1  
The waiting delay indicates the time that this computation task waits in the ECS to be processed. Consider a business cycle in which all UEs simultaneously send computation tasks to the UAV. The UAV is equipped with multiple antennas to forward all the computation tasks simultaneously. In the considered system, the first computational task to arrive at the ECS is the one with the smallest task size among the computational tasks matched by the ECS, and its waiting delay is 0. Subsequent computational tasks arriving at the ECS are categorized into two scenarios based on whether the previous computational task has been processed or not. When the previous task has been processed, the waiting delay of the task is also 0. Otherwise, the waiting delay of the task is accumulated from the time it arrives at the ECS until the previous task has been processed. Based on the above derivation, the waiting delay of a computation task of UE \(k\) at ECS \(m\) can be expressed as  
\[Delay_{wait}^{k}=\left\{ \begin{array}{l}0,L_{m}=\min\mathcal{L}_{m}\text{ } \sigma\text{ }T_{done}^{j}\leq T_{arri}^{k}\\ T_{done}^{j}-T_{arri}^{k},T_{done}^{j}>T_{arri}^{k}\end{array} \right., \tag{11}\]where \(\mathcal{L}_{m}\) represents the set of computational tasks at ECS \(m\), \(j\) represents the computational task that is second only to \(k\) in terms of task volume, and if \(j\) does not exist, then \(T^{j}_{done}\leq T^{k}_{arri}\) holds forever. \(T^{j}_{done}\) and \(T^{k}_{arri}\) denote the moment when the processing of computational task \(j\) is completed and the arrival moment of computational task \(k\), respectively. Based on the above derivation, we can obtain the total delay of the computation task for user \(k\) as  
\[Delay^{k}_{total}=\frac{L_{k}}{R^{ILE}_{k}}+\frac{L_{k}}{R^{ILE}_{k}}+Delay^{k}_ {comp}+Delay^{k}_{wait}. \tag{12}\]  
Considering the entire edge computing network, we use the average delay of the network as a criterion for evaluating the experience of edge computing services, which can be expressed as  
\[Delay^{sum}_{total}=\frac{1}{K}\sum_{k=1}^{K}Delay^{k}_{total}. \tag{13}\]  
Our goal is to minimize the average delay of edge computing networks.