|
Algorithm 6 Balance UAVs Across Clusters |
Input:
N: Total number of available UAVs.
M: Total number of existing tasks.
: Number of clusters.
C: Set of clusters, where each contains a subset of tasks.
Output:
|
|
Step 1: Compute the Initial Number of UAVs Per Cluster
-
1:
Compute the initial number of tasks per UAV:
-
2:
Initialize the number of unassigned UAVs:
-
3:
for to do
-
4:
Calculate the number of tasks in cluster :
-
5:
Compute the initial number of UAVs for cluster :
-
6:
Update the number of unassigned UAVs:
-
7:
end for
Step 2: Balance and Distribute Extra UAVs Among Clusters
-
8:
if then
-
9:
for to do
-
10:
Initialize the most crowded cluster:
-
11:
for to do
-
12:
Compute initial UAV load in cluster :
-
13:
if then
-
14:
Update the most crowded cluster index and load.
-
15:
end if
-
16:
end for
-
17:
Assign the extra UAV to the most crowded cluster.
-
18:
end for
-
19:
end if
-
20:
Assign UAVs to each cluster based on .
|