LEACH Protocol Optimization Based on Weighting Strategy and the Improved Ant Colony Algorithm

This article aims to address problems in the current clustering process of low-energy adaptive clustering hierarchy (LEACH) in the wireless sensor networks, such as strong randomness and local optimum in the path optimization. This article proposes an optimal combined weighting (OCW) and improved ant colony optimization (IACO) algorithm for the LEACH protocol optimization. First, cluster head nodes are updated via a dynamic replacement mechanism of the whole network cluster head nodes to reduce the network energy consumption. In order to improve the quality of the selected cluster head nodes, this article proposes the OCW method to dynamically change the weight according to the importance of the cluster head node in different regions, in accordance with the three impact factors of the node residual energy, density, and distance between the node and the sink node in different regions. Second, the network is partitioned and the transmission path among the clusters can be optimized by the transfer probability in IACO with combined local and global pheromone update mechanism. The efficacy of the proposed LEACH protocol optimization method has been verified with MATLAB simulation experiments.


INTRODUCTION
It is known that wireless sensor networks (WSNs) are composed of many spatially distributed sensor nodes with limited energy (Efe et al., 2013), whereas the sensor nodes are usually powered by light batteries. Frequent charging or battery replacement of the sensor nodes would cause inconvenience to maintenance; hence, balancing the energy consumption of sensor nodes and prolonging the network lifetime are the two most important indicators to evaluate the performance of the WSNs (Tripathi et al., 2013;Mukherjee et al., 2018). The energy loss of the network can directly affect the performance and life of the network, which should be delicately dealt with to keep the low energy loss of the network in the communication process (Yan et al., 2018;Mohar et al., 2020;Lv et al., 2021). Many routing protocols can be used in WSNs, where hierarchical routing protocols are the most widely adopted. The typical hierarchical routing protocols include lowenergy adaptive clustering hierarchy (LEACH), power-efficient gathering in sensor information systems (PEGASIS), threshold-sensitive energy-efficient sensor network (TEEN) protocol, and hybrid energy-efficient distributed (HEED) clustering approach, which can gather the nodes into clusters to form a specific hierarchy (Galkin, 2018). Particularly, the typical LEACH protocol was proposed by Heinzelman (2000) and adopted the "wheel" cycle mode for the first time, which is widely applied due to its low power consumption, node equality, and self-clustering adaptation. In such a protocol, each sensor node contains a clustering algorithm and a data transmission algorithm among nodes (Chen et al., 2015), where the clustering algorithm can randomly change the cluster head nodes by comparing the size of the random number and threshold. After deployment, all sensor nodes self-organize to form different clusters. Generally, each cluster contains a cluster head node and multiple sensor member nodes. The nodes of the specific cluster can only hop one step inside the cluster to the cluster head. The cluster head node of each cluster will also hop one step to transmit the received information to the sink node to complete an iteration circle. The structure of the LEACH protocol is illustrated in Figure 1.
In the LEACH protocol, the energy of the sensor nodes is evenly distributed, and the network duration can be prolonged by balancing the energy consumption of the sensor nodes (Wang et al., 2018). However, the random selection of the cluster head nodes in the protocol could lead to uneven distribution of the cluster head nodes, which is prone to a large or small number of member nodes in the cluster (Marappan and Rodrigues, 2016). Each cluster head node and the base station adopt a singlehop transmission mode, which could easily cause premature death of the remote cluster head, poor expansibility, and uneven energy consumption phenomena in the network. The replacement mechanism of clusters using wheels will speed up the replacement frequency of the cluster head, which could result in more times of the information transmission in the network and shortened network life (Rahman et al., 2013;Jameii and Maadani, 2016). Then, the LEACH protocol has been improved with the fractional lion (FLION) algorithm to generate FIGURE 1 | Network structure diagram of LEACH protocol. the optimal route (Sirdeshpande and Udupi, 2017), whereas the fractional derivative is introduced to detect the neighbor solution, and the forward link algorithm is also used to select channels to improve the network survival duration. However, the distribution density of the nodes is not considered in the fitness function. Lalwani et al. (2018) used the harmony search algorithm (HSA) to determine the optimal routing, where the fitness function is designed considering the node density, energy, and distance factor, by choosing the smallest distance nodes for data transmission so as to achieve the energy consumption reduction of the nodes. However, when the cluster contains nonlocal nodes, the network performance will be affected. Ning et al. (2017), Ezhilarasi (2019) adopted an improved particle swarm optimization (PSO) to optimize the clusters of the WSN process. However, the selection rules of the cluster head node are relatively complex, and the cluster scale rapid update frequency consumes high energy due to fast convergence. At the same time, local optimum would easily occur. Hence, certain algorithms are proposed to tackle such problems, where the cuckoo search algorithm (CSA) (Huang and Hua, 2020) and the fruit fly algorithm (FFA) (Dai et al., 2020) are developed to optimize the cluster and routing protocol and to determine the transmission path according to the distance, energy, and trust value from the node to the base station such factors. However, the generalization capability of the surviving nodes during communication has not been considered (Maheshwari et al., 2021).
In recent years, some improved heuristic intelligent algorithms have become research hotspots. For instance, the ant colony optimization (ACO) algorithm has been extensively studied and applied since it can assist to select the optimal path for the fused data transmission and the network life cycle extension (Ding, 2020). Experts and scholars have explored the ACO algorithms to reduce the energy consumption of the nodes. An ACO multipath routing protocol has been proposed based on the angle factor and entropy to optimize the cluster head nodes with high reliability in the process of data transmission (Hou et al., 2017;Liu and Li, 2018). To tackle the energy consumption balance problem, Zou and Qian (2019) proposed improved ACO (IACO) with a sensor node transfer function and pheromone updating routing rules for optimal WSN routing but with little consideration of the impact factors. Nayyar and Singh (2020) proposed an energy-saving multipath routing protocol based on the ACO algorithm for dynamic WSNs, in which the optimal path for the adjacent nodes is designed, but the scalability is poor. Therefore, it is of great significance to investigate the method to improve the transmission performance of the WSNs and select the optimal data transmission path quickly and effectively. This article aims to propose an IACO algorithm for the LEACH protocol optimization. The specific sections are as follows: the first section is the improvement of the clustering algorithm based on optimal combination weighting. Furthermore, the designed transmission path between clusters based on the IACO algorithm is proposed in section Improved Clustering Algorithm Based on OCW. Simulation experiments for the proposed LEACH protocol optimization verification are described in section Energy Consumption Analysis of the Sensor Node. The Conclusion is given in section Optimization of the Transmission Path Between Clusters Based on IACO. Table 1 compares the energy-saving, cluster establishment time, uniform distribution of cluster head nodes, and path selection of the representative typical routing protocols.

