## 4 Methodology
### Solution
First, initialize the computational efficiency \(\eta^{k}\) and the number of associated users \(Y\) in coverage \(R^{max}\), and obtain the current position of the UAV \(q(n)\) from DCMCE. Then, enter the loop, allow the number of user associations \(O\) to be the minimum value of the maximum number of associated users \(Y\) and the current user request number \(I\). The user's priority is calculated by Equation (16), and the first \(O\) users are selected to associate with the UAV to obtain \(\mathsf{s}(n)\). Then, calculate the current computational efficiency \(\eta^{\prime}\) and use \(\eta^{\prime}\) to approximate the optimal computational efficiency \(\eta^{*}\). When \(\left|\eta^{\prime}-\eta^{k}\right|\) is less than a small enough number \(\xi\), the best computational efficiency \(\eta^{*}\) may be achieved; otherwise, update \(\eta^{k}\) until the maximum number of iterations is exceeded. To analyze complexity, after adequate training, the DCMCE model can be saved in preparation for the test phase. In each time slot, the action of UAV is generated together by actor network. In our paper, as the fully connected hidden layers are applied, and the computational complexity for generating action of UAV is \(O(\sum_{l=1}^{L}n_{l}\cdot n_{l-1})\), where \(L\) is the number of network layers and \(n_{l}\) is the number of neurons in the l-th layer. Then, the worst computational complexity of association algorithm is \(O(KM)\). The overall complexity of DCMCE algorithm in the testing process is \(O((\sum_{l=1}^{L}n_{l}\cdot n_{l-1}+KM)N)\). ```
1. Initialize computational efficiency \(\eta^{k}\), iteration number \(\varkappa=1\), maximum number of iterations \(K\)
2. Obtain \(q(n)\) from Algorithm 1
3. Calculate maximum number of associated users \(Y\)
4. repeat
5. for\(i=1,2,3,\ldots,\ Y\)
6. Select the user who has the request to join the set \(S\) to obtain the set Length \(I\), let \(O=\min(Y,I)\)
7. Calculate the priority of each user by Equation (16) in the set \(S\)
8. end for
9. Select the top \(O\) users with the highest priority in the set \(S\) to obtain \(s^{k}(n)\) and calculate the current computational efficiency \(\eta^{\prime}\)
10. if\(\left|\eta^{\prime}-\eta^{k}\right|\leqslant\xi\)then
11. \(\eta^{*}=\eta^{\prime}\)
12. \(s^{*}(n)=s^{k}(n)\)
13. \(q^{*}(n)=q^{k}(n)\)
14. break
15. else
16. \(\eta^{k+1}=\frac{1}{2}\left(\eta^{\prime}+\eta^{k}\right)\)
17. end if
18. \(\varkappa=\varkappa+1\) until\(\varkappa\leq K\)
```

**Algorithm 2**********Association algorithm

## 5 Performance Evaluation

### Experimental Setup

In the UAV-assisted MEC scenario, algorithms can be deployed to UAV via lightweight neural networks when the infrastructure is overloaded. This reduces the energy consumption of communication within the infrastructure. A total of 20 users are randomly distributed in a two-dimensional region of 100 m \(\times\) 100 m [18]. In the experimental scenario, the user's task arrives randomly. The UAV is to fly from the initial position to the user area to provide services for the user, and the user's computing tasks can be performed from the drone or locally. Assumedly, the UAV is flying at a constant height of 100 m. Table 1 provides a summary of the remaining flying, computation and communication parameters. We first conducted a series of experiments to determine the optimal values for important hyper-parameters used in algorithm comparisons. Since the algorithm did not change much with \(\mathcal{D}\), we set \(\mathcal{D}\) to 32. Other parameters were set as follows. From Figure 3, we can see that when the learning rate of actor network \(\alpha_{a}\) is 0.0005 and that of critic network \(\alpha_{c}\) is 0.001, the convergence curve fluctuates obviously and converges to a suboptimal value. The reason for this is that a larger learning rate will make both film critic network and actor network have a larger updating pace.