An Energy-Efficient Evolutionary Clustering Technique for Disaster Management in IoT Networks

Wireless Sensor Networks (WSNs) are key elements of Internet of Things (IoT) networks which provide sensing and wireless connectivity. Disaster management in smart cities is classified as a safety-critical application. Thus, it is important to ensure system availability by increasing the lifetime of WSNs. Clustering is one of the routing techniques that benefits energy efficiency in WSNs. This paper provides an evolutionary clustering and routing method which is capable of managing the energy consumption of nodes while considering the characteristics of a disaster area. The proposed method consists of two phases. First, we present a model with improved hybrid Particle Swarm Optimization (PSO) and Harmony Search Algorithm (HSA) for cluster head (CH) selection. Second, we design a PSO-based multi-hop routing system with enhanced tree encoding and a modified data packet format. The simulation results for disaster scenarios prove the efficiency of the proposed method in comparison with the state-of-the-art approaches in terms of the overall residual energy, number of live nodes, network coverage, and the packet delivery ratio.


Introduction
The Internet of Things (IoT) includes a large number of distributed nodes which are capable of sensing and interacting remotely [1,2]. Wireless Sensor Networks (WSNs) are classified as the major players of IoT networks and provide a wireless connection between constrained devices. In IoT-based WSNs, nodes transmit collected data (such as environmental information) to a central destination known as a sink node through a wireless channel [3,4]. Due to the recent advancements in hardware design, sensor devices are tiny and have a low cost, enabling their deployment in harsh environments such as nuclear power plants and forests [2]. However, sensor devices have very limited battery power, requiring the design of energy efficient algorithms [2,5]. Limitations in energy resources have a direct impact on the application performance, as sensors with depleted batteries can cause network disconnections and consequently packet losses [6][7][8][9]. In a multi-hop sensor network, it is crucial to devise algorithms and mechanisms in such a way to select the optimal route for data transfer to reduce energy consumption [2,5,10,11].
There are several IoT applications that are classified based on their requirements and specifications. Safety-critical IoT applications have very strict requirements in terms of reliability and timeliness. This class of applications is defined as a set of behaviors and actions which are taken to prevent, control, and overcome disasters (e.g., fires and earthquakes) [2,6,9,12]. We define disaster management as techniques that deal with devising algorithms and protocols that provide an enhanced quality of increases the network lifetime by expanding the range of network coverage. The contributions of this paper are summarized as follows: • Providing an energy-efficient method for clustering and routing in WSNs while considering the characteristics of disaster areas (with a non-uniform distribution of events).

•
Proposing an improved hybrid PSO-HSA-based CH selection method with a novel fitness function including energy-efficiency, cluster closeness, and network coverage criteria.

•
Utilizing the PSO to select relay nodes based on multi-hop routing with a fitness function including energy-efficiency and communication link quality criteria. • Using the adaptive weighted sum (AWS) method as a mathematical model to solve the fitness function based on the multi-objective optimization problem (MOP) so that a lower optimization cost can be obtained.

•
Developing a new type of packet format which is adapted to use in disaster applications; furthermore, modifying the PSO encoding priority-based routing to build an optimal routing tree with non-uniform events.

•
Overcoming the state-of-the-art approaches in terms of their average energy consumption, the number of live nodes, network coverage, and packet delivery ratio with various sink locations in disaster scenarios.
The rest of the paper is organized as follows. A review of the related works is given in Section 2, which is then followed by our proposed method in Section 3. The simulation results and evaluations are described in Section 4. Finally, Section 5 concludes the work and explains the possible future works.