IMPROVED CLUSTERING ALGORITHM BASED ON OCW
The Update Mechanism of the Cluster Head Node In the LEACH, cluster head nodes are replaced at each round, which would increase the network power consumption. Therefore, the cluster head nodes are updated within the existed clusters for the whole network clusters. The node whose energy is lower than the average energy E a in the cluster loses the qualification to be the cluster head node, whereas the node with the highest remaining energy in the cluster is defined as the cluster head node of the next round, and the average energy E a in the cluster is defined as, where E i is the remaining energy of the surviving node i in the cluster and N alive is the total number of the surviving nodes. If the energy of the current cluster head nodes is lower than this value, WSNs update the cluster size. The average energy E all of all the cluster head nodes in the whole network is calculated as, where E r and B are the residual energy and the total number of the cluster head nodes.

Improved Threshold for Cluster Head Node Selection
The improved LEACH protocol has the same rules as cluster head selection in LEACH protocol, while the selection threshold is defined as T imp (n), written as, where E 0 is the initial energy of the survived node, l alive is the number of the existing neighboring nodes, d max is the distance from node i to the sink node, d max and d min are the farthest and closest distance from the surviving node to the sink node, respectively, and {ω 1 , ω 2 , ω 3 } are the weights of the node energy consumption, density, and distance, respectively. In the improved threshold, the probability of being selected as the cluster head node is related to the energy, density, and distance from the sink node. As the remaining energy of the node decreases and the smaller the energy ratio is, the lower the probability of the node being selected as the cluster head node. If node i is the closest to the sink node, the distance factor is 1, otherwise, the distance factor is 0. Therefore, the range of the distance factor is between 0 and 1, and the closer the distance to the sink node, the closer the value to be 1.

Threshold Weight Selection
To ensure the rationality for the cluster head nodes selection, the optimal combined weighting (OCW) is used to adjust the three weights of the improved threshold, which combines the analytic hierarchy process (AHP) and the entropy method to ensure the objectivity of the threshold weight.

