Deep Reinforcement Learning-Based Task Offloading for Parked Vehicle Cooperation in Vehicular Edge Computing
Algorithm 2
DRL based task offloading.
(1)
Initialize step length , attenuation factor , sample number of gradient descent .
(2)
Initialize the parameters θ of the neural network randomly and initialize the experience replay buffer D.
(3)
for each episode do
(4)
Initialize the environment state, get its feature vector .
(5)
for each iteration do
(6)
Use as the input, obtain the softmax output of the neural network. Select action according to equation (14)
(7)
Execute the action , observe the new environment state , and gets the corresponding immediate reward
(8)
Put the quadruple into the experience replay buffer
(9)
if is the terminated state then
(10)
break; //end this iteration
(11)
end if
(12)
end for
(13)
Obtain samples from the experience replay buffer D, and update the parameters θ of neural network through minimizing the objective function in equation (16) using batch gradient descent algorithm.