# An Energy-Efficient Evolutionary Clustering Technique for Disaster Management in IoT Networks
## 3 Proposed Method
### Routing Phase
#### 3.4.1 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.  
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,  
Figure 3: UML sequence diagram of tree encoding for each CH.  
Figure 2: The new data packet format.  
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\;of\;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\;of\;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\to 8\to 0\) and \(6\to 10\to 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.