|
Algorithm 1 Computation Offloading Decision (COD) algorithm |
|
Input:
|
| Computation tasks of sensors (). |
|
Output:
|
| Computation offloading strategy of sensors (). |
| Initialization
|
| Each sensor initially offloads its computation task to the cloud, (). |
-
1:
Compute the cost of each sensor n when offloading the computation task to the cloud, , based on Equation (14).
-
2:
for each improvement iteration t
do
-
3:
for each sensor
do
-
4:
obtain the computation and communication resources allocated to sensor n when offloading the computation task to each cloudlet according to .
-
5:
compute the better strategy set based on Equations (13) and (14).
-
6:
choose the improvement decision from to minimize the cost function.
-
7:
end for
-
8:
if the better strategy set of all sensors
then
-
9:
each sensor n with competes for the improvement opportunity, and the sensor with larger is endowed with higher priority of winning the contention.
-
10:
if sensor n wins the contention then
-
11:
.
-
12:
end if
-
13:
else
-
14:
break;
-
15:
end if
-
16:
end for
|