## 4 Cooperative Computational Offloading Scheme
### Service Time Model
end if If\(f_{1}=0\)then \(d_{s}[i]=1\); \(F_{s}[i]=0\); else  Check if \(r_{ij}[i]\) follows the SNR constraint from (15) and store the value in \(f_{2}\) if\(f_{2}=1\)then \(d_{s}[i]=0\); \(F_{s}[i]=1\); else\(d_{s}[i]=2\); \(F_{s}[i]=0\);  end if  end if  end if
```  
**Algorithm 1**ANN-Based Collaborative Computing  
```
Step#3 ShortestDistance Search Algorithm:  Check \(r_{i,j}\) to find the most suitable BS for delivering result by keeping in view of the SNR constraint from (15) If the constraint is not met for an index, then make \(d_{s}=0\) and \(F_{s}=1\) for that index. for\(i=0:2743\)do for\(j=0:13\)do if\(d_{s}[i]=j+1\)then for\(k=0:13\)do \(\mathrm{distance}[i][k]=\mathrm{D}[j][k]\)  end if  end for  end for Step#4 Coalition Game: Repeat  Randomly select coalition, \(P\), i.e., \((\mathcal{U},\mathcal{N}\) and \(\mathcal{B})\in\mathcal{P}\);  Randomly select another coalition, \(\mathcal{P}^{\prime}_{P}\), \(\mathcal{P}\
eq\mathcal{P}^{\prime}\);  Check the preference order of \(\mathcal{N}\) and \(\mathcal{U}\) for \(\overline{\mathcal{B}}\in\mathcal{P}\) and \(\overline{\mathcal{B}}^{\prime}\in\mathcal{P}^{\prime}\)  If (20) is not satisfied, then \(\mathcal{U},\mathcal{N}\) splits from its current coalition and forms a new coalition;  Update the current coalition; else  Go to Repeat;  end for Until Convergence to the final stable partition. Step#5 Training:  Divide the dataset into training, validating, and testing sets. Network \(\leftarrow\)ANN\([10,10,10,10,11]\) while\(i\leq\)datasetdo  trained = train(network, input, labels)  end for  Test performance on the test set. Accuracy \(\leftarrow\) Number of correctly predicted policies/Total number of policies. ```  
**Algorithm 1**_Cont._  
Figure 2: Concept model of coalition game theory. The game players make a coalition according to the well-defined preferences and formulate a coalition partition. First, the USN players try to communicate to the SNs within its transmission range and make the SNs game players. Then, all the game players, i.e., USNs and SNs, try to seek the BSs which can provide minimum service time and computation cost to make coalition, as mentioned in Formulas (8)-(10), (13), (14), and (18). In other words, the USNs and SNs seek their preferred BSs as alliances by comparing the preference order of the potential alliances. Here, we need to define the concept of preference order. The preference order is defined as the reflexive, complete, and transitive binary relation over the set of possible BSs so that USNs and SNs can form the cooperative coalition, \(\mathcal{P}\subseteq\mathcal{B}\), which satisfies the following:  
\[\mathcal{P}_{P}\cap\mathcal{P}^{\prime}{}_{P}=\varnothing,\forall\mathbb{P} \
eq\mathbb{P}^{\prime}\text{ and }\cup_{P=1}^{\mathbb{P}}\mathcal{P}_{P}=\mathcal{B} \tag{19}\]  
In the proposed coalition partition formation, the USNs and SNs prefer these BSs, which can provide minimum service time and computation cost as alliances. Therefore, the preference order is defined as shown in Equation (20). \[\overline{\mathcal{B}}_{i}\succ\mathcal{U}_{i},\mathcal{N}_{i}\,\overline{ \mathcal{B}}_{j}\Leftrightarrow\overline{\mathcal{F}_{s_{i}}}>\overline{ \mathcal{F}_{s_{j}}} \tag{20}\]  
The procedure to select the preferences is given as follows. In the first step, SNs and USNs form the coalition \(\mathcal{P}_{P}\) with a BS selected randomly from \(\mathcal{B}\). Next, the selected BS is replaced by a BS which can provide better service performance (with less service time and computation cost). Then, the service performance (service time and computation cost) of the BSs continues to be compared till the BS with the minimum service time and computation cost is found out. Then, the BS node with the minimum service time and computation cost is selected as an alliance, and the SNs switch to a new coalition, \(p_{p}^{\prime}\). After several rounds of switching operations based on the preference order, the coalition formation game converges to a stable and optimal coalition partition.