Skip to main content
. 2018 Jun 15;18(6):1945. doi: 10.3390/s18061945
Algorithm 1 Computation Offloading Decision (COD) algorithm
Input:
   Computation tasks of sensors Mn(nΓ).
Output:
   Computation offloading strategy of sensors sn(nΓ).
   Initialization
   Each sensor initially offloads its computation task to the cloud, sn0=0 (nΓ).
  • 1:

    Compute the cost of each sensor n when offloading the computation task to the cloud, Cn0, based on Equation (14).

  • 2:

    for each improvement iteration t do

  • 3:

    for each sensor nΨ(t1) do

  • 4:

      obtain the computation and communication resources allocated to sensor n when offloading the computation task to each cloudlet according to snt1.

  • 5:

      compute the better strategy set ρnt based on Equations (13) and (14).

  • 6:

      choose the improvement decision dnt from ρnt to minimize the cost function.

  • 7:

    end for

  • 8:

    if the better strategy set of all sensors n=1Nρnt then

  • 9:

      each sensor n with ρnt competes for the improvement opportunity, and the sensor with larger ξnt is endowed with higher priority of winning the contention.

  • 10:

      if sensor n wins the contention then

  • 11:

       snt=dnt.

  • 12:

      end if

  • 13:

    else

  • 14:

      break;

  • 15:

    end if

  • 16:

    end for