Research Article

Optimized Bandwidth Allocation for MEC Server in Blockchain-Enabled IoT Networks

Algorithm 2

DQN algorithm for bandwidth allocation in public network.
(1)Initialize memory for experience replay
(2)Initialize eval_net and function with weight parameter
(3)Initialize target_net and function with weight parameter
(4)for each episode do
(5) Initialize
(6)for each time slot do
(7)  Generate a random number using policy for balancing exploration and exploitation
(8)  ifthen
(9)   Randomly choose a series of bandwidth as the for current flows.
(10)  else
(11)   
(12)  end if
(13)  Execute
(14)  Obtain and
(15)  Save into memory
(16)  Randomly select batch of experience data from
(17)  if is the terminal state then
(18)   set .
(19)  else
(20)   set
(21)  end if
(22)  Perform gradiant descent on with
(23)  Update parameter with
(24)end for
(25)end for