Related Works
In [22], the authors introduced a low-energy adaptive clustering hierarchy (LEACH), which is a popular distributed heuristic method. Clustering in this method is dynamic, random, probabilistic and periodic. LEACH determines a threshold for CH selection. It produces a random number between [0, 1] to select a CH in that period. One of the disadvantages of the LEACH protocol is the random selection of CHs, because all nodes can be eligible to be a CH. Another hierarchical heuristic method, named the threshold-sensitive energy efficient sensor network protocol (TEEN), was proposed to improve energy consumption using the two-layer structure for clustering [40]. In this method, two thresholds are applied: (i) the hard threshold (HT) and (ii) the soft threshold (ST). Each CH sends its threshold values to its members. Both thresholds are defined in order to reduce the number of transfers over the routing periods and thus to reduce energy consumption in the process. In [40], CH selection is based on probability, and the distribution of CHs will be non-uniform. The TEEN algorithm has improved clustering stability and energy efficiency compared to LEACH. Its main drawback is that nodes will never establish communication if the thresholds are not reached.
To overcome the limitations of heuristic algorithms, such as inefficiently exploring the search space, meta-heuristic algorithms have been proposed for optimal CH selection [27,29]. Access to every portion of the entire search space over each period is considered to be one of the most important criteria for increasing efficiency in these algorithms, which leads to optimal or near-optimal solutions. Meanwhile, evolutionary algorithms (EAs) such as PSO and HSA are some of the most famous population-based algorithms, and their fitness function determines the quality of the solutions [32].
The authors in [23] proposed an evolutionary PSO for energy-aware CH selection by combining criteria such as the Euclidean distance between the nodes and CHs and the remaining energy from particle energy to node energy, allowing an evaluation of the issues related to the degree of the nodes and the number of CH hops required to reach particle sinks. An analysis of the results proved that the inclusion of energy criteria in the fitness function plays a crucial role in energy efficiency. In [23], CH selection was based on probabilities, and the CH distribution was uniform. This method also focused more on the exploration stage than exploitation. In [41], the authors presented an evolutionary HSA inspired by music for CH selection. Musicians try to select better notes in order that their music can be heard better, which forms the concept of presenting the harmony fitness function. In other words, the best set of CHs is selected. The authors focused on the two criteria of energy (HE) and distance (HD) for harmony evaluation. The fitness function of the Hoang schema is as follows: HD and HE are calculated according to Equations (2) and (3): It is noteworthy that α is a weight factor, and its value lies between 0 and 1. The furthest Euclidean distance of each node involved in a cluster to its CH (CH k ) is evaluated according to HD, in which the number of the members in each cluster is presented by CM . HE is also evaluated by dividing the sum of current energy in all network nodes E(n i ) by the sum of the current stage of CH energy E(CH j ). In [41], CH selection is random and CH distribution is non-uniform. Additionally, HSA is focused more on the exploitation stage than exploration. In [27], the authors introduced a two-tier PSO protocol for clustering and routing in WSNs entitled TPSO-CR. The three measures used in the fitness function of the clustering were network coverage, the remaining energy of nodes, and the link communication quality. Moreover, the two criteria utilized in the fitness function of the routing were energy-efficiency and link communication quality, which are described in the following. In this paper, the energy criteria are used in an attempt to reduce the number of the sender nodes; by doing so, the residual energy will be saved optimally. Furthermore, tree encoding is facilitated by applying PSO to construct optimal multi-hop routing and determine the Relay Nodes (RNs). Thus, Equation (4) is defined in a more energy-saving state (ER1) as follows: ER1 divides the number of RNs by the number of active CHs in the corresponding period actCH . In fact, Equation (4) reduces the number of active nodes. In addition, the RN with the highest level of energy should be offered as the sender node. ER2 adheres to that concept, as per Equation (5): Similarly, ER2 divides the sum of the energy of all nodes by the sum of the RN energy and moderates the energy consumption. Next, maximizing link quality (LiQ) between RNs in the multi-hop routing tree leads to the maximization of the packet delivery ratio (PDR). Hence, the worst communication link quality must be avoided in all sub-branches of the routing tree. Equation (6) is calculated according to this objective as follows [27]: The received signal strength indicator (RSSI) is used in this paper to evaluate the link quality between the cluster nodes. In [27], the link quality is the ratio of the RSSI between the CMs and their CHs to minRSSI. In Equation (6), it can be observed that we prevent the selection of the worst link quality (minRSSI) as far as possible between two consecutive sender nodes RSSI (rn x , rn x+1 ). Hence, In order to maximize the quality of the clusters in terms of LiQ, we must minimize the worst quality of the clusters. So, the fitness function of routing is formulated as follows: where β j ∈ [0, 1]. Furthermore, the authors in [29] produced a hybrid method based on PSO and HS algorithms for energy-efficient CH selection. The proposed meta-heuristic algorithm takes advantage of both algorithms, covering a global optimal in the search space (exploration) and going beyond the local optimal (exploitation). Furthermore, the authors were inspired by Equation (1) [41] as regards the fitness function, with the aim of energy-efficiently minimizing the average distance of the normal nodes to the CHs. In PSO-HSA [29], the particles are allowed to move from one region to another area of the search space based on the PSO algorithm. Since PSO encounters optimization limitations in high-dimensional scales, it is difficult to find any possible solution in the entire search space. Therefore, HSA helps PSO because of its high searching capacity. In [42], the authors used the cuckoo algorithm for clustering and employed an improved HSA for multi-hop routing in WSNs. They suggested that uniform energy consumption in the clustering and routing of large-scale wireless sensor networks is one of the main concerns in this area, because, due to traffic load, nodes near the sink suffer from high energy consumption. This paper also proposes criteria such as the energy, node degree, intra distance of clusters and the coverage ratio for the fitness function. The performances of different clustering protocols in WSNs are summarized in Table 1, from which the following can be concluded: (1) the Hybrid PSO-HSA [29] is more energy-efficient than the cuckoo [42], PSO [23], and HS [41] algorithms; (2) the cuckoo algorithm, in comparison with PSO and HSA, has poor cluster stability, and all of the algorithms suffer from an imbalance of exploration and exploitation; (3) none of the related works into WSNs consider the non-uniform distribution of events, and this is not suitable for disaster application.

