# A Compact Bat Algorithm for Unequal Clustering in Wireless Sensor Networks
## 5 Experiments for Clustering in WSNs Problem
### Unequal Clustering Formation  
This unequal clustering scenario is studied to deal with the hot spot problem in WSN. The partitioned clusters in the network of uneven clustering have different sizes. The groups close to the BS are smaller than those clusters far from the BS. The clusters closer to the BS are the hotter clusters because the traffic relay load of the cluster heads near the BS is heavier than those CHs farther away from the BS [45]. To avoid this hot spot problem, we determine that the adjustable parameters are not only related to the objective function but also related to the optimization algorithm. For the objective function of constructing unequal clusters, each CH needs to adjust its equal cluster distances:  
\[D_{j}=D_{j}\times R_{c} \tag{23}\]  
where \(D_{j}\) is the distance from node CHj to the BS, and \(R_{c}\) is the ratio adjusting parameter. The calculation for \(R_{c}\) is defined as follows:  
\[R_{c}=\left[1-\alpha\frac{d_{max}-D_{j}}{d_{max}-d_{min}}-\beta \Big{(}1-\frac{E_{r}}{E_{max}}\Big{)}\right]\times R_{max} \tag{24}\]  
where \(d_{max}\) and \(d_{min}\) are the maximum and minimum distance of the CHs in the network to the BS, \(R_{max}\) is the maximum value of competition radius, \(\alpha\) is a weighted factor whose value is in \((0,1)\), and \(E_{r}\) is the residual energy of CHj. Clustering optimized formation is done by performing the optimal objective function in Equation (22) with the assistant of different distances Equations (23) and (24).  
Figure 5b compares two performance qualities in two scenarios of equal clustering and hot spot problems. Visibly, the average fitness values of the cBA method with a hot spot issue in the case of adjusting cluster size for the unequal clustering formation is faster than the regular case in convergence.  
For the optimization algorithm, we assigned the variable of loudness Ai for BA as in Equation (12) to correspond to the radius of the changing cluster size by bias iteration. We expressed mathematically the time-varying loudness of the BA as follows:  
\[A_{i}^{0}= (A_{max}-A_{min})\times\frac{(MaxIteration-Iter)}{MaxIteration}+A_{ min} \tag{25}\]  
where _MaxIteration_ is the number of the maximum iteration; _Iter_ is the current time steps, and \(A_{max}\), \(A_{min}\) are constants set to 0.5 and 0.25, respectively. The time varying loudness is mathematically represented in Equation (25) for cBA with a hot spot problem in WSN.  
Figure 6 compares the performance qualities in two cases of the selected parameter of the loudness for cBA with an adjusted cluster size with no selected altered loudness setting. Visibly, the average fitness values for the cBA method in the case of adjusting Ai for the unequal clustering formation is better than the regular case in convergence to remove the hot spot problem.  
Figure 7 shows a comparison of the advanced cBA-WSN with other methods, e.g., PSO-TVAC, PSO-TVIW, the low-energy adaptive clustering hierarchy (LEACH) [22], and LEACH-centralized (LEACH-C) [23] approaches regarding the number of nodes alive. LEACH is a clustering protocol that selects sensor nodes randomly as CHs based on probability as a \"threshold\" parameter. LEACH-C is another version based on LEACH with a base station (BS) and uses a specific method to select the CH and divide the nodes to clusters which can offer more optimization, and therefore it means the lifetime of the network is longer than LEACH. On the basis of observations, it is clear that the number of alive nodes of the proposed cBA-WSN is the longest. This means that the results of the proposed cBA-WSN for the testing functions and clustering problem in WSN is better than the other methods in the comparisons.