## 3 System Resource Optimization Algorithm
### Transfer Probability  
The task phase can be changed by the selected decision action, that is, T is affected by decision action A. At the same time, when a mobile device location is given, the available network at that location is also obtained. Therefore, the \(T\) and \(C\) states are interdependent. Thus, for the chosen action \(a\), the transition probability from the current state \(s=[m,\,L_{i},C_{\chi}]\) to the next state \(s^{\prime}=[m^{\prime},\,L_{j},C_{\chi^{\prime}}]\) can be described as follows:  
\[P[s^{\prime}|s,a]=P[m^{\prime}|m,a]\times P[L_{j},C_{\chi^{\prime}}|L_{i},C_{ \chi}]. \tag{39}\]  
Next, the transfer probability of different task stages M is analyzed, and \(\tau\) indicates the duration of each decision period. We assume that the inter-arrival rate of the task follows an exponential distribution with mean \(1/\lambda_{M}\). Meanwhile, when \(m=1\), \(m^{\prime}\) will always be 2, so the transfer probability from \(m=1\) to \(m=2\) is 1. When \(m=2\), the decisive action will affect the transfer probability and the next state. When the task decides to conduct delay processing (\(a=D\)), the task state will not change. When the task decides to conduct G-MEC offloading (\(a=O_{M}\)), the task state will be converted to m = 3. When the task decides to conduct UAV offloading (\(a=O_{A}\)), the task state will be converted to \(m=4\). When the task decides to conduct terminal processing (\(a=O_{u}\)), the task state will be converted to m = 5. When the processing task policy is determined, the transfer probability to the next state is 1. During the offloading computing tasks, the BER and interruption problems caused by relay forwarding and long-distance communication will reduce the probability of the successful transmission of computing tasks. Calculating the state of the UAV after offloading and the resource situation of the G-MEC will also affect the probability of task computation completion. After the task is offloaded,the state of the UAV and the resource situation of the G-MEC will also affect the probability of task computation completion. The probability that the task successfully completes the offloading calculation, which is affected by the communication transmission and computing resources, is not always 1. In other words, the transition probability of selecting the offload node state that transfers to the state that successfully completes the task calculation is not 1. In this study, the transfer probability of selecting the offload node state to the next state, that is, the transfer probability of the state \(m=3\), 4, and 5 transferring to the state \(m=6\), 7, and 8, is defined as the reliability index of the system accomplishing the task. The reliability index \(\mu\) is given by \(\mu=\{\mu_{M}\), \(\mu_{A}\), \(\mu_{u}\}\), where \(\mu_{M}\), \(\mu_{A}\), and \(\mu_{u}\) are the indexes of the G-MEC offloading, UAV offloading, and terminal processing, respectively. The reliability index indicates the possibility of successful computation after the task decision is offloaded. The transition probability of task completion is shown as follows:  
\[P[m^{\prime}|m=3,a]= \begin{cases}\mu_{M}\tau,&\text{if }m^{\prime}=6\\ 1-\mu_{M}\tau,&\text{if }m^{\prime}=3\\ 0&\text{otherwise}\end{cases} , \tag{40}\]  
\[P[m^{\prime}|m=4,a]= \begin{cases}\mu_{A}\tau,&\text{if }m^{\prime}=7\\ 1-\mu_{A}\tau,&\text{if }m^{\prime}=4\\ 0&\text{otherwise}\end{cases} , \tag{41}\]  
\[P[m^{\prime}|m=5,a]= \begin{cases}\mu_{u}\tau,&\text{if }m^{\prime}=8\\ 1-\mu_{u}\tau,&\text{if }m^{\prime}=5\\ 0&\text{otherwise}\end{cases} . \tag{42}\]  
The definition of the reliability index endows the transfer probability with the physical meaning of the model. The definition means the size of the cost function and reward function affects the terminal decision of the offloading node, and the reliability index will influence the choice of the offload node. Thus, the application of the MDP algorithm is practical for the model.