Skip to main content
. 2022 Dec 7;22(24):9595. doi: 10.3390/s22249595
Algorithm 1 FL-DDPG-based Offloading Method
Initialize actor network μ and critic network Q
Initialize target network with weights μ and critic network Q
Initialize experience replay memory
for each episode eE do
 Initialize parameters for simulation in VEC environment
 Generate randomly an initial state snt for each vehicle agent nN
for each time slot tT do
  for each agent nN do
   Determine transmission power for offloading by selecting an action
   ant=μ(st)+Δμ, Δμ is a sampled noise
   Execute the action ant, receive reward rnt, and observe new state snt+1
   Store the tuple (snt, ant,rnt,snt+1) into experience replay memory
   Sample randomly a mini-batch of samples from experience replay memory
   Update the critic and actor network via Equations (14) and (16)
   Update target networks via Equations (17) and (18)
If episode e == eaggregation then
  Upload the parameters to the VECS controller according to Equation (19)
  Download the parameters from the VECS controller to each vehicle