# Routing Protocol for Heterogeneous Wireless Sensor Networks Based on a Modified Grey Wolf Optimizer
## 1 Introduction  
In recent years, with the development of low-power digital circuits and wireless communication technology, wireless sensor networks (WSNs) have been widely used in many fields, such as military reconnaissance, medical aid, urban management, smart home and target tracking [1; 2; 3; 4; 5]. WSNs are mainly composed of a base station (BS) and a large number of randomly distributed sensor nodes. The energy of the sensor node is mainly powered by the battery. However, the battery power is very limited, and when the sensor nodes are placed in a complex or harsh environment, it is very difficult to charge or replace the battery [6; 7]. Therefore, energy efficiency is the most important and critical task to lengthen the network lifetime in the design of WSN routing protocols [8; 9; 10; 11]. In the routing protocol of WSNs, the most effective way to save the energy of the sensor nodes and lengthen the network life cycle is to design a routing protocol based on clustering [12; 13]. The idea of a clustering algorithm is to divide sensor nodes into multiple regions; a region is also called a cluster. A sensor node is selected as a leader in each cluster, which is also known as the cluster head (CH),and the remaining sensor nodes are selected as members of the cluster to send their perceived data information to the nearest CH, which will conduct data information fusion and send data to the BS. The CH will transmit data packets to the BS according to single-hop and multi-hop modes, and the transmission mode is mainly determined by the distance from the CH to the BS. Many routing protocols based on clustering have been proposed to extend the network life cycle, such as Low-Energy Adaptive Clustering Hierarchy (LEACH) [14], Threshold Sensitive Energy Efficient Sensor Network Protocol (TEEN) [15], Hybrid Energy-Efficient Distributed Clustering (HEED) [16], LEACH-centralized (LEACH-C) [17], a novel Battery-Level Aware Clustering family of schemes (BLAC) [18], etc. However, most clustering routing protocols of WSNs have been mostly based on homogeneous networks [19; 20]. Owing to the changes in node resources and network topology, heterogeneous wireless sensor networks (HWSNs) are now more widely used in practice. The HWSNs mainly consider the heterogeneity of energy. The HWSNs routing protocols with heterogeneity of nodes energy such as Stable Election Protocol (SEP) [21], Modified SEP (M-SEP) [22], Prolong-SEP (P-SEP) [23], an Improved version of the Energy Aware Distributed Unequal Clustering Protocol (improved-EADUC) [24], and Distributed Energy-Efficient Clustering Algorithm (DEEC) [25] have been proposed. However, how to more properly utilize the heterogeneity of nodes' energy to lengthen the network life cycle and increase the network throughput is one of the main problems of the HWSN routing protocol [26; 27]. In this paper, we propose a routing protocol for HWSN based on a modified grey wolf optimizer (HMGWO) that further extends the life cycle and balances the energy consumption of the network. Several techniques are used in HMGB for the selection of CHs as follows. (1) HMGO defines fitness functions with different weights to select initial clusters according to the heterogeneity of sensor nodes in HWSN. (2) In each initial cluster, HMGO considers the fitness value of the sensor node as the initial weight in the GWO and dynamically updates the GWO's weight according to the distance between the wolves and the prey and the coefficient vector so that the selection of CHs is more reasonable. (3) Compared with previously proposed algorithms, the Euclidean distance is used to select the final CHs. HMGO considers the distance and residual energy in the selection of the final CHs. (4) HMGWO tries to receive the bad cluster set with a certain probability as the initial cluster set in the next iteration; thus, the final selected cluster set is globally optimal in the whole network. As a result, the network lifespan is improved, and the network energy consumption is balanced through the above methods.