Skip to main content
. 2020 Jun 1;20(11):3134. doi: 10.3390/s20113134
Algorithm 3. CLUSTER FORMATION
for i: 1 to N
j = i;
while(j > 1 &&benergy (j − 1) >benergy (j))
swap(benergy (j), benergy (j − 1))
swap(lat(j), lat(j − 1))
swap(long(j), long(j − 1))
swap(alt(j), alt(j − 1))
j = j − 1;
end
end
for all drones n :
q = n/4;
h = n/2;
hq = h+q;
arr1 = arr(1:q);
arr2 = arr(q + 1:h);
arr3 = arr(h + 1,hq);
arr4 = arr(hq + 1,n);
optarr1[arr1 ][arr4 ];
optarr2[arr2] [arr3 ];
end
for each cluster do
fordronekdo
Calculate distance of dronek from other drones;
Update dronek position ;
Calculate Bopt value;
ifBoptgbest then
gbest = Bopt;
end
end
Elect dronek as leader;
end