# Computation Offloading and Resource Allocation Based on P-DQN in LEO Satellite Edge Networks
## 3 System Model and Problem Description
### Latency and Satisfied Task Model  
First, when locally processing task \(R_{k,i}^{t}\) on terminals, the total service latency includes only the processing latency, i.e., \(T_{k,i}^{t,\text{tol}}=c_{k,i}^{t}/c_{k,i}^{L,E}\), where \(c_{k,i}^{t}\) represents the packet size of \(R_{k,i}^{t}\), and \(C_{k,i}^{L,E}\) is the remaining constant computing resource always allocated to \(R_{k,i}^{t}\), respectively. If \(T_{k,i}^{t,\text{tol}}\leq t_{\text{max}}\), then \(R_{k,i}^{t}\)is satisfied; otherwise, it fails. Second, when offloading \(R_{k,i}^{t}\) to satellite \(l_{k}\), the total service latency consists of processing, transmission, and propagation ones. The processing latency is \(c_{k,i}^{t}/C_{k,i}^{t,L}\), where \(C_{k,i}^{t,L}\)is the computing resource always allocated to \(R_{k,i}^{\bar{t}}\) by \(l_{k}\), and the propagation latency is \(2d_{k}^{\bar{t},L}/c\). Further, the transmission rate in the satellite uplink becomes  
\[s_{k,i}^{\bar{t},t,L}=W_{k}^{L}\text{log}_{2}\left(1+\frac{P_{k,i}^{\bar{t},L} \delta_{k}^{t,L}}{\sum\limits_{m=1,m\
eq k}^{\bar{t}}\sum\limits_{j=1}^{\bar{t }}P_{m,j}^{\bar{t},M}\delta_{m}^{t,L}+\sigma^{2}}\right), \tag{7}\]  
where \(W_{k}^{L}\) represents the link bandwidth allocated to region \(k\), \(s_{k,i}^{\bar{t},L}\) is the transmission rate of \(R_{k,i}^{\bar{t}}\) (originating at slot \(\bar{t}\) and not yet transmitted completely until slot \(t\)) at \(t\), \(P_{k,i}^{\bar{t},L}\) is the transmit power allocated to \(R_{k,i}^{\bar{t}}\) and we assume that \(P_{k,i}^{\bar{t},L}\) does not vary across slots for simplicity, \(\sum\limits_{m=1,m\
eq k}^{\bar{t}}\sum\limits_{j=1}^{\bar{t}}P_{m,j}^{\bar{t },L}\delta_{m}^{t,L}\) is the interference power caused by other regions except \(k\) at slot \(t\), and \(\sigma^{2}\) is the noise power, respectively. Since the channel state varies across slots, the transmission rate also changes. Besides, the remaining data (not yet transmitted) of \(R_{k,i}^{\bar{t}}\) becomes  
\[z_{k,i}^{\bar{t},t}=\left\{ \begin{array}{cc}c_{k,i}^{\bar{t}}-s_{k,i}^{\bar{ t},L}\cdot\tau,&t=\bar{t}\\ z_{k,i}^{\bar{t},L}-s_{k,i}^{\bar{t},L}\cdot\tau,&t>\bar{t}\end{array} \right., \tag{8}\]  
where \(\tau\) is the size per slot. At the beginning of each slot \(t\), judgments are made depending on the state of \(R_{k,i}^{\bar{t}}\). Define variables \(\eta_{k,i}^{\bar{t},t}\) to represent the condition of \(R_{k,i}^{\bar{t}}\) (originating at slot \(\bar{t}\)) at current slot \(t\), i.e.,  
\[\eta_{k,i}^{\bar{t},t}= \begin{cases}1,&\text{if }T_{k,i}^{\bar{t},\text{tol}} \leq t_{\text{max}}\\ 0,&\text{if }T_{k,i}^{\bar{t},\text{tol}}>t_{\text{max}}\text{ or }T_{k,i}^{\bar{t}, \text{genr}}\geq t_{\text{max}}\\ -1,&\text{if }T_{k,i}^{\text{genr}}<t_{\text{max}}\end{cases} , \tag{9}\]  
where \(T_{k,i}^{\bar{t},\text{tra}}\) is the traversed latency from \(\bar{t}\) to \(t\) of unfinished task \(R_{k,i}^{\bar{t}}\). \(\eta_{k,i}^{\bar{t},t}=1\), \(\eta_{k,i}^{\bar{t},t}=0\) and \(\eta_{k,i}^{\bar{t},t}=-1\) indicates that \(R_{k,i}^{\bar{t}}\) is exactly finished and judged to be satisfied, that \(R_{k,i}^{\bar{t}}\) is judged to fail, and that the judgment has to be postponed to next slot, all at slot \(t\). The explicit judgment on satisfied conditions of tasks are shown in Algorithm 1. Third, when offloading \(R_{k,i}^{\bar{t}}\) to the cloud server \(M\), the total service latency consists of processing, transmission, and propagation ones as well. The processing latency is \(c_{k,i}^{\bar{t}}/C_{k,i}^{M,M}\), where \(C_{k,i}^{\bar{t},M}\) is the computing resource always allocated to \(R_{k,i}^{\bar{t}}\), and the propagation latency is \((2d_{k}^{\bar{t},L}+2d_{k}^{\bar{t},M})/c\).