Proposed Method
In this section, first, the network model is explained; then, by determining the AWS method for fitness functions, two main phases of our method are proposed.

Network Model
In our protocol, the nodes are scattered homogeneously and randomly with a uniform distribution in a rectangular field (100 m × 200 m). Figure 1 indicates the overall network model, including a description of the uniform random distribution of the nodes in a disaster application such as a forest fire.  Our method is configured based on the following assumptions, and the location of the sink is considered to be variable according to the evaluation of the algorithm's efficiency in the target application.

•
The nodes are fixed (stationary) in the network.

•
Nodes are not location-aware, but the sink is aware of its position. • All nodes have the same level of energy (E0) initially, and the network is homogeneous [7].

•
The minimum RSSI with the value of −97 db is known as the worst received signal [27].

•
Nodes always send their data based on Time Division Multiple Access (TDMA), which is enforceable on IEEE 802.15.4/ZigBee standard. Additionally, we use the Timeout MAC (TMAC) protocol because it is compatible with different sleep schedules in WSNs and provides energy efficiency [27,43].

•
The sink is responsible for clustering and routing. Therefore, the proposed method is centralized.

•
The energy consumption of the nodes is estimated based on their distance from the sink or CH (by parameter d) [22].
In [22], the authors evaluate the energy consumption model based on the distance between the sender and receiver (d). In this model, the energy dedicated to sending messages is calculated by the length of the messages (L) and the distance between sender and receiver (d) as follows [22]: In (8), the energy consumption to send one bit of data is calculated by E elec . Additionally, sending factors of ε fs and ε amp are valued in proportion to the booster model of the sender-radar. In [22], the consumed and dedicated energy of length L (in bits) will be calculated according to Equation (9) to receive each message. E Rx = L.E elec (9) It is noteworthy that the initial distance d0 is calculated as follows in Equation (10):

AWS Method for LP Formula
One of the most significant challenges in disaster management is decision-making in harsh environments [44]. In these cases, the decision-maker faces different criteria influenced by the internal and external environment. Hence, multi-criteria decision making (MCDM) schemas are considered to be among the best tools to make decisions [36,39]. In MCDM, instead of using an optimality criterion, several metric criteria may be used. Among the methods to solve these problems is the adaptive weighted sum (AWS) method [38]. As the simplest method of MCDM analysis, the AWS method can be used only when all criteria are stated precisely in terms of the same domain. Moreover, it permits a multi-objective optimization problem (MOP) to be converted into a single objective mathematical optimization problem (SOMP) format. The MOP method is formulated as follows [28,37,38]: . . , f n (x)) (11) subject to F(x) : Ω → R n . Multiplying the sum of the fitness functions in the weighted coefficients, the AWS method transforms Equation (11) to the SOMP as per Equation (12) [38]: subject to j ∈ Ω, where w j ≥ 0, (∀j = 1, 2, . . . , N), and N ∑ j=1 w j = 1.
In this paper, we use the above equation to determine the fitness functions. Equation (12) is also called Pareto optimization. Typically, this kind of optimization gives a unique solution (if w j > 0, ∀j = 1, 2, . . . , N) [38]. As the proposed fitness functions are composed of different criteria and values, it is also essential to normalize the criteria with respect to the Pareto optimization and match them with the weighted coefficients [38].

