# Cluster-Based Control Plane Messages Management in Software-Defined Flying Ad-Hoc Network
## 3 Cluster-Based Control Message Management for FANET
### Cluster-Based Operations  
For large-scale environments, it might be required multi-hop communication to disseminate control message. Thus, we consider a hierarchical network architecture, where UAVs are organized into groups with a set CH (i.e., local controller) to perform more complex tasks, such as, controlling of each group members, collecting data from non-CHs for data aggregation, forwarding control messages to/from the controller node CN, take local decision, and sending aggregated data to the controller. In this way, we introduce a clustering-based algorithm to define a suitable position for a set of \(CN_{fw}\), which behaves as CH. Moreover, the number of forwarders \(n_{fw}\) is adjusted by considering UAVs' location. The approach makes use of a partition-based clustering algorithm to allocate \(n_{fw}\) forwarder nodes \(CN_{fw}\) every time interval \(T_{fw}\). The implemented clustering method considers two well-known algorithms: Fuzzy C-means [35] for clustering and the Gap statistics [36] to define the number of clusters. Specifically, Gap statistics estimates an optimal number of clusters by finding a way to standardize the comparison with a null reference distribution of a data, i.e., a distribution with no obvious clustering. On the other hand, Fuzzy C-means allows one piece of data to belong to two or more clusters. To this extent, a UAV might be attended by more than one forwarder node, and it is up to the UAV do decide its next-hop address by simply evaluating the signal strength of each \(CN_{fw}\). The different membership degree provided by Fuzzy C-means for each group enables to change the groups easily and quickly, in case a CH could fail, or a UAV could move closer to other CH. The first step is to iterate over predefined cluster numbers (\(c\in[1,2,3,...,C]\)) computing the Fuzzy C-means objective function \(J_{c}\) based on Equation (8), which gives a measure of the compactness of the first clustering. It considers the cluster index \(c\), the membership coefficient \(u_{ic}^{m}\), the _fuzzification_ index \(m\) (\(m\in R\), with \(m>1\)) to control the shape of membership functions, and the Euclidean distance \(D_{ic}^{2}\) between the \(i^{th}\) object and the \(c^{th}\) cluster center. In addition, we consider a predefined set of random positions \(B\), which the objective function \(J_{c,b}^{*}\) is calculated for each set (\(b\in[1,2,3,...,B]\)). \[J=\sum_{i=1}^{N}\sum_{c=1}^{C}u_{ic}^{m}D_{ic}^{2} \tag{8}\]  
Figure 2: Control message transmission behavior of the network. The Gap statistics (\(Gap(c)\)) function compares the objective functions of the sets B and the original positions, which is computed based on Equation (9). It returns the information of how organized the positions are for each cluster number \(c\), compared to a set of disorganized positions. In light of this, the clustered index maximizes the value of this function, should give a good approximation of the cluster number to be used. \[Gap(c)=\left(\frac{1}{B}\right)\sum_{b}\log\left(J_{c,b}^{*}\right)-\log\left(J _{c}\right) \tag{9}\]  
Gap statistics (\(Gap(c)\)) function usually returns an average gap value, since it is not an exact method. For an accurate view of the value returned from Equation (9), the standard deviation (\(sd(c)\)) for each cluster number \(c\) is computed based on Equation (10). \[sd(c)=\sqrt{\frac{\sum_{b}\left(\log(J_{c,b})-\frac{1}{B}\sum_{b}\log\left(J_{ c,b}^{*}\right)\right)^{2}}{B}} \tag{10}\]  
The intersection between the simulation error \(s(c)\), represented in Equation (11), and the maximum values of \(Gap(c)\) is computed, and the smallest value from \(c\) is defined as the optimal number of clusters estimated. \[s(c)=sd_{c}\sqrt{1+B^{-1}} \tag{11}\]  
A fuzzy clustering is a collection of \(k\) clusters, \(c_{1},c_{2},...,c_{k}\), and a partition matrix \(M=m_{i,j}\in[0,1]\), for \(i=1...n\) and \(j=1...k\), where each element \(m_{i,j}\) is a membership indicator that represents in what degree an object \(i\) belongs to a cluster \(c_{j}\).