# An Unequal Clustering and Multi-Hop Routing Protocol Based on Fuzzy Logic and Q-Learning in WSNs
## 1 Introduction  
WSNs typically consist of numerous energy-constrained sensor nodes that are distributed across a designated area. These nodes are generally deployed in a random manner and are capable of sensing environmental data, processing them locally, and transmitting the information to the BS [1, 2, 3]. WSNs provide substantial capabilities across diverse applications, including in science, the military, healthcare, engineering, environmental monitoring, home automation, area surveillance, and disaster response [4, 5, 6]. Due to their placement in remote locations, replacing the batteries of sensor nodes is often challenging. These batteries are gradually depleted during the processes of sensing, data aggregation, and transmission. Therefore, finding effective solutions to reduce energy consumption in WSNs continues to be a major challenge [7, 8, 9].  
Clustering is a widely used strategy to improve energy efficiency and extend the lifespan of WSNs [10, 11]. In the clustering mechanism, CHs aggregate data from member nodes and transmit them to the destination node, either directly or through intermediate CHs [12, 13]. To minimize energy consumption, many clustering protocols employ a multi-hop method where CHs near the BS serve as relays to forward aggregated data from other CHs to the BS. However, these CHs near the BS experience significantly higher traffic loads and energy consumption compared to other nodes, making them more vulnerable to rapid energy depletion and contributing to the hotspot issue within WSNs [14, 15]. To overcome this challenge, numerous techniques for unequal clustering have been proposed. These approaches segment the network into clusters of different sizes, positioning smaller ones nearer to the BS and larger ones at a greater distance [16, 17].  
Clustering and routing protocols are considered NP-hard optimization problems, where optimal or near-optimal solutions can be attained through intelligent computational methods such as fuzzy logic [18] and Q-learning [19]. Fuzzy logic, in particular, excels at handling the uncertainties inherent in clustering and routing, offering greater flexibility than traditional crisp logic. By effectively integrating various input parameters, fuzzy logic helps derive optimal solutions, making it a popular choice for CH selection [18]. In contrast, reinforcement learning (RL) is highly effective for addressing routing challenges in WSNs due to its ability to capture the dynamic nature of the network and environment. In this context, the action of each sensor node involves selecting the next hop to forward sensed data to the sink node. Among RL algorithms, Q-learning, a model-free approach, is widely used in routing problems within sensor networks, enabling adaptive and efficient route optimization [19].  
This work addresses the hotspot issue in WSNs by adopting a hybrid strategy that combines fuzzy logic with Q-learning to improve both clustering and routing efficiency. The main contributions of this study, introduced through the FQ-UCR algorithm, can be summarized as follows:  
1. The CH selection probability is calculated using inputs such as residual energy, distance to the BS, the number of neighbors, and node centrality.
2. The selection of a relay CH is based on maximizing both the Q-value and the associated reward.
3. The proposed algorithm was simulated to showcase its advantages over existing algorithms, such as the EEUC [20] and CHEF [21] protocols. The structure of this paper is as follows: Section 2 provides an overview of related research and is followed by Section 3, which presents the fundamental model of the proposed algorithm. Section 4 offers a thorough breakdown of the proposed FQ-UCR algorithm. In Section 5, the simulation results are presented. Finally, Section 6 wraps up the paper and discusses avenues for future exploration.