# Energy Saving Strategy of UAV in MEC Based on Deep Reinforcement Learning
## 6 Simulation Results
### Adaptive K Value Setting Method  
In this section, we study the impact of the adaptive \(K\) value setting method on the performance of the DOTO algorithm.  
In Figure 5, we show the \(K\) value index distribution in 10,000 time blocks when the number of UAVs accessed in the MEC system is 5 to 10. At this time, the \(K\) value is mostly 0 or 1, but there are also some other values. When the number of UAVs increases, the final value fluctuates more. However, more than 95% are within the \(N\) value and below. Therefore, in the adaptive \(K\) value setting method, this paper finally sets the \(K\) minimum to the \(N\) value. The experiments in Section 6.1 have demonstrated that the DOTO algorithm with such an adaptive \(K\) value setting can obtain satisfactory suboptimal solutions.  
Figure 4: The ratio of the results of the DOTO algorithm and the CD algorithm to the results of the optimal offloading decision.  
In Figure 6, we show the influence of the adaptive \(K\) on the computational complexity of the DOTO algorithm. It shows that the computational complexity of the DOTO algorithm can be greatly reduced under the condition of ensuring the performance of the algorithm. When the value of \(K\) is \(2^{N}\), as the number of UAVs in the MEC system increases, the time consumed by the offloading strategy will increase significantly. When the number of access devices is 10, the average time required for each offloading decision reaches 0.1203 s. At this time, the delay is too high, and it is no longer suitable for solving practical problems. Moreover, when the number of devices continues to increase, the delay will be more serious. When the adaptive \(K\) value setting is adopted, the average calculation time of the DOTO algorithm is relatively stable, and there is no obvious change. The required time is also approximately 0.017 s, which is short and can be well applied to the actual model. The computational complexity of the DOTO algorithm is reduced from an exponential relationship to a linear relationship.  
Figure 5: The index distribution of the \(K\) value of the maximum offloading action in KNN within 10,000 time blocks when the number of UAVs varies from 5 to 10.  
Figure 6: When the number of UAVs is 5 to 10, the DOTO algorithm uses full enumeration (\(K_{\max}\)) and adaptive \(K\) modes to average the computing time per time block within 10,000 time blocks.  
In Figure 7, we further demonstrate the effect of the adaptive \(K\) update interval \(\Delta\) on the computational complexity and residual energy of the DOTO algorithm. To make the image more intuitive, we divide the data obtained at different update intervals \(\Delta\) by the smallest data among them. This converts the data into ratio form. The minimum computing time and residual energy in the figure are obtained when the update interval \(\Delta\) is 5. Therefore, the data in the figure are all obtained by dividing the data when the update interval is 5. It can be seen from Figure 7 that when the update interval \(\Delta\) is larger, the required calculation time is greater and the calculation complexity is higher. However, the residual energy obtained is also greater because, when the update interval \(\Delta\) is larger, the \(K\) value decreases more slowly. This means that more offloading actions will be generated and problem \(P2\) will be calculated more times. However, when the update interval \(\Delta\geq 20\), the computation time grows exponentially, while the residual energy grows linearly and slowly. To balance performance and computational complexity, we finally set \(\Delta=40\).