|
Algorithm 1 WOA |
|
Input: Maximum number of iterations , Fitness function , Current iteration number t, |
| A random number between −1 and 1, A constant number . |
| 1: Initialize the whales population
|
| 2: for each search agent do
|
| 3: Calculate the fitness function
|
| 4: end for
|
| 5: the best search agent |
| 6: while
do
|
| 7: for each search agent do
|
| 8: Update and
|
| 9: if
then
|
| 10: if
then
|
| 11: Update the position of search agent using Eq(2); |
| 12: elseIf
|
| 13: Select a random search agent ; |
| 14: Update position of search agent using Eq(8); |
| 15: end if
|
| 16: elseIf
|
| 17: Update the position with spiral Eq(5); |
| 18: end if
|
| 19: end for
|
| 20: Check if any search agent goes beyond the search space and amend it; |
| 21: for each search agent do
|
| 22: Calculate the fitness function
|
| 23: end for
|
| 24: Update if there is a better solution; |
| 25:
|
| 26: end while
|
| 27: return
|