|
Algorithm 1: Select ship for crowdsourcing task. |
-
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 ← gatherTaskInfo()
-
5:
ships ← scanForNearbyShips()
-
6:
qualifiedShips ← filterShipsByThreshold(ships)
-
7:
if qualifiedShips is empty then
-
8:
continueSelectAlgo()
-
9:
continue
-
10:
end if
-
11:
selectedShip ← HDTAAlgorithm(qualifiedShips, taskInfo)
-
12:
if selectedShip is null then
-
13:
continueSelectAlgo()
-
14:
continue
-
15:
end if
-
16:
updateShipCredibility(selectedShip, taskInfo)
-
17:
sendTaskTo(selectedShip, taskInfo)
-
18:
if dataTransmittedToTarget(selectedShip, taskInfo) then
-
19:
taskCompleted()
-
20:
else
-
21:
transmissionFailed()
-
22:
end if
|