Skip to main content
. 2024 Dec 26;25(1):72. doi: 10.3390/s25010072
Algorithm 1: HAMO-based clustering.
Input: Number of UAVs N, 3D positions of UAVs Pi=(xi,yi,zi), velocity of UAVs (Vxi,Vyi,Vzi), UAV residual energy E(i), and maximum energy level of UAVs Emax.
Output: Initial clusters Ck with CHs
# Step 1: Initialize population
1: for each UAV i in {1, 2, , N} do:
2:  initialize UAV[i] with:
3: ID: IDi, Pi=(xi,yi,zi), (Vxi,Vyi,Vzi), and E(i)
4: end for
# Step 2: Initial cluster assignment
5: for each UAV i in {1, 2, , N} do:
6: Calculate distance dij, between UAV[i] and all other UAVs j using (1)
7: Assign UAV[i] to the nearest cluster Ck based on dij
8: end for
# Step 3: CH selection using local information9: for each cluster Ck do:10: for each UAV i in Ck do:11:  Calculate fitness score for UAV i based on (11)12:  Select the UAV with maximum fitness score FCHi as CH13: end for# Step 4: Output summary of cluster formation14: Output the list of clusters Ckwith their corresponding CHs