# Hybrid Dual-Link Data Transmission Based on Internet of Vessels
## 3 Algorithm Design
### Spatial Crowdsourcing Task Allocation  
#### Basic Idea  
The ship network consists of numerous ships. To effectively select the appropriate ships for establishing data transmission paths, this study adopts a spatial crowdsourcing approach. In this method, the underwater node acts as the task publisher, broadcasting task information that includes its own location, the target node's location, and the time required for data transmission. And ships within the node's communication range act as workers, receiving the information and deciding whether to participate in the crowdsourcing task. Then, participating ships (workers) will be rewarded. Ships determine their participation based on their navigation trajectory and speed. Ships that are about to leave the communication range of the node or those that will leave the area before completing the data transmission do not participate in the crowdsourcing task.  
When the underwater node takes on the role of the task publisher, it broadcasts task information to potential ship workers within its communication range. These workers must meet specific threshold conditions. The algorithm sets a minimum threshold to filter  
Figure 4: Information transmission from ship to other ships.  
out ships that do not meet the basic parameters, reducing the computational load. Only ships that meet the threshold criteria are considered eligible candidates to be processed further in the ship worker selection algorithm.  
Ship workers that meet the threshold conditions use a Bayesian method to calculate the direct reputation value of the ship workers. They then combine this with the number of user participations to compute the ship's total reputation value. A comprehensive scoring function is designed, taking into account factors like the target node's location, ship density, and potential black holes that may affect the communication outcomes. The ship worker with the highest score according to this function is selected. The ship worker then evaluates whether to participate in the crowdsourcing task based on the task's target location and corresponding reward. If the worker agrees to participate, the underwater node transmits the crowdsourcing information to the ship worker. If the worker rejects the task, the algorithm will continue to select candidate workers until a willing worker is found. Workers who reject tasks will not be included in the reputation evaluation process. On the other hand, once a worker accepts the task, their reputation is calculated. Upon task completion, the worker's reputation will increase, while failing to complete the task will lead to a decrease in reputation. If a worker's reputation falls below the minimum required reputation for the crowdsourcing task, they will no longer be allowed to participate in future tasks. The pseudo-code of the algorithm is presented in Algorithm 1.  
```
1:Input: Task info (underwater node location, target node location, time cost), threshold values (minimum credibility, etc.)
2:Output: Task transmitted or transmission failure
3:function selectShipForCrowdsourcingTask()
4: taskInfo \(\leftarrow\) gatherTaskInfo()
5: ships \(\leftarrow\) scanForNearbyShips()
6: qualifiedShips \(\leftarrow\) filterShipsByThreshold(ships)
7:if qualifiedShips is empty then
8: continueSelectAlgo()
9: continue
10:endif
11: selectedShip \(\leftarrow\) HDTAAlgorithm(qualifiedShips, taskInfo)
12:if selectedShip is null then
13: continueSelectAlgo()
14: continue
15:endif
16: updateShipCredibility(selectedShip, taskInfo)
17: sendTaskTo(selectedShip, taskInfo)
18:if dataTransmittedToTarget(selectedShip, taskInfo) then
19: taskCompleted()
20:else
21: transmissionFailed()
22:endif
```  
**Algorithm 1** Select ship for crowdsourcing task.