Normalizing the LP Formula
In order to obtain a similar amplitude value of the fitness functions, each criterion of these functions is normalized between [0, 1] [36,37]; all criteria of the fitness function should be in one domain. Normalizing the interval between 0 and 1 requires the Utopia and Nadir points [38]. The Utopia point, which is the lower bound (S U ) of the function, is modeled as follows: where s * y = argmin x fo y (x) : x ∈Ω and subject to s * y ∈ R, S * ∈ R Y . The Utopia point is S U = S * . The Nadir point, which is the upper bound (S N ) of the function, is modeled as follows [38]: If considering the difference in values at points, then θ y = 1 Finally, the normalization equation is calculated as follows [38]: According to the above equation, it is possible to calculate values at each round of the simulation for each criterion.

Cluster Head Selection Phase
In the clustering phase, our evolutionary method is described through the contribution of the hybrid PSO-HSA [29] with the difference that the fitness function is modified and improved according to the disaster management conditions. The improved fitness function and stages of clustering will be explained below.

Improved Fitness Function for CH Selection
In order to increase the network lifetime, a set of optimal CHs should be selected; if the number of CHs were too low, nodes would have to increase their communication range to send the information, and so they would consume more energy. However, if the number of CHs were too high, the network would be a single hop, again leading to increased energy consumption. Therefore, it is necessary to determine the optimal criteria of the fitness function based on the application [26]. In this paper, the fitness function in WSN is a multi-objective function that needs to be minimized to reach optimal or near-optimal solutions. Additionally, three criteria have been used to select CHs. First, the energy-efficiency criterion (EE) is included, inspired by Equation (3) of the Hoang method [41], as mentioned above; then, two other criteria are added to the fitness function, which are called cluster closeness (CC) and network coverage (NC).

Cluster Closeness (CC)
To maximize cluster quality, it is necessary to make highly compact clusters to reduce energy consumption [33]. Furthermore, a high density of nodes is a good option for selecting a candidate CH from a region [33] because the energy consumption and internal communication cost of clusters is therefore minimized [14,27,29]. Thus, we attempted to decrease the mean distance of the CH to its neighbors for rapid data transmission. If the density of an arbitrary node x (CH candidate) is the number of single-hop neighbors (nh (x)) and the sum of the Euclidean distance of node x from single-hop neighbors (h (x)) is dist (x, h (x)), then the cluster closeness of an arbitrary node x is calculated as follows: A node will be chosen as CH which has a lower value than the other candidate CHs because increasing the nh (x)value according to [33] is effective in selecting CHs. Similarly, as in Equation (2), the mean Euclidean distance of the CMs with the CHs is minimized.

Network Coverage (NC)
One of the important factors in overcoming the challenges of WSNs is network coverage [15,27]. If the aim is to reach higher scalability, then the network coverage should be increased [27]. Thus, finding a CH for the nodes that have no CHs (non-CHs) can effectively cover the network. In this paper, the network coverage is evaluated as follows: where ||CM k || represents the kth total number of CMs in the cluster, K is the number of CHs, and N* is the total number of nodes (N) minus the number of nodes annihilated in each round. Minimizing the number of non-CHs is perfromed through NC [15,27]; thus, by minimizing the EE, CC, and NC parameters, the best set of CHs is selected. A novel fitness function of the clustering phase is formulated as shown in Equation (18): Here, nodes die if their energy is less then E (threshold), and T (maximum) is the maximum range of node transmission.

Clustering Steps
After the initialization of parameters, which is presented in the simulation setup (Section 4), the clustering phase consists of the following steps.

•
Setting the Location and Velocity of the Particles The location and velocity of the particles are placed randomly in the following intervals, respectively: [x min , x max ] and [v min , v max ].The particle swarm size and harmony memory size (HMS) are initialized under the title of particle harmony memory (PHM). The initial PHM matrix [29], as shown in Equation (19), includes the number of random solutions generated to reach the optimal or near-optimal solution. Each row in the HMS × K matrix is a random solution, and the fitness function for each vector is calculated by Equation (18). •