Weight of AHP
The AHP method can decompose the problems into different levels with an evaluation index matrix to solve the maximum eigenvalues of the matrix and the corresponding eigenvector, so as to conduct a consistency test to obtain the weight of different evaluation indices (Yang et al., 2017). However, if the AHP method is used alone, the weight cannot be reasonable due to the large subjective component and certain persuasiveness. Still, the AHP method can be applied to determine the threshold weight in WSNs, and the steps are described as follows: (1) Construction of the structural model of the cluster head node selection. The hierarchical model of the threshold weight in where c ij is the measurement value of the evaluation index, and c ji = 1 c ij . The value of the c ij usually adopts Santy's 1-9 scale method as listed in Table 2.
According to the importance of the impact factors in different regions, evaluation index matrices corresponding to influencing factors can be obtained from different hierarchical models, as shown in Eq. (5).
(3) The calculation of the AHP weight. According to Eq. (6), the maximum eigenvalue and eigenvector of the evaluation index matrix can be obtained, λ max and W, respectively, where the corresponding eigenvector is W = [W 1 W 2 W 3 ] T , and the obtained normalized weight is written in Eq. (7). The eigenvalue of Eq. (5) is 3.0037, and the weight of the energy, density, and distance are 0.581, 0.309, and 0.109 respectively.
Frontiers in Neurorobotics | www.frontiersin.org  (8), (9), and (10). The consistency index of the weight values of the tested regions 1 and 2 is 0.0018, and the consistency ratio is 0.0032.
where, RI is the average consistency indicator, and CR is the consistency ratio. If C meets the consistency test, CR < 0.1. CI is a consistency indicator and CI = 0 with a high degree of consistency C.

Weight of Entropy Method
The entropy method is an objective weighting method without considering the correlation among factors. Here, the entropy method is applied to determine the threshold weight in WSNs. Assuming WSNs containing n (n = 1,2,. . . , N) sensor nodes, the impact factor of the nth node is f nt t (t = 1,2,. . . , T), to affect the threshold of the cluster head node selection.
(1) Analysis of the impact factors. According to Eq. (11), the impact factors are determined as the energy f n1 , distance f n2 , and relative density f n3 of the nth nodes, (2) The entropy method for the weight of impact factors determination.
(a) The above three impact indicators are normalized as, where max(f nt ) and min(f nt ) are the maximum and minimum of the impact factors, respectively. The evaluation matrix R of the normalized impact factor is obtained as, The weight of the tth impact factor, E t is expressed as, where P nt is the proportion of the t impact factor of the nth node under all indicators of the node.
(c) The entropy value (weight) of each impact factor is written as,

Optimal Combined Weighting
The OCW is a method where both the quantitative and qualitative analyses are used to reasonably allocate the weight, and how to allocate the weight of the AHP and entropy is the key of this method (Yang et al., 2017). The weight calculation of the OCW method can be expressed as, where ω t , ω Ai , and ω St are the weights of the optimal combination, AHP, and entropy method, respectively. λ 1 and λ 2 are the importance degrees of the AHP and entropy methods, respectively.

A Bunch of Rules
Once the cluster head nodes are determined, they are broadcast inside the WSNs so that the rest sensor nodes are invited to join specific clusters. If a sensor node receives multiple invitation messages within a period of time, it will determine the distance between the cluster head nodes and itself according to the strength of the received information, then make the decision to join the closer cluster and transmit the requested information to the specific cluster head node. The cluster head node receives the distributed information from each member node and decides which nodes can be joined. Then, the clusters can be established, and it enters the data transmission stage.

ENERGY CONSUMPTION ANALYSIS OF THE SENSOR NODE
The differences in energy consumption with different routing protocols can be used to evaluate the transceiver characteristics of the sensor nodes. Hence, a typical radio energy consumption model is usually adopted, including the energy consumption of the data transmitting circuit and the power amplifier circuit (Yang et al., 2017), as demonstrated in Figure 3.
There are mainly two energy consumption models for the WSNs, i.e., free-space models and multipath fading models, the adoption of which depends on the distance between the sender and the receiver (Li et al., 2020) and written as, where E TX−elec (l) is the loss of the transmitting circuit energy, E TX−amp (l, d) is the loss of the amplification circuit energy, and E elec is the energy loss of the sender/receiver when performing data transmission. The calculation of the threshold of the data transmission distance is written as, where ε fs and ε mp represent the amplification energy consumption parameters of the free-space model and the multipath fading model, respectively. The type of the transmitter amplifier determines the values of the two parameters.

OPTIMIZATION OF THE TRANSMISSION PATH BETWEEN CLUSTERS BASED ON IACO Flow Pattern Division
According to the energy consumption model, the energy consumption of the nodes takes the distance threshold d 0 as the intermediate value, so the regions can be divided by the data transmission distance threshold d 0 in the LEACH protocol optimization. The range (d min ≤ d i ≤ d 0 ) within the distance from the sink node d 0 is area 1, and the range within the range of WSN nodes (d 0 ≤ d i ≤ d max ) is area 2. The partitioning diagram is illustrated in Figure 4. In WSNs, the node positions are usually fixed after deployment. When d i ≤ d 0 , the distance between nodes will not be regarded as the main impact factor, so the weight in the threshold will change. In contrast, when d 0 ≤ d i , the energy consumption of the node transmission and the distance between nodes increase to the fourth power. Hence, distance is the main impact factor. The weight in Eq. (19) will change with the importance of the impact factor.

