Skip to main content
. 2022 Sep 27;24(10):1366. doi: 10.3390/e24101366
Algorithm 1: CH Selection Based on BWOA
Input:UAVi, i = 1, 2, …, N.
Output: Cluster head CHj, j = 1, 2, …, K.
/* Initialization phase*/
1: Initialize the whale population X=[X1,X2,,XN].
2: Initialize iteration t=1, maximum number of iterations tmax.
3: Calculate the fitness of each whale.
4: Choose the best solutions X*(t)
/* Computation*/
5: while (t<tmax), do
6:     for each search agent, do
7:         Update A, C and a by (10)–(12).
8:         if p < 0.5 then
9:            if |A|<1 then
10:               Update D1 by (8) and γ1 by (17).
11:               Update the position X based on (18).
12:            else
13:         Select a random Xrand and update D3 by (15) and (16).
14:         Update γ3 by (21) and the position X by (22).
15:           end if
16:        else
17:            Update D2 by (14) and γ2 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).
22:     Update X*(t) of the best search agent.
23:     t = t + 1
24: end while
25: return CHs