## 3 Fuzzy Logic-Based WSN Clustering
The node then advertises a CANDIDATE message with the chance value and likewise receives CANDIDATE messages from all other nodes of the network. If the chance value in and of itself is bigger than the other nodes, then the node announces itself as a cluster head and advertises CH_message. The nodes that are not cluster heads acknowledge the CH_message with Cluster_Join message. In this work, the authors have used de-fuzzification to transform the fuzzy variables into a single crisp value. The authors showed that any two cluster heads cannot exist within a distance \(r\), and more efficient cluster heads were elected as energy and distance were considered in the selection process. Further, the overhead calculation was reduced due to fuzzy logic and, finally, the network lifetime was enhanced. [PERSON] et al. [33] proposed a fuzzy logic-based energy-efficient clustering for wireless sensor networks on the basis of minimum separation distance imposition between cluster heads. In this work, the authors emphasized the fact that if the clustering algorithm exploits more energy affecting factors, then the clustering will be more efficient. The fuzzy inference system is used for obtaining better parameter integration. The presented work uses five parameters to elect the cluster head. The parameters are the residual energy, location suitability, density, compacting, and distance from the base  
Figure 3: Sensor nodes divided into three clusters, where each cluster has a cluster head that sends the captured data to the base station for further processing and analysis. station. On the basis of these five descriptors, cluster heads are selected, and the remaining non-cluster head nodes join one of the elected cluster heads. The authors set a minimum distance of separation between any two cluster heads to ensure even distribution. In addition, the authors used the Gini index to measure the energy efficiency of clustering algorithms in terms of their ability to balance the distribution of energy through the nodes. The performance of the presented work for various network densities and scenarios is compared with the existing methods. The authors showed that the proposed approach outperformed the existing work in terms of energy efficiency and network lifetime. [PERSON] et al. [34] proposed a neuro-fuzzy rule-based cluster formation and routing protocol for efficient routing in IoT-based WSNs. The authors identified that in most of the fuzzy-based clustering protocols available in the literature, the cluster size is not considered, which may lead to non-uniform energy consumption. Most of the work in the literature addressed fuzzy rule-based clustering for stationary nodes and used a probabilistic approach for decision-making. To overcome these limitations, the authors used parameters such as cluster head energy, the distance between cluster head and base station, change in the distance between cluster head and member nodes due to mobility, and cluster head degree as inputs to the fuzzy inference system. In the proposed protocol, the network is trained and tested utilizing a convolutional neural network with a neuro-fuzzy rule manager for weight adjustment. In this work, the base station sent HELLO packets to all the nodes, and the distance between the nodes and base station was computed. Clusters were formed using \(k\) means clustering algorithm and the base station performed cluster head selection by considering the distances and nodes' energy levels. The authors used a fuzzy reasoning approach for proper cluster formation followed by efficient routing. Further, the authors adopted the Mamdani inference system in making a decision. De-fuzzification mapped the fuzzy set to a crisp set for exact decision-making. Once the cluster head was elected, the nearby nodes had to decide to join one of the elected cluster heads. In this process, the fuzzy inference system used the four input parameters as mentioned earlier.