| Algorithm 1: WOA for computational offloading decision-making in a smart grid |
| Inputs: —energy and computational nodes and links, population size , maximum number of iterations , WOA parameters ), —workload to be relocated Outputs: —Best offloading decision solution Begin 1. ) 2. Foreach determine the fitness value 3. Select 4. Set initial values for 5. 6. Foreach solution in , do 7. Encircling phase: 8. Calculate distance between and 9. Determine position ) using and in relations (6) and (7) 10. Exploitation phase: 11. Determine position ) using and in relations (8) and (9) 12. Random exploration phase: 13. Explore new solutions ) using relation (10) 14. Inertia-based exploration phase: 15. Explore new solutions ) using inertia weight in relations (12) and (13) 16. End Foreach 17. Foreach , determine the fitness value 18. Select = 19. If remains unchanged for several iterations do 20. Update exploitation / exploration parameters 21. t = t + 1 22. end while 23. Foreach , apply threshold mapping to convert continuous values to binary. 24. return End |