Improving Harmony Vectors for PHM and Updating the Hybrid Matrix
After PHM is defined, new harmony vectors [I 1 , I 2 , . . . , I k ] should be produced to improve the harmony vectors of the PHM. Each component of the new harmony vectors is generated by harmony memory considering the rate (HMCR), and eventually an optimal candidate vector of PHM is modified by the pitch adjusting rate (PAR). In this step, the state-of-the-art method [29] uses the simple structure of HSA, but attention must be paid to variations in different stages of the search process. Additionally, the study in [34] demonstrated that HSA suffers from a slow convergence speed to achieve a global optimum; however, in [31], the dynamic version of HSA exhibited fast convergence at the start of the algorithm, converging to the global optimum in the near-final stages of the search process. Therefore, in this paper, each harmony vector (HV) of the PHM is obtained dynamically. The procedure of improving the harmony vectors for PHM is described in Algorithm 1 [31]. where Nd1 and Nd2 are normal distribution functions with (µ = 0, σ = 1), ri1 and ri2 are random integers between [1, HMS], ri3, ri4 and ri5 are random mutually exclusive integers between [1,HMS], the function randn() is a uniform random number in [0, 1], and parameter k is generated uniformly by a discreet random number in [1, K] [31]. After method 1 in Algorithm 1, if randn() ≤ PAR, the harmony vector (HV) should be tuned or pitched (a term in music) according to the PAR. I n x is defined as the closest node with more energy than current CH is the cluster. It is necessary to clarify that parameter best in update 2 as the index of the best HV inspired by the GHS method [45]. Next, updating the PHM is the last step in the HS algorithm [29]. To do this, if the fitness function of the new harmony vector (I n x ) is better than the value of the fitness function of the worst harmony vector in PHM ( f (I n x ) > f (HV worst x )), the new harmony is included in the matrix and the current worst harmony of the PHM is excluded. Thus, the PHM is updated with this condition, and this step is stopped If the iteration of HSA is bigger than the maximum iteration.

•
Updating the Location and Velocity of the Particles In this step, to reach the optimal location of the CHs, the PSO algorithm updates the location and velocity of the particles [2]. The best particle location (p_b) is determined by the minimum cost of the fitness function in a swarm particle [29]. The g_b, as the global best location, is determined by selecting the best solution of p_bs. In this paper, the nodes that harmonize with g_bs are taken, and the closest nodes to these harmonies form CHs. The velocity (V) and location (X) of the particles can be updated as follows [23,29]: V xy (r + 1) = ωV xy (r) + r a c a p_b xy − X xy (r) + r b c b g_b xy − X xy (r) (20) X xy (r + 1) = X xy (r) + V xy (r + 1) where the index xy denotes the xth particles and dimension, c a and c b are acceleration constants, r a and r b are the random uniform amount in [0, 1], and factor ω is the inertia weight factor. Selecting a suitable value of ω creates a balance between exploration and exploitation [46]. In [29], the linear reduction of factor ω has a positive effect on the efficiency of the application of WSNs, while in [46], the authors proposed a nonlinear time-varying inertia weight formula that led to a faster convergence than the linear inertia factor used in [29,45]. Therefore, to enhance efficacy, we use the following high-order (∝) nonlinear formula: where iter is the current of iteration and r max is the total number of iterations. Equation (22) [46] decreases nonlinearly from ω max = 0.9 to ω min = 0.4 and finds a suitable value at each round.
The obtained results of [46] show that excellent performance is achieved when ∝ = 1/ π 2 and the two constants c a and c b -as cognitive and social parameters-have the value 2. The location and velocity of the particles are calculated and updated at each round of the proposed method and for each row in PHM. As mentioned above, the closest nodes to g_b will be the optimal CHs. •

Going Back to the First Step or Stopping the Algorithm
When all the rounds of the clustering phase come to an end, the algorithm stops and a total number of k optimal CHs are determined for the routing phase. Otherwise, the algorithm goes back to the second step and repeats until it finds optimal or near-optimal solutions. However, before the next round starts, the values of HMCR and PAR in Algorithm 1 are required to be updated as follows [31]: U pdate1 : HMCR (Iter + 1) = HMCR.min + Iter r max × (HMCR.max − HMCR.min) (23) These dynamic updates in the search process enhance the exploration capacity of the first stages and lead to the improvement of the local search in the last stages [31] because the variation of the HMCR value affects the diversity and convergence of PHM, with similar results for the PAR value in terms of the local and global optimum [34,41,42]. Hence, the initial values of Equations (23) and (24) are adjusted according to [31].

