## 4 Cooperative Computational Offloading Scheme
### Computational Offloading Scheme Based on the ANN Model  
In the UANet, 14 BSs are deployed on the water. At first, one of the BS nodes is selected as an alliance by a SN node, and then the first BS as an alliance seeks another BS within its transmission range to cooperate and compute the task in parallel, as shown in Figure 1. There are at most two BSs in each coalition in the ANN model to divide the task and compute the sub-task in parallel. The dataset is generated with a size of 2744 values. The distance between an SN and a BS is considered to be a random variable from 25 m to 318 m. The distance between BSs is considered to be from 100 m to 1000 m. The size of the computational task \(A_{t}\) is from 500 MB to 1000 MB. Furthermore, we consider one input layer, five hidden layers, and one output layer, respectively. The input layer has 3 neurons, and the five hidden layers have 10, 10, 10, 10, and 11 neurons, respectively. The output layer has 18 neurons. In addition, the activation function is Hyperbolic Tangent (_Tanh_) for the first four hidden layers, and the activation function of the fifth layer is a linear function. The network is trained by the generated dataset, which is stored in a 2D array. The 2D array contains the number of rows equal to the size of the dataset, with 21 values in each row. Of the 21 values, the first value is the distance between the SN and BS. The second value is the distance between BSs, and the third value is the size of the task. The other three values are assigned as the input for the ANNs, and three neurons are assigned for the input layer. The values from 4 to 7 correspond to the sub-component task of the computational task for the cooperative BS, the ID of delivering BS, the communication time, and the compute time. The values from 8 to 21 are related to the distance between the receiver base station and the delivery base station. The value eight includes the ID of the receiver BS, and nine is for the ID of the nearest to the receiver BS in the shortest distance and so on until the ID of  
Figure 4: The flowchart of coalition and task offload.  
the delivered BS for the rest of the values. If the ID of the delivered base station appears before 21, then the values after it will be 0. From values 4 to 21, there are 18 values in total, and these are considered to be the output values. Therefore, 18 neurons are used for the output layer.  
Step1: The minimum delay is calculated according to the relevant formula and constraint conditions.  
Step2: During a service session, if one BS moves out of the transmission range of the SN node which has offloaded the computation task to the BS node, the service session for the SN node failed. The success or failure of a service session for am SN node within a T\({}_{\text{s}}\) is represented by a variable, \(\mathcal{F}_{\text{s}}\). Thus,  
\[\mathcal{F}_{\text{s}}=\text{s.t.}\left\{\begin{array}{l}\mathbf{1}.\\ \mathbf{0}.\end{array}\right.\qquad\text{\emph{if}}\ \text{\emph{S}}\ \geq V_{\text{b}(T_{\text{s}})}\ \mathbf{\Gamma}\\ \text{\emph{Otherwise}}\end{array}\]  
Step3: Find the most suitable BS for delivering result by keeping in view of the SNR constraint.  
Step4: The nodes of SN or USN enter into alliance with those BSs that provide a better service performance in terms of minimum service time, minimum computation cost, and minimum total service time.  
Step5: The dataset is divided into training, validation, and testing subsets, and the relevant data are trained in ANNs.