Transmission Path Optimization Among Clusters Based on the IACO Algorithm
The ACO algorithm is a heuristic optimization method, which can be used to search the optimal path through individual efforts and group cooperation via accumulated pheromones on the path with positive feedback (Song and Yao, 2017;Li et al., 2020). In WSNs, the optimization of the transmission data path of the routing protocol has the same characteristics as the ACO algorithm to obtain the best foraging route for ants. The application of the ACO algorithm in WSNs still has some limitations, including low path efficiency and the appearance of local optimal solution. Here, the developed IACO algorithm is applied to WSNs to conduct path optimization from three aspects, improved transition probability, path superiority, and pheromone updating mechanism.

Transfer Probability Improvement
The transition probability of the ACO algorithm considers only the path pheromone concentration and the distance between two nodes. The ant in the process of the optimal path search can also increase the probability of invalid path search and reduce the efficiency of path construction. Because the impact factors are not comprehensive, the flow of the data transmission of the nodes is larger, which could result in premature death affecting the network operation.
By using the ACO algorithm in WSN, the distance between two nodes is only considered in the next hop of the cluster node selection, which could cause more candidate nodes and a large amount of data transmission accompanied by more energy consumption. In this article, the transition probability is fully considered with the node energy for the ants' node search ability enhancement, so as to speed up the convergence speed, and the developed transition probability function is formatted as, where allowed k is the cluster head node set where k nodes have not been reached, E j is the remaining energy of the next hop node, and E iave is the average energy of the adjacent nodes of node i. τ ij is the pheromone concentration of the path from node i to node j, and η ij is the heuristic function to be defined for the cluster head node Based on the forwarding distance j node and the distance of the aggregation node, written as, where d ij is the Euclidean distance between node i and the next hop node j, and d js is the Euclidean distance between the next hop node j and the sink node.

Path Superiority Determination
When all ants are transferred to the sink node, each ant corresponds to a transmission path, so the path superiority degree can be used as the standard to measure the optimal path. The ant with a higher superiority degree is the optimal transmission path. In the previous path optimization process, the path with higher average energy is highly likely to be the best transmission path; however, the mean energy cannot represent the current node energy level. For instance, if certain nodes have high energy mean, but the energy difference between the actual nodes is substantially large, it will cause premature death of the nodes and failure of the transmission path. The path superiority is thus reflected from the lower hop count, higher mean energy, and uniform energy distribution. The higher the path superiority, the higher quality of the selected transmission path. The variation coefficient is defined by the ratio between the SD and mean of the data, which is used to evaluate the difference degree of the data distribution. The smaller the coefficient of the variation, the more uniform the data distribution, and the smaller difference between the data (Zhu, 2017). Therefore, the path variation coefficient P cv is used to analyze the energy balance of the nodes. where P sd is the SD of the energy of all nodes in the path P m , E ave is the mean energy of all nodes in the path, and δ is the number of nodes contained in the path. Hence, the path superiority P s can be written as, where E min is the minimum of the node energy, E con is the sum of the node energy consumption, and J is the total hop number in the path.

Pheromone Updating
In the ACO algorithm, the pheromone concentration varies according to the length of the path, and ants plan the next route according to the pheromone concentration of different paths. Ants tend to choose paths with higher pheromone concentrations, and other paths are ignored. As a result, the path searching will fall into the local optimization, the ant will no longer search for new paths and the path searching process stops. Therefore, the IACO algorithm adds local and global pheromone updates to inter-cluster transmission path planning to avoid such local optimum problems. The developed pheromone updating mechanism is written as, where ρ is the parameter regulating the pheromone volatilization speed, τ ij (t) is the pheromone increment in the path, τ ij (0) = 0 at the initial time, and τ k ij (t) is the pheromone concentration left by the kth ant in the path (i, j).
• Local pheromone update: If the ant node carries out data forwarding from the cluster head node i → j, the pheromone concentrations of the corresponding paths should be locally updated, where E r (j) is the number of the member nodes in the next hop node. • Global pheromone update: When all ants move to the sink node, each ant corresponds to a transmission path, and the pheromone concentration of the path is updated globally. Based on the path superiority, the global update rules is written as, The LEACH protocol is optimized with the improved clustering algorithm to cluster sensor nodes, and the influence factors of nodes in different network regions are different so as to replace the cluster head nodes dynamically. When the energy of the cluster head node reaches the limit value, the cluster is updated and the data are fused in the cluster head node. Although the IACO algorithm is used to find the optimal transmission path between clusters, it can effectively avoid the stagnation of the IACO algorithm in the local optimum. The specific process is depicted in Figure 5.

