Skip to main content
. 2023 Mar 16;23(6):3171. doi: 10.3390/s23063171
Algorithm 1. WOA
1 Initialize search agents
2 Evaluate fitness function.
3 jt  →  0
4 X* = the best possible search agent
5 while jt < MaxIteration do
6   foreach SearchAgent do
7    Update A, C, l, p, and a.
8    if p ≥ 0.5 then
9      X (jt + 1) = Updating the position of search agent by spiral method in
        Equation (5).
10   else
11      if |A| < 1 then
12        X (jt + 1) = Updating position of the current search agent by using
           encircling mechanism Equation (2).
13      else if |A| ≥ 1 then
14        Random search agent is selected
15        X (jt + 1) = Updating position of the current search agent by using prey
            searching method in Equation (8).
16      end if
17   end if
18   end foreach
19   If there is a better solution, update X* = X (jt + 1).
20   jt = jt + 1
21 end while
22 return X*