# Topology Duration Optimization for UAV Swarm Network under the System Performance Constraint
## 4 The Proposed GTSC Method
### Optimal Cluster Head Selection Algorithm  
In this paper, in order to obtain a good performance on the stability and energy balance, we employ a double cluster head scheme. In clustering based method, since the cluster head is the hub of data interaction between nodes of intra- and inter-cluster, it always plays an important role for enhancing the system performance. Here, we develop the optimal cluster head selection algorithm by jointly considering key factors that will affect the performance of the UAV swarm, which includes (i) intra-cluster distance \(f_{Intra}\): the average intra-cluster distance directly affects the overall energy consumption of the cluster; (ii) residual energy \(f_{E}\): the residual energy determines whether a node is capable of being as a high energy consuming node for a long time; (iii) inter-cluster distance \(f_{Intr}\): the average inter-cluster distance simultaneously has a influence on the energy consumption of cluster heads and the backbone network throughput; (iv) inter-cluster relative mobility \(f_{M}\): the trend approximation of inter-cluster relative mobility reflects the connection stability between cluster heads; (v) inter-cluster forwarding hops \(f_{HOP}\): the inter-cluster forwarding hops is the most critical factor affecting inter-cluster end-to-end data transmission delay. In order to have a comprehensive consideration of above factors, we define the weighted function for the cluster head candidate nodes as  
\[F(node_{i})=\mu_{1}f_{Intra_{i}}+\mu_{2}f_{E_{i}}+\mu_{3}f_{Inter_{i}}+\mu_{4}f _{M_{i}}+\mu_{5}f_{HOP_{i}} \tag{24}\]  
where \(\mu_{1}\),\(\mu_{2}\),\(\mu_{3}\), \(\mu_{4}\), \(\mu_{5}\) are weights, and \(\mu_{1}+\mu_{2}+\mu_{3}+\mu_{4}+\mu_{5}=1\). Furthermore, in consider of convergence speed, we divide the cluster head selection algorithm into two phases, i.e., rough selection and fine selection. In the phase of rough selection, we select several cluster head candidates within each cluster based on the intra-cluster distance factor \(f_{Intra}\), which is calculated as  
\[f_{Intra_{i}}=\frac{1}{N_{c}\!-\!1}\sum\limits_{j=1,j\
eq i}^{N_{c}}d_{ij} \tag{25}\]  
where \(N_{c}\) is the number of nodes in the cluster. Then we select several nodes with minimum \(f_{Intra}\) to form the cluster head candidates set in each cluster. Such rough selection ensures that the position of cluster head candidates is at the center of the cluster, which will shorten the distance between cluster head and cluster members. In the phase of fine selection, the weighted function of the cluster head candidate nodes can be simplified as  
\[F(node_{i})=\mu_{2}f_{E_{i}}+\mu_{3}f_{Intra_{i}}+\mu_{4}f_{M_{i}}+\mu_{5}f_{ Hop_{i}} \tag{26}\]  
Then we select two nodes with maximum value of \(F(node_{i})\) as the final double cluster heads within each cluster. The factors of \(f_{E_{i}}\), \(f_{Intra_{i}}\), \(f_{M_{i}}\), \(f_{Hop_{i}}\) are analyzed as follows. In UAV swarm network, the cluster head is responsible for both data transmission among intra-cluster nodes and data forwarding between inter-cluster nodes. This results in the energy consumption of cluster heads being much greater than that of the cluster members. Therefore, the initial residual energy of nodes has to be considered in the cluster head selection process. The factor of residual energy of candidate nodes is normalized as  
\[f_{E_{i}^{0}}=\frac{E_{i}^{0}}{E_{\text{max}}} \tag{27}\]  
where \(E_{\text{max}}\) is the maximum energy capacity of the UAV node. In phase of fine selection, we consider the average distance between cluster heads to satisfy the network throughput constraint. The inter-cluster distance factor is normalized as  
\[f_{Inter_{i}}=\frac{\sum\limits_{j=1}^{N_{CH}}d_{ij}}{N_{CH}d_{max}} \tag{28}\]  
where \(N_{CH}\) is the total number of cluster head candidates in all clusters, \(d_{max}\) is the maximum euclidean distance between cluster heads. The mobility relativity between inter-cluster heads can be calculated based on the velocity similarity sim- \(v_{ij}\) in Equation (22).