Skip to main content
. 2023 Jan 10;23(2):815. doi: 10.3390/s23020815
Algorithms 1: Pseudo-code for WOA.
Initialize whale population Xi of Nw and maximum number of iterations tmax
Calculate fitness of each search agent Xi
Find initial best search agent X*
while (t<tmax)
      for each search agent Xi
            Update a, A, C, l and p
                  if (p<0.5)
                        if (A<1)
                              Update Xi by Equation (11)
                        else if (A1)
                              Randomly select Xrand from population
                              Update Xi by Equation (17)
                        end if
                  else if (p0.5)
                        Update Xi by Equation (14)
                  end if
            end for
      Adjust all Xi if they are out of solution range
      Calculate fitness of all Xi
      Update X* if a better Xi is found
      t=t+1
end while
return X*