Skip to main content
. 2021 Aug 26;12(9):1011. doi: 10.3390/mi12091011
Algorithm 1 Application-driven Task Offloading Strategy based on DQN (ATOS).
Input: The applications Aik generated by user Ui with sequences Sik;
Output: Offloading strategy Xik;
  • 1:

    Initialize D to N, Q with random weights θ, and Q^ with weights θ−:=θ;

  • 2:

    for episode from 1 to κ do

  • 3:

      Initialize sequence Sik based on Algorithm 2;

  • 4:

      With probability ε select a random action at;

  • 5:

      Otherwise select at=argmaxaQ(ϕ(St),a;θ);

  • 6:

      Set St+1=St, at, xt+1 and preprocess ϕt+1=ϕ(St+1).

  • 7:

      Store transition (ϕt,at,rt,ϕt+1) in D;

  • 8:

      Sample random minibatch of transitions (ϕj,aj,rj,ϕj+1) from D.

  • 9:

      if episode terminates at step j+1 then

  • 10:

        Set yj=rj;

  • 11:

      else

  • 12:

        Set yj=rj+γmaxa′Q^(ϕj+1,a′;θ−);

  • 13:

        Perform a gradient descent step on (y−Q(ϕj,aj;θ))2 with respect to the network parameters θ.

  • 14:

        Every C steps reset Q^=Q;

  • 15:

    return Offloading strategy Xik;