| Algorithm 1: CH Selection Based on BWOA |
|
Input:, i = 1, 2, …, N. |
|
Output: Cluster head , j = 1, 2, …, K. |
| /* Initialization phase*/ |
|
. |
|
. |
| 3: Calculate the fitness of each whale. |
|
| /* Computation*/ |
| 5: while
), do
|
| 6: for each search agent, do |
| 7: Update A, C and a by (10)–(12). |
| 8: if
p < 0.5 then |
| 9: if
then
|
|
by (17). |
| 11: Update the position X based on (18). |
| 12: else
|
|
by (15) and (16). |
|
by (21) and the position X by (22). |
| 15: end if
|
| 16: else
|
|
by (19). |
| 18: Update the position X by (20). |
| 19: end if
|
| 20: end for
|
| 21: Calculate the fitness of each search agent by (39). |
|
of the best search agent. |
| 23: t = t + 1 |
| 24: end while
|
| 25: return CHs |