Skip to main content
. 2021 Aug 18;21(16):5571. doi: 10.3390/s21165571
Algorithm 1 Algorithm of WOA
Input: Number of whales (n), Max_Iter
Output: Prey or the fittest whale
Generate Initial Population Xi (i=1, 2, , n)
Calculate the objective value of each solution
     X*=the best solution
while (p<Max_Iter)
for each solution
Update s, K, J, l, and t
if (t<0.5)
if (K<1)
Update the current solution’s position by Equation (5)
else if(K>1)
Select a random solution (Xr)
Use Equation (12)
end if
else if (t>=0.5)
Update the current solution’s position by the Equation (9)
end if
end for
Check whether there is any solution present beyond the search space and update it
Calculate each solution’s fitness
If a better solution is found, update X*
     p=p+1
end while
return X*