# Research on Task-Oriented Computation Offloading Decision in Space-Air-Ground Integrated Network
## 2 Materials and Methods
### DQN-Based Computation Offloading Decision Algorithm  
In the Markov computation offloading decision process, the strategy space contains countless kinds of strategies, and it is necessary to find the best state-action path as the final optimal decision, and then the offloading environment performs state transition according to the actions of the terminal selecting a certain offloading site in the network and calculates the reward value through the reward function. If the reward value is positive, the terminal is less likely to select that offloading site thereafter; if the reward value is negative, the trend is reversed. In this process, a large number of state-action pairs are generated. In this section, the DQN algorithm is used to process these state-action pairs, and the convolutional neural network and Q-learning algorithm are fused to solve the task offloading decision process model to find the best action corresponding to each state and complete the optimal task computation offloading. Using the Q-learning algorithm, the intelligent terminal transfers the state of the offloading tasks through the real-time action value and the cumulative reward value. During the task offloading process, the channel state in the network is estimated in advance and the computing capacity of the terminal is monitored. During the Q-learning process, the processing status of the task is represented as \((O_{i},w_{total})\), where \(O_{i}\) represents the offloading site's number of the current processing task, and \(w_{total}\) represents the total amount of task data processed up to the current state. The next action of the task is represented as \((O_{i},w_{i})\), where \(w_{i}\) represents the amount of data to be offloaded when the next action is performed. Suppose the initial reward function is 0, and the instant reward function of each step in the offloading task is calculated by the reciprocal of the linear expression of total delay and total energy consumption. The expressions of delay \(C_{T_{i}}\) and energy consumption \(C_{E_{i}}\) are as follows:  
\[T_{t_{i}}=FT_{t_{i}}^{l}=T_{t_{i}}^{l}+RT_{t_{i}}^{l}\qquad(executed\ local) \tag{6}\]  
\[T_{t_{i}}=FT_{t_{i}}^{ed}=T_{t_{i}}^{ed}+RT_{t_{i}}^{ed}\qquad(offloaded\ to\ edge\ compute\ node) \tag{7}\]  
\[T_{t_{i}}=FT_{t_{i}}^{b}=T_{t_{i}}^{b}+RT_{t_{i}}^{b}\qquad(offloaded\ to\ bone\ cpmpute\ node) \tag{8}\]  
\[E_{t_{i}}=E_{t_{i}}^{l}=\gamma_{in}\cdot w_{in}\qquad(executed\ local) \tag{9}\]  
\[E_{t_{i}}=E_{t_{i}}^{ed}=T_{t_{i}}^{eds}p_{s}+T_{t_{i}}^{ed}p_{c}\qquad(offloaded\ to\ edge\ compute\ node) \tag{10}\]  
\[E_{t_{i}}=E_{t_{i}}^{b}=T_{t_{i}}^{bs}p_{s}+T_{t_{i}}^{br}p_{r}\qquad(offloaded \ to\ bone\ cpmpute\ node) \tag{11}\]  
Considering that in the Space-Air-Ground Integrated Network offloading environment, both the offloading terminals and the offloading sites have mobility. In Equations (4) and (5), the communication duration \(T_{j}^{resident}\) of the offloading terminals and the offloading sites, and the maximum computing capacity \(f_{maxgipe}\) which the offloading sites can provide are essential constraint conditions. According to the conditions of \(f_{maxgipe}\geq w_{in}\) in the Markov computation offloading decision process, the offloading sites that can theoretically complete the calculation task are obtained. Among these offloading sites that can complete the calculation task, select the offloading site with the smallest sum of delay and energy consumption cost, and the computation offloading decision taken at this time is optimal. The traditional measure of the performance of the offloading decision uses delay or energy consumption as a single constraint and seeks another minimum value to select the optimal offloading decision. To be able to balance the cost of delay and energy consumption, while taking into account the characteristics of different offloading tasks, weight parameters [31]\(\alpha\) and \(\beta\) that the maximum value is 1 are set for the cost of the task, respectively representing the weight of delay and energy consumption.