EXPERIMENTAL VERIFICATION AND ANALYSIS Experimental Environment Setting
The experiment verification is carried out in a MATLAB simulation environment, and 200 sensor nodes are deployed in a 200 × 200 m network area. The node deployment within the network is shown in Figure 6, where the circle with sink node is the center, the area with the threshold distance R as the radius of the circle is area 1, and the rest is area 2. The parameters of the basic network and IACO algorithm in the experiments are listed in Tables 3, 4.

Performance Indicators
The life cycle of the network, the total energy consumption of the network, and the data received by the sink node are taken as indicators to evaluate the quality of the routing protocol. The specific analysis is as follows: 1. Network life cycle: the duration from the normal operation of the WSN after the successful layout to the death of the last node. Three indicators were selected for evaluation, namely, the number of rounds in which the first node died (indicator

Parameter Parameter value
Pheromone concentration weight factor α 1 Heuristic function weight factor β 5 Node energy consumption weight factor λ 4 Pheromone Volatilization Coefficient ρ 0.1 1), the number of rounds in which 10% of nodes died (indicator 2), and the number of rounds in which all nodes died (indicator 3). In most cases, the appearance of the dead nodes leads to the deterioration of the network detection quality, so the number of rounds where the first node dies is of particular importance. 2. Total network energy consumption: the total energy consumption of all nodes in the network during implementation. This index can reflect the balance degree of energy consumption. In the simulation, the size of the packet and control packet is set, and the energy consumptions of different nodes are calculated through the network operation. 3. Data received by the sink node: data received by the sink node after each round of the network operation.

Experimental Results and Analysis
The simulation results of different routing protocols are analyzed based on the above performance indicators to verify the effectiveness of the ILEACH protocol. Figures 7, 8 compare the number of surviving nodes and total network energy consumption of the LEACH protocol and the ILEACH protocol, respectively. To be specific, the impact of the ILEACH protocol on the network life cycle is analyzed via indicators 1 and 2, as shown in Figure 8. Figure 9 indicates that indicator 1 of the LEACH protocol and the ILEACH protocol appears in rounds 141 and 199,  respectively, and indicator 2 appears when the network operates to rounds 596 and 986. When the LEACH protocol reaches ∼600 rounds, most nodes have no power, but the ILEACH protocol can be extended to ∼1,200 rounds. The network needs to be initialized in the early stage, which consumes energy quickly, and there are fewer surviving nodes in the later stage. However, ILEACH can effectively balance the energy consumption of nodes by considering the energy consumption of nodes in the process of clustering and data transmission, and the network energy consumption varies slowly in the later period. It is proven that the improved threshold and the replacement mechanism of the cluster head nodes can reduce the energy consumption of the nodes, and the ILEACH protocol can prolong the network life cycle much longer compared with the LEACH protocol. Figures 10, 11 compare the number of the surviving nodes and total network energy consumption between the LEACH  of ACO (ACO-LEACH) protocol and the LEACH of IACO (IACO-LEACH) protocol, where Figure 11 is the histogram of the index. Figure 12 illustrates that indicator 1 of the ACO-LEACH protocol and IACO-LEACH protocol occurs in rounds 199 and 329, respectively, and indicator 2 occurs in rounds 986 and 2,338. Table 5 displays the number of the first node deaths, 10% node deaths, and all node deaths under different protocols. In conclusion, the developed IACO algorithm can gradually find the optimal transmission path for the WSN operation and save energy in the data transmission stage effectively.

CONCLUSION
An algorithm based on OCW and IACO is proposed in the article to solve the problem of high energy consumption of the traditional LEACH protocol in WSNs. The ILEACH protocol adopts the cluster head node replacement mechanism to reduce the energy consumption considering the energy, density, and nodes distance for the threshold selection, which can effectively avoid the randomness of the clustering. Furthermore, the OCW is used to dynamically change the weight of the nodes according to the different impact factors of nodes in different regions. The developed IACO algorithm can optimize the transfer probability  of the sensor nodes with the local update and global update strategies, which can prolong the life cycle of the network to a certain extent. The network environment is deployed through MATLAB simulation software to verify the feasibility of the ILEACH protocol.

DATA AVAILABILITY STATEMENT
The original contributions presented in the study are included in the article/supplementary material, further inquiries can be directed to the corresponding author.