Routing Phase
In the routing phase, when the clustering phase is done optimally and a total number of k CHs are determined, the algorithm enters the routing phase to transmit the collected data. The routing phase in the proposed method is multi-hop routing, so it is necessary to specify the RNs in the sink path. The CMs send the information to their CH based on the Time Division Medium Access (TDMA) schedule, and the CHs pass the route to the sink based on the RNs [27]. To achieve this, only PSO is implemented, and the fitness function starts to construct the routing tree [39]. The transfer route leads to the formation of a routing tree [27,39]. If the tree is optimized more, this will have an important effect on the proper and quick transfer of the information.

Enhanced Tree Encoding
For the fitness function in this section (minF_routing), we use Equation (7), mentioned above [18], to determine the relay nodes (RNs). Next, the algorithms update the particle locations and velocities in the PSO. The RNs are responsible for transferring the gathered data to the sink. Considering the sensitivity of the points involved in a disaster area compared to other points, the information of these points needs to be transferred quickly; in order to build the routing tree, the PSO is performed again via the Base Station (BS) [39].
It should be noted that, by updating the location and velocity, the PSO increases the number of invalid paths [27]. Consequently, due to application, the number of invalid paths must be reduced, and valid paths must be detected quickly. To achieve this goal, the priority encoding/decoding approach of PSO has been successfully tested [27,39]. However, it is necessary to develop the tree encoding appropriate to the disaster areas. Thus, the new packet format with respect to the fire flag is presented in Figure 2.

Header
Fire Flag (event) …… …… Sender ID Receiver ID In Figure 3, a fire flag has been set up because the nodes are somehow aware of each other's status and make a more accurate decision regarding whether to send data to each other on the basis of events. In disaster areas, the fire flag can take two Boolean values of T as a non-uniform event (the disaster state) and F as a uniform event (the normal state). In order to validate paths from the CHs to the sink, nodes (particles) are mapped onto a random-priority number between [−1, 1]. The path construction procedure is shown for each CH in the following the Unified Modeling Language (UML) sequence diagram: For clarity, the process of the construction routing tree with a simple example is shown below. As shown in Figure 4, we have 15 nodes (with the sink and two CHs, 3 and 6) which are mapped onto the particles between [0,14]. The sink has a tag of 0 with the highest priority H > 1, and nodes 5, 13 and 14 are in the fire range. The goal of all paths will be to reach the sink. For each CH, a list of 15 items is created based on the ID of the particles and their random priority. Next, each node, as the receiver identified by the sender, listens to its single-hop neighbors and chooses the next hop on the basis of the highest random priority generated between them. In the following, if the sender node takes a flag value of F when listening to its single-hop neighbors, then the next-hop is chosen based on the highest priorities of the single-hop neighbors. Otherwise, if the sender node takes the flag value of T, then the sender generates random priorities between [−1, Numerical minimum value o f the list] for the single-hop neighbors (updating encoding particles). In this way, the packets try to pass through more reliable paths. Next, for the next hop chosen, the penalty L (L < −1) is set so that it does not participate in the selection process again. The path formation based on modified tree encoding for each CH (3 and 6) is illustrated in Figure 5.
As observed in Figure 5, the value of the fire flag is returned to T for CH 6 from nodes 5 and 14, and also for CH 3 from node 13. Thus, random priorities between [−1, Numerical minimum value o f the list] are generated. Finally, choosing a single-hop neighbor based on the highest priority will construct the routing tree as shown in Figure 6.
According to Figures 5 and 6, paths 3 → 8 → 0 and 6 → 10 → 0 are generated, and then the routing tree and optimal CHs are broadcast to all nodes by the sink. After this phase, the sleep scheduling of nodes is considered. Additionally, if CHs, CMs, and RNs are unable to send any data, the sink will go to the sleep state and save energy.

Overall Proposed Algorithm
The main pseudo-codes of the proposed algorithm are formulated in Algorithm 2. c. encoding particles After adding CH 6 to the routing tree

13
Evaluate fitness for each particle based on Equation (7) 14 Update p_best for each particles (if current fitness better than p_best) 15 Update g_best for each particle (choose best fitness value among all the neighbors) 16 end

Simulation Results and Evaluations
In this section, our proposed method (the so-called ECHSR) is compared with the state-of-the-art works on PSO-HSA [29] and TPSO-CR [27]. Furthermore, we implement the classical LEACH algorithm [22] as an example to show why we must transition to evolutionary algorithms. However, we performed the simulation in terms of the overall residual energy, the number of live nodes, network coverage, and the packet delivery ratio (PDR) with four different sink locations (the coordinates (50, 150), (100, 100), (0, 100) and (50, 200)) and also repeated each simulation 10 times with forest fire scenarios (Figure 7). Moreover, to evaluate efficiency, we examined our protocol with a uniform distribution of events using the metrics of the average residual energy and PDR. To begin the comparison, the simulation setup is explained, and then the simulation results are presented and analyzed.

