# Routing Protocol for Heterogeneous Wireless Sensor Networks Based on a Modified Grey Wolf Optimizer
## 6 Discussion  
The HMGWO protocol outperformed the SEP, DEEC, M-SEP, and FIGWO protocols in terms of the network lifecycle, power consumption, and throughput. The reasons are proved and summarized as follows. The SEP, DEEC, and M-SEP protocols are the routing protocols of HWSNs that do not consider the distance from node to BS when selecting CHs, and they just define the different threshold formulas of CH selection relative to the advanced nodes and normal nodes. In SEP, the selection of CHs in the whole network is inherently random. This makes the distribution of CHs in each round uneven, which will lead to unbalanced energy consumption among nodes and to the premature death of some nodes. Although the high-energy node in SEP has a higher probability of becoming the CH than the ordinary node, due to the random selection of the CHs, the frequency of some high-energy nodes becoming CHs may be small. This results in the slow death rate of the high-energy node, which extends the network instability period and the energy consumption among the nodes is not balanced. When the DEEC protocol selects the CH, the residual energy and the average energy of the network node are taken into account in the weighted election probability. That is to say, when the residual energy of the node is larger than the average energy, the average probability of the node being selected as the CH is higher than that of the node whose residual energy is smaller than the average energy; thus, the energy consumption between advanced nodes and ordinary nodes is reduced, and the life cycle of the network is extended, compared with SEP. In the model of CH selection, compared with DEEC, M-SEP applies the residual energy of nodes and the average energy of network nodes to the threshold formula. However, the weighted election probability does not change. When the residual energy is greater than the average energy, the threshold value of the node is relatively large, but there is still some randomness when the node is selected as the CH. The network lifetime is improved relative to the SEP protocol, but it is not optimized compared to DEEC in terms of residual energy deviation. On the contrary, our algorithm uses the fitness function (\(F_{1}\)) to select the initial CHs. The fitness function (\(F_{1}\)) takes into account the residual energy of the node and the distance from the node to the BS, so that the initial CHs are more evenly distributed in the network, and overcomes the randomness of the selected CHs. However, the selection of the initial cluster further fixes and limits the number of CHs, and provides the search range of the MGWO algorithm, thereby reducing the energy consumption in unnecessary clustering, saving network energy consumption, and prolonging the network life cycle. Figure 5: Residual energy relative to the number of rounds. (**a**) Total residual energy of HMGWO against SEP, DEEC, M-SEP, and FIGWO when the ratio of advanced nodes is \(\alpha=0.1\); (**b**) Total residual energy of HMGWO relative to SEP, DEEC, M-SEP, and FIGWO the ratio of advanced nodes is \(\alpha=0.2\); (**c**) The residual energy deviation of HMGWO is compared with SEP, DEEC, M-SEP, and FIGWO when the ratio of advanced node is 0.1; (**d**) The residual energy deviation of HMGWO is compared with SEP, DEEC, M-SEP, and FIGWO when the ratio of advanced node is 0.2. The GWO is used to select the CHs in FIGWO. When using the GWO algorithm for the selection of CHs, the selection of the final CHs is carried out according to the Euclidean distance (at the end of the iteration, the algorithm can estimate the prey's position (here, the prey is called a virtual CH), and all nodes will calculate the distance to the virtual CH; the node with the smallest distance will be selected as the CH). In the algorithm proposed in this paper, the final CHs are selected by the fitness function (\(F_{2}\)), which is designed by the energy of the node and the distance from the node to the virtual CH.