## 4 The PI-Based Task Offloading Algorithm
### Re-Offloading Mechanism
At time \(\mu_{a}\), the involved data are transmitted from \(k\) to \(s\), leading to additional delays and energy usage. Therefore, for tasks \(t_{i}\in\theta_{k}\cap\theta_{s}\)*, the data readiness time \(\tau_{i}^{D}\) in (6) and energy consumption \(E_{i,s}\) in (9) are revised as  
\[\tau_{i}^{D}=\mu_{a}+\tau_{i,s}^{ISL} \tag{27}\]  
\[E_{i,s}=\varepsilon_{1}\tau_{i,a}^{ISL}+\varepsilon_{2}(\tau_{i,a,k}^{ISL}+ \tau_{i,k,s}^{LSL})+\kappa C_{s}^{2}\lambda_{i}\mu_{i} \tag{28}\]  
After that, the re-offloading is performed, which introduces two main modifications in the original PITO: (1) in the task inclusion stage, only tasks \(t\in T_{r}\) (i.e., \(U_{st}=0\)) can be inserted into each \(\theta_{s}\)*. The insertion positions are also limited by the pruning approach; (2) the tasks in \(T_{a}\cup T_{b}\) are reserved in \(\theta_{s}\)* during the task removal process. Specifically, in the task inclusion stage, the pruning approach in Algorithm 5 is proposed, generating candidate insertion positions \(\Phi_{s}\) for each satellite \(s\in S\) with \(\theta_{s}\)*. In Algorithm 5, positions \(p_{a}\) and \(p_{b}\) are initialized as 1 and \(\mid\theta_{s}\)* + 1, respectively. Then, in Lines 2-8, index \(u\) of the first task \(t\in\theta^{\bullet}\cap T_{b}\) is obtained, and we set \(p_{b}=u\). Similarly, index \(v\) of the last task \(t\in\theta_{s}\)* \(\cap T_{a}\) is obtained by Lines 9-15, and we set \(p_{a}=v+1\). By \(p_{a}\) and \(p_{b}\), we obtain candidate insertion positions \(\Phi_{s}=\{p_{a},\ p_{a}+1,\ \ldots,\ p_{b}\}\). Based on \(\Phi_{s}\), the inclusion impact vector \(\mathbf{I}_{s}=[I_{s1},I_{s2},\ \ldots,I_{s(n+q)}]\)T is calculated, where entry \(I_{st}=\min_{p\in\Phi_{s}}\{F(\theta_{s}\oplus_{p}\ f)-F(\theta_{s})\}\) for \(\forall\ t\in T_{r}/\theta_{s}\)*, satisfying constraint (12), and otherwise, \(I_{st}=\infty\). After inserting a task into \(\theta_{s}\)*, we update \(\Phi_{s}\) and \(\mathbf{I}_{s}\). Differently from Algorithm 2, the task inclusion process in re-offloading is continued until \(\{T_{r}/\theta_{s}\)*} = \(\emptyset\) or (23) is no longer satisfied. Moreover, in the task removal process, tasks \(t\in T_{a}\cup T_{b}\) are retained, and only tasks in \(T_{r}\) can be removed from \(\theta_{s}\)*. Hence, the pending removal tasks for satellite \(s\) are revised as \(\forall s=\{t\in\theta_{s}\text{*}\cap T_{r}\ \mid\ W_{st}\
eq s\}\) in re-offloading. Apart from above modifications, Algorithm PITO proceeds as the original design, and the two stages of PITO are alternately performed until a re-offloading assignment \(\theta^{\bullet}\) is obtained. ```
1 Input: task sequence \(\theta_{s}{}^{*}\) and vectors \(\mathbf{U}_{s}\). Output: candidate positions \(\Phi_{s}\). 2
3 Initialize positions \(p_{a}=1\) and \(p_{b}=|\theta_{s}{}^{*}|+1\);
4 for\(u=1\) to \(|\theta_{s}{}^{*}|\)
5 Let \(t=\theta_{s}{}^{*}[u]\);
6 if\(U_{st}=2\)
7 Let \(p_{b}=u\);
8 Break;
9 end for
10 end for
11 end for
12
13 Let \(t=\theta_{s}{}^{*}[v]\);
14 if\(U_{st}=1\)
15 Let \(p_{a}=v+1\);
16 Break;
17 end for
18
19 end for
20 Output candidate positions \(\Phi_{s}=\{p_{a},p_{a}+1,\ldots,p_{b}\}\);
```  
**Algorithm 5** Pruning approach  
The proposed re-offloading mechanism has the following advantages: Firstly, it reduces the re-offloaded tasks and uses a pruning approach to minimize insertion attempts, thereby reducing re-offloading time. Secondly, reserving tasks \(t\in T_{b}\) in \(\theta^{*}\) prevents unnecessary data transmission, resulting in lower extra-energy usage and maintaining assignment quality.