Research Article
Differential Grey Wolf Load-Balanced Stochastic Bellman Deep Reinforced Resource Allocation in Fog Environment
Algorithm 2
 Stochastic Bellman Gradient Deep Reinforcement Learning-based Resource Allocation.
| |  | Input: Dataset “,” task “,” fog nodes “” |  |  | Output: Energy minimized optimal resource allocation |  | (1) | Begin |  | (2) | For each dataset “” with task “” and fog nodes “” |  |  | //State space |  | (3) | Load balancer acquires the input from fog environment “” |  | (4) | Mathematically formulate data size as in equation (16) |  | (5) | Mathematically formulate waiting time as in equation (17) |  | (6) | Mathematically formulate queue length as in equation (18) |  |  | //Action space |  | (7) | For each action “” with the consolidated state “” |  | (8) | If task “” generated by fog node “” is executed locally |  | (9) | Then “” |  | (10) | Else “” |  | (11) | End if |  | (12) | If Task “” generated by fog node “” is executed on the host node |  | (13) | Then “” |  | (14) | Else “” |  | (15) | End if |  | (16) | If Task “” generated by fog node “” is executed by neighbor |  | (17) | Then“” |  | (18) | Else “” |  | (19) | End if |  |  | //Reward function |  | (20) | For each action “” with the consolidated state “” and task “” generated by fog node “” |  | (21) | Total all the obtained rewards as in equation (19) |  | (22) | Measure stochastic bellman gradient optimality function as in equation (20) |  | (23) | End for |  | (24) | End for |  | (25) | End | 
 |