Simulation Setup
MATLAB 2017a was used for the simulation. The system on which MATLAB was installed and the simulation processes were conducted had the following properties: CPU: Inter Core i7, memory: 8 GB RAM and operating system: Windows 10 Enterprise-64bit. The parameters and their values are presented in Table 2. For the AWS method, we assign the same weights to the parameters in the simulation [27,38], To bring the results closer to the real-world situation and make the theories more practical, it is necessary that the simulation environment for scientific research does not deviate greatly from reality. Many works, such as [13,20], have been conducted on forest fire modeling and have investigated how they burn. Given the simulation's capabilities, the computational complexity, and the difficulty of predicting the direction of fire, we decided to consider the speed and direction of the wind as being constant. By examining the previous works, we concluded that the fire burning model could be as shown in Figure 7; for instance, the NetLogo group implements forest fire models and confirms that fire spread can be random [47].  In this work, a forest fire spreads from one direction and expands to the center [47]. To show the validity of the results, in addition to the scenario shown in Figure 7, we performed another simulation (without fire) in Section 4.3. In our random model, the yellow area indicates the non-uniformity of the events and red areas show the burned forest and annihilated nodes. As shown in Figure 7, the forest fire scenario includes different processes: (a) from round 1 to round 6, the simulation shows the normal state of the environment; (b) from round 6 to round 12, there is a non-uniform event such as fire smoke, which is indicated in yellow; (c) from round 12 to round 18, forest fires occur, which are shown in red. Similarly, for the rest of the scenario-(d), (e) and (f)- Figure 7 shows the growth of the forest fire proceeding to rounds 24, 30 and 40 of the simulation, leading to more dead nodes.

Simulation Results
In this section, the criteria for the comparison and analysis of the results are the overall residual energy, active nodes, network coverage and PDR ratio.

Overall Residual Energy
Considering the limitation of energy nodes, one of the goals of this paper was to present an energy-efficient algorithm. The decrease in the overall residual energy for all nodes leads to an increase in the network lifetime. This shows how the energy consumption rate in all nodes is distributed uniformly and optimally in different rounds. The residual energy is calculated as follows: where E n,X is the overall energy consumption by a sensor node (n) after X rounds of data collection from the area-of-interest of the network, and E overall is determined as overall energy consumption by N number of total nodes after X number of simulation rounds of data collection in the network [42]. The mean of E total until round X is defined as the average residual energy in this paper. According to Figures 8 and 9, although PSO-HSA [29], which is highly energy-efficient, is one of the most novel algorithms, this method could not compete with our method in forest fire scenarios (Figure 7). As shown in Figure 8, because of the random selection of CHs, the residual energy of LEACH drops to zero in the early rounds (around 15 rounds). Until 40 rounds of simulation have passed, it can also be seen in Figure 9 that PSO-HSA has a better average residual energy than TPSO-CR because the efficient searching of HS complements the dynamic capacity of PSO and also improves the balance between exploration and exploitation. In other words, the proposed method has better energy dissipation distributions than other methods. Additionally, the proposed method is improved in terms of the overall residual energy by about 1.04-1.42 times compared to PSO-HSA, by about 1.24-1.46 times compared to TPSO-CR and by about 1.70-1.77 times compared to LEACH for the different sink locations according to Figure 8. The reasons for this improvement are the optimum improvement of the structure of PSO-HSA and the attention paid to non-uniform events in the routing phase.

Active Nodes
Another significant factor that directly affects the network lifetime is active nodes. Due to non-uniform events, the node energy involved in the disaster environments reaches zero after a while. The greater number of live nodes-or the reduction of the number of dead nodes-demonstrates that a better division of labor has taken place in terms of energy, and the CHs have optimally transferred the gathered data to the sink. In other words, the number of nodes increases the network lifetime that must be achieved to ensure network coverage. As shown in Figure 10, the proposed method in terms of active nodes outperforms PSO-HSA by about 16% to 36% and TPSO-CR by about 19% to 39% for the different sink locations. It can also be seen in Figure 10 that the LEACH algorithm also suffers as a result of the randomly chosen CHs in this application.

