## 4 The PI-Based Task Offloading Algorithm
### Task Inclusion  
In the task inclusion stage, each satellite independently incorporates tasks into its task sequence, based on local information.  
For satellite \(s\in S\), the inclusion impact vector \(\mathbf{I}_{s}=[I_{s1},I_{s2},\ldots,I_{sn}]^{\mathrm{T}}\) is first constructed according to (20), where entry \(I_{st}=\mathcal{I}(\theta_{s}\oplus t)\) for \(\forall\ t\in T\). Then, \(\mathbf{I}_{s}\) is compared with vector \(\mathbf{R}_{s}=[R_{s1},R_{s2},\ldots,R_{sn}]^{\mathrm{T}}\) (after consensus). One of the tasks in \(T\) will be inserted into \(\theta_{s}\) only if  
\[\max_{t\in T}\{R_{st}-I_{st}\}>0 \tag{23}\]  
According to Lemma 1, when (23) is satisfied, it indicates the presence of an inclusion that can reduce \(F(\theta)\). Then task \(t^{\prime}=\operatorname*{argmax}_{t\in T}[R_{st}-I_{st}]\) will be inserted into the \(p^{\prime}\)-th position of sequence \(\theta_{s}\), where \(p^{\prime}\) leads to value \(\mathcal{I}(\theta_{s}\oplus t^{\prime})\) (i.e., \(p^{\prime}\)=\operatorname*{argmin}_{p\in\{1,2,\ldots,1\theta_{s}+1\}}[F( \theta_{s}\oplus_{p}t^{\prime})-F(\theta_{s})]\)). Next, we update vectors \(\mathbf{R}_{s}\) and \(\mathbf{W}_{s}\) by setting \(R_{st^{\prime}}=I_{st^{\prime}}\) and \(W_{st^{\prime}}=s\). After that, \(\mathbf{I}_{s}\) is recalculated and (23) is checked again. This process is repeated until there are no remaining tasks in \(T\) or (23) is no longer met. Finally, we obtain new \(\mathbf{R}_{s}{}^{\prime}\) based on updated \(\theta_{s}{}^{\prime}\). The task inclusion stage is further presented in Algorithm 2.  
```
Input: task set \(T\), task sequence \(\theta_{s}\), and vectors \(\mathbf{R}_{s}\) and \(\mathbf{W}_{s}\). Output: new task sequence \(\theta_{s}{}^{\prime}\), new vectors \(\mathbf{R}_{s}{}^{\prime}\) and \(\mathbf{W}_{s}{}^{\prime}\).
1. Calculate inclusion impact vector \(\mathbf{I}_{s}\);
2. while\([T/\theta_{s}]\
eq\emptyset\) and (23) is met
3. Obtain task \(t^{\prime}\)= \(\operatorname*{argmax}_{t\in T}[R_{st}-I_{st}]\) and appropriate position \(p^{\prime}\) in \(\theta_{s}\);
4. Insert \(t^{\prime}\) into \(p^{\prime}\)-th of \(\theta_{s}\);
5. Update \(R_{st^{\prime}}=I_{st^{\prime}}\), \(W_{st^{\prime}}=s\);
6. Update \(\mathbf{I}_{s}\);
7.  end while
8. Let \(\theta_{s}{}^{\prime}=\theta_{s}\) and \(\mathbf{W}_{s}{}^{\prime}=\mathbf{W}_{s}\);
9. Obtain \(\mathbf{R}_{s}{}^{\prime}\) based on \(\theta_{s}{}^{\prime}\);
10. Output \(\theta_{s}{}^{\prime}\), \(\mathbf{R}_{s}{}^{\prime}\), and \(\mathbf{W}_{s}{}^{\prime}\);
```  
**Algorithm 2** Task Inclusion  
Following the task inclusion stage, new parameters (\(\theta_{s}{}^{\prime}\), \(\mathbf{R}_{s}{}^{\prime}\), and \(\mathbf{W}_{s}{}^{\prime}\)) are generated on each satellite \(s\in S\). However, since tasks are included independently, a specific task may be assigned to multiple satellites, leading to task conflicts. Moreover, variations exist in obtained \(R_{s}\) among different satellites \(s\in S\). These pose a challenge in achieving a unified offloading assignment \(\theta\). Thus, we introduce the consensus and task-removal stage to resolve the above problems.