Network Coverage
One of the most important factors of the quality of service (QoS) of WSNs is network coverage. The selection of the best set of CHs requires maximum coverage. The maximum area coverage detected by WSN in forest fire application is necessary, because these areas might not be appropriate for the nodes due to their uniform random distribution. In other words, as mentioned before, the goal of this measure is to reduce the number of non-CH nodes. In order to evaluate the network coverage properly, an environment of 100 × 200 is graded in squares of 10 × 10 (dividing the area into smaller rectangles), as shown in Figure 11. Thus, the maximum number of graded points is 231, and the number of grids is 200. The goal of this division is to minimize the number of uncovered grids. As can be seen in Figure 12, inspired by Figure 11, the proposed method outperforms PSO-HSA by about 1.08-1.32 times and TPSO-CR by about 1.18-1.34 times for the different sink locations. It is observed that the LEACH algorithm in round 16 has a network coverage of zero, which is much lower than the other methods. In general, the numerical results in Figure 12 demonstrate that the proposed method can cover the number of non-CHs more efficiently than PSO-HSA and TPSO-CR.

Packet Delivery Ratio
In the network domain, the ratio of data packets that the destination (sink) receives to the total packets generated by sources (nodes) is called the packet delivery ratio (PDR). The improvement of this factor leads to an increase in the number of active nodes. Furthermore, the greater the number of simulation rounds, the more PDR will be reduced. The PDR for each round of simulation is calculated with Equation (26): As shown in Figure 13, considering that the worst link quality is removed by the fitness function (Equation (8)) and also that its routing tree is based on modified priority encoding, the proposed method has a higher average packet delivery ratio than other methods in 40 rounds of simulation. Furthermore, the numerical result demonstrates that PDR is increased in our method by about 1.07 to 1.38 times compared to PSO-HSA and by about 1.27 to 1.39 times compared to TPSO-CR for the different sink locations. It is clearly exhibited that LEACH has the lowest average PDR.

Uniform Distribution of Events
We also tested the proposed method without a forest fire scenario (stable condition) in terms of the metrics of the average residual energy and packet delivery ratio (PDR) for various sink locations. In other words, across the entire network, events are uniformly distributed in each round of the simulations. According to the obtained results for the uniform distribution of events, the last node dies in the proposed method at about 1850 to 1900 rounds, which is superior to the state-of-the-art method [29], where this occurs at about 150 to 200 rounds. Up to 1900 rounds of the simulation, as shown in Figure 14, our protocol experiences the maximum average residual energy and consequently enhances the network lifetime compared to other methods.
Unlike the forest fire scenarios (Figure 7), with the changing position of the sink, there is no obvious difference in the efficiency of the algorithms. However, in order to evaluate the quality of clustering links and improvements in the packet transmission, we performed the average packet delivery ratio (PDR) analysis in Figure 15 based on various sink positions. Figure 15 clearly shows that the proposed method has the highest average PDR compared to other methods.

Conclusions and Future Work
In this work, energy-efficient cluster head selection and routing methods based on evolutionary algorithms were proposed for safety-critical WSN applications, focusing on forest fire. We have targeted energy efficiency as a major issue in such IoT networks. To overcome this challenge, an improved hybrid PSO-HSA-based CH selection technique with a novel fitness function including energy-efficiency, cluster closeness, and network coverage criteria were proposed. We employed PSO to select RNs with a fitness function including energy-efficiency and communication link quality, which resulted in the development of a modified tree encoding method based on a new data packet format. We validated the efficiency of the proposed method for a forest fire scenario compared with the related works, considering different sink node placements. By considering different performance metrics, such as the overall residual energy, the number of live nodes, network coverage, and the packet delivery ratio in simulation evaluations, we could make the following conclusions: (1) the proposed algorithm in a disaster area is much better than the state-of-the-art methods [27,29]; (2) the placement of the sink node affects the performance of the algorithm; (3) since the variation of HMCR and PAR parameters affect the fast convergence of the algorithms, it appears that these parameters may change dynamically; (4) probabilistic algorithms such as LEACH [22] cannot perform properly in a disaster application; and (5) in scenarios where events occur uniformly, our algorithm improves the network lifetime compared with other methods.
In future work, we are planning to design efficient MAC protocols based on this application to prevent long delays and extend simulation scenarios, especially for heterogeneous networks.