Abstract
Keywords
Introduction
Wireless sensor networks, 1 of the 10 emerging technologies, 1 are the core technology of the Internet of Things (IoT) and will change the world. 2 As micro-electro-mechanical system (MEMS) and wireless communication technology have achieved rapid progress, 3 wireless sensor network (WSN) has developed dramatically in recent years. It has been widely applied in different fields, and then, it is changing the human life profoundly. The wide applications of WSNs include military sensing, 4 intelligent agriculture, 5 mobile target detection water, 6 health monitoring, 7 smart grid, 8 human activity monitoring, 9 and so on.
A WSN comprises of a large number of sensor nodes, which contain sensing, computing, communication, and power supply components that provide an opportunity to monitor and control the physical world. As the sensor nodes used in most applications are powered by batteries, the research on the improvements of energy efficiency of WSNs, to extend the network lifetime as far as possible, is still the focus at present and in the future. There are lots of schemes which have been proposed for this purpose, such as “low-power radio communication hardware,” 10 and “energy-aware medium access control (MAC) layer protocols.”11,12 However, clustering is one of the most effective techniques for saving the energy of sensor nodes. In a cluster-based WSNs, the network comprises of several groups called clusters, in each of which there is a unique node known as cluster head (CH) takes charge of its cluster. In a cluster, all the member sensor nodes sense local data and transmit them to the CH, and then, the CH aggregates the local data and finally sends the aggregated data to the base station (BS) directly or via other CHs. Therefore, it can avoid transmitting high volumes of redundant data from each sensor node to the BS, so as to reduce the energy consumption of the whole network.
In many WSNs, as the CHs are selected usually from the regular sensor nodes, they may run out of energy quickly for receiving data from member sensor nodes, aggregating the local data, and transmitting data to the BS frequently. Thus, many researchers have introduced some special nodes called gateways or relay nodes,13–15 with much more energy than the regular nodes, to be CHs all the time. In this article, such gateways are also employed. Because the gateways are also battery powered, and the gateways and the regular nodes may not be uniformly deployed in a sensing area, it is important to assign the regular nodes to the gateways properly. Otherwise, some gateways may die quickly as they are overloaded with excessive member regular nodes. For balancing the energy consumption of gateways, some regular nodes may be assigned to the farther gateways rather than their nearest gateways. Thus, those regular nodes that are assigned to the far away gateways will run out of energy quickly due to long haul transmission and finally lose the ability of sensing their local information. Therefore, for prolonging the whole network lifetime, the assignment of regular nodes to gateways, obtained by clustering algorithm, should consider not only the energy consumption of CHs but also the energy consumption of regular nodes. It is worth noting that for a WSN with
In this article, for a WSN with
The main contributions of this article are shown as follows:
A new energy-efficient clustering algorithm called improved harmony search based clustering (IHSC) for dealing with the clustering problem of WSNs is developed based on several improvements made to the traditional HS algorithm.
IHSBEER algorithm is employed by IHSCR to balance the energy consumption of gateways in the routing phase.
The proposed IHSCR performs far better than other clustering algorithms over balance of the energy consumption of sensor nodes (especially the regular nodes), which has considerable contribution on improving the energy efficiency of WSNs and extending the whole network lifetime.
The rest of this article is organized as follows. Section “Related works” describes the related works. The mathematical model, containing the system model and the proposed objective function model, is presented in section “Mathematical model.” Section “IHSCR algorithm” first introduces the HS algorithm briefly, and then, the proposed approach is described in sufficient detail. The experimental results and analysis to evaluate the proposed approach are presented in section “Experimental results and analysis.” Section “Conclusion and future works” summarizes this article and advances further work.
Related works
At present, a large amount of research is devoted to the design and development of clustering algorithm for WSNs. In this section, a brief overview of the clustering algorithms, especially the meta-heuristic-based clustering algorithms of WSNs, is presented. More references and discussions about this topic can be viewed in the literatures.17–21
Energy-efficient load-balanced clustering algorithm (EELBCA) was proposed by Kuila and Jana
14
to address energy efficiency and load balancing of WSNs. In the clustering phase, a min-heap containing the CHs is built in the order of smallest to largest in number of sensor nodes assigned to the CHs. When there were unassigned sensor nodes, the sensor node, which is nearest to the root node of the min-heap among the unassigned sensor nodes, is assigned to the root node of the min-heap. Then, adjusting the min-heap to keep the minimum loaded gateway at root. Continue the above process until all the sensor nodes are assigned to CHs. For
Yi et al. 24 proposed a power-efficient and adaptive clustering hierarchy (PEACH) protocol to reduce the energy consumption of sensor nodes and prolong the network lifetime, by forming clusters without additional overhead on CHs selection and supporting adaptive multi-level clustering. When forming clusters, PEACH protocol does not require overhead of transmitting packets for advertising and announcing CHs, joining the clusters, and scheduling of intra-cluster communication, compared with the existing clustering algorithms. What is more, PEACH protocol supports both the location-aware WSNs and the location-unaware WSNs. As PEACH protocol supports adaptive multi-level clustering, it is less affected by the size of sensing field or the distribution of sensor nodes. The experimental results show that PEACH protocol performs better than other clustering algorithms compared in terms of energy consumption and network lifetime.
Jin et al. 25 proposed an energy-efficient multi-level clustering (EEMC) algorithm to improve the energy efficiency of WSNs. The data transmission operation in this algorithm is also divided into rounds. Each round begins with the cluster setup phase and then followed by the data transmission phase. In the cluster setup phase, first, the optimal expected number of cluster levels and the number of sensor nodes in each level are obtained by EEMC algorithm. Then, EEMC algorithm assigns the sensor nodes to their own clusters and elects CH for each cluster at the same time. As the rounds of data transmission operation increase, the optimal number of cluster levels and CHs will be found asymptotically. The experimental results demonstrate that EEMC algorithm performs better than low energy adaptive clustering hierarchy (LEACH) 26 and energy-efficient multi-level k-hop (EEMK) in terms of network lifetime and transmission latency. Especially, when the path loss exponent is 2, EEMC algorithm could get minimum latency.
GLBCA was proposed by Low et al. 22 to address the load-balanced clustering problem (LBCP) by assigning regular nodes to gateways, so as to distribute the traffic load among the gateways for assuring no gateway is overloaded in WSNs. GLBCA utilizes an approximation algorithm for this non-deterministic polynomial (NP)-hard problem, which is able to guarantee a performance ratio of 3/2. However, GLBCA does not take into consideration the residual energy of both regular nodes and CHs.
Genetic algorithm (GA)-based load-balanced clustering algorithm was proposed by Kuila et al. 15 to address the LBCP for WSNs. In this algorithm, each chromosome represents a complete assignment of all the regular nodes to their corresponding gateways. A fitness function that considers not only minimizing the maximum load of a gateway but also concentrating on the load distribution among all the gateways is built. However, the residual energy of both the CHs and the regular nodes is not taken into consideration. The experimental results indicate that this algorithm is better than simple GA, LBC and the least distance clustering (LDC), 27 and so on, in terms of load balancing of the gateways for equal or unequal load of the regular nodes as well as energy consumption, number of active regular nodes, and execution time.
Latiff et al. 28 proposed an energy-aware particle swarm optimization clustering (PSO-C) algorithm for WSNs using PSO. In PSO-C, each particle represents a CHs selection solution. A fitness function considering both the intra-cluster distance and the residual energy of CH candidates is defined. PSO-C assumes that the data are transmitted from CHs to the BS by single hop instead of multi-hop. The simulation results indicate that PSO-C performs better than LEACH and LEACH-centralized (LEACH-C) in terms of data delivery and network lifetime.
Fuzzy energy-aware unequal clustering (EAUCF) algorithm was proposed by Bagci and Yazici 29 to address the hot spots problem of WSNs. In EAUCF, a fuzzy logic approach, which employs two fuzzy input variables that are the distance to the BS and the residual energy, is adopted to calculate competition radius of each tentative CH. With this fuzzy logic approach, if a tentative CH is closer to the BS or had lower residual energy than another, it will get a smaller competition radius. The CH competition begins after all the tentative CHs have determined their competition radius. Each tentative CH advertises a message, which includes node ID, competition radius, and the residual energy of the source node, to compete with other tentative CHs within its competition range. If the residual energy of a tentative CH is the highest among the tentative CHs which it receives message from, then it becomes a CH. Thus, the intra-cluster work of the CHs, which either are close to the BS or have low residual energy, is decreased. On real WSNs, some CHs elected by EAUCF are likely to be isolated nodes. The experimental results show that EAUCF outperforms LEACH, cluster-head election mechanism using fuzzy logic (CHEF), and energy-efficient unequal clustering (EEUC), in terms of three metrics, that is, first node dies, half of the nodes alive, and energy efficiency, in all scenarios.
Kuila and Jana 3 proposed a differential evolution–based clustering algorithm (DECA) to prolong the network lifetime by reducing energy consumption of highly loaded CHs. In this clustering algorithm, an efficient encoding and decoding scheme of the solution vector is proposed to enable each solution vector to represent the complete assignment of regular nodes to gateways, which is the key step to applying DE algorithm to design clustering algorithm for WSNs. And a fitness function that has considered the energy consumption of both gateways and regular nodes is proposed also, which has a great contribution to the extension of all nodes’ lifetime. What is more, a local improvement phase was proposed to improve the quality of the trial vector. DECA assumes that the gateways communicate with the BS directly. The experimental results indicate that DECA outperforms the traditional DE, GA, load-balanced clustering (LBC), GLBCA, and EELBCA, in terms of energy consumption, network lifetime, and number of dead regular nodes.
Lots of existing clustering algorithms have not considered the residual energy of the sensor nodes. In addition, most of them have not employed multi-hop communication between the CHs and the BS. Therefore, the sensor nodes with low energy, especially those CHs far away from the BS, would run out of energy quickly, which would shorten the whole network lifetime. The proposed IHSCR algorithm in this article is to extend the whole network lifetime as far as possible by balancing the energy consumption of both gateways and regular nodes. In the clustering phase, we have taken the residual energy of gateways into consideration. And the standard deviation of distance from all the regular nodes to their gateways is minimized, so the energy consumption of regular nodes is balanced. In routing phase, we have adopted multi-hop communication between the gateways and the BS, by employing the routing algorithm IHSBEER that we proposed in Zeng and Dong, 16 so as to balance the energy consumption of gateways in the transmission phase.
Mathematical model
This section first presents the system model, containing the energy consumption model and the network model, employed by the proposed IHSCR algorithm. Then, an effective objective function of the clustering problem optimized in this article is proposed.
System model
Energy consumption model
The radio model in Heinzelman et al.
26
is used to estimate the energy consumption of wireless communication in this article. This model utilizes free space or multipath fading channels according to the distance between the transmitting node and the receiving node. If the distance is less than a threshold
where
The energy required for the radio to receive a
Network model
If a gateway is within the communication range of a regular node, the regular node can be assigned to the gateway. In our assumed WSN model, all the regular nodes and gateways are deployed randomly in the scenario, and the communication range of any regular node must cover at least one gateway and any gateway must have at least one forwarding path to the BS. Once the regular nodes and gateways are deployed, they remain stationary. In our approach, the operation of data aggregation is also divided into rounds similar to LEACH algorithm. 26 In each round, all the regular nodes sense the local environmental information, process them into useful data packets, and send the packets to their CHs using carrier sense multiple access/collision avoidance (CSMA/CA) MAC protocol. 30 Then, each CH aggregates the data packets to discard the redundant and uncorrelated data and transmits the aggregated data packets to the BS via multi-hop communication also using CSMA/CA MAC protocol.
Objective function
This article is aimed at maximizing the whole network lifetime via energy-efficient clustering and routing techniques. In the clustering phase, the problem to be addressed is calculating as good as possible a solution of assignment of regular nodes to gateways, so as to balance the energy consumption of both gateways and regular nodes. For balancing the energy consumption of gateways, we introduce the concept of gateway lifetime 3 as follows
where
where
It is obvious that the smaller the standard deviation (
where
To prolong the whole network lifetime, we not only need to balance the energy consumption of gateways, but also need to keep balance between the energy consumption of regular nodes as far as possible. Because the environmental information cannot be collected if the corresponding regular nodes run out of energy. From equation (1), we can see that when the size (
where
Based on above, we establish the fitness function as shown in equation (7), which has considered the balance of the energy consumption of both gateways and regular nodes, and can adjust their weights in the meantime
where
IHSCR algorithm
This section first introduces the HS algorithm briefly. Then, the implementation of IHSCR algorithm is described in sufficient detail.
HS algorithm
HS algorithm, a meta-heuristic, is first developed by Geem et al., 31 which is inspired by the process of looking for a perfect state of harmony when musicians improvising. The HS algorithm has a simple concept and is easy to implement. What is more, it has strong global search ability, according to lots of research. So far, HS algorithm has been employed by many researchers to solve various real-world optimization problems. For instance, Ser et al. 32 proposed HS-based centralized and distributed spectrum allocation techniques to solve the spectrum channel assignment problem in cognitive wireless networks. Manjarres et al. 33 proposed a two-objective localization approach based on the combination of the HS algorithm and a local search procedure to deal with the localization problem in WSNs. Yi et al. 34 introduced a parallel chaotic local search scheme into the HS algorithm for solving the engineering design optimization problem. Chatterjee et al. 35 proposed an opposition-based HS algorithm via introducing opposition-based learning technique into the HS algorithm, to solve the combined economic and emission dispatch problems of power systems. Kulluk et al. 36 introduced the HS algorithm for the supervised training of feed-forward type training neural networks, which are used to solve the classification problems. Yi et al. 37 proposed a nested maximin Latin hypercube design approach based on the combination of successive local enumeration and a modified global HS algorithm, for the design of computer experiments.
The five steps of the original HS algorithm are shown as follows: 38 (1) initialization of the optimization problem and parameters; (2) initialization of the harmony memory (HM); (3) improvisation of a new harmony; (4) update the HM; and (5) repeat steps 3 and step 4 until the stopping criterion is satisfied:
1. Initialization of the optimization problem and parameters
First, the optimization problem is formulated as follows
where
This step also has specified the parameters of HS algorithm: the harmony memory size (HMS) which is the number of solution vectors in the HM and usually set to 5, harmony memory considering rate (HMCR), pitch adjusting rate (PAR), bandwidth (bw), and stopping criterion (maximum iteration number). Here, HMCR, PAR, and bw are used to explore better solution vectors and both defined in step 3.
2. Initialization of the HM
The HM, as shown in equation (9), is a memory space where store the solution vectors called harmonies that are randomly generated using uniform distribution
3. Improvisation of a new harmony
A new harmony,
where HMCR is a constant between 0 and 1, and
Those elements of the new harmony, which are selected from the HM, need to be determined whether it should be pitch-adjusted. This step is shown as follows
where PAR is a constant between 0 and 1, and
where bw is an arbitrary distance bandwidth, and
4. Update the HM
If the new harmony, that is,
5. Repeat steps 3 and step 4 until the stopping criterion is satisfied
If the stopping criterion is satisfied, the computations are terminated; otherwise, repeat steps 3 and 4.
The proposed approach
There are two phases, that is, clustering phase and routing phase, in our proposed approach IHSCR. First, the network should be setup before performing the proposed approach, like other clustering approaches.14,15,22 During the network setup process, all the gateways and regular nodes are assigned unique IDs. Then each regular node broadcasts a packet containing its ID to its neighbor nodes. Thereby, those gateways within its communication range are able to get its ID. After all the regular nodes have finished broadcasting, the gateways send the packets containing the local network information to the BS. Therefore, the gateways within the communication range of each regular node can be obtained by the BS. In the clustering phase, the proposed clustering algorithm, that is, IHSC algorithm, is executed by the BS to calculate the optimal clustering result. Then, the BS broadcasts the packets containing the optimal assignment of each regular node to the gateways, and the gateways broadcast the packets containing their IDs to their member regular nodes, so as to finish the clustering process. When a regular node has detected environmental information, it processes them to packet and sends the packet to its gateway. Then, the gateways aggregate the intra-cluster data. In the routing phase, the routing algorithm IHSBEER that we proposed in Zeng and Dong 16 is conducted by the BS to calculate optimal forwarding paths for gateways. Each gateway has stored the optimal forwarding path received from the BS and sends the aggregated data to the BS via multi-hop communication according to the forwarding path stored in its memory. Once any gateway or regular node runs out of energy, the network would require re-clustering.
Clustering algorithm
First, we propose a harmony search based clustering (HSC) algorithm for WSNs. Then, several improvements are made to the HS algorithm based on the characteristics of the clustering problem in this article, so that an IHSC algorithm is proposed. It is worth noting that the fitness function is the same as the objective function proposed in section “Objective function.”
Harmony search based clustering algorithm
Before applying HS algorithm to design clustering algorithm for the WSNs in this article, the following problems need to be addressed. First, how to encode a harmony matching with the clustering problem in this article? Then, how to improvise a new harmony? After these problems have been solved, the harmony search based clustering algorithm is proposed, and its flowchart is demonstrated in Figure 1.

Flowchart of HSC algorithm.
where
For example, as we can see from Figure 2, the WSN scenario contains 5 gateways and 12 regular nodes, that is, the gateways set

A wireless sensor network with gateways.
For the convenience of describing the initialization procedure of harmony, we provide the following definition.
Definition 1
where
IHSC algorithm
For strengthening the ability of converging to the global optimum, we make four improvements to HSC algorithm proposed above. First, a roulette wheel selection method is designed to initialize each pitch of a harmony, instead of randomly selecting a gateway for each pitch, which can generate some good initial solutions and contribute to the convergence speed. Second, we make the parameter HMCR dynamically change in the step of improvising a new harmony, which can avoid the prematurity in early iterations and strengthen the local search ability in late iterations. What is more, the roulette wheel selection method designed in this article is also used to improvise a new harmony, which can improve the convergence speed significantly. In addition, a local search scheme is utilized to improve the best harmony in the HM after improvising a new harmony, which aims to improve the quality of the optimal solution. The flowchart of our proposed IHSC algorithm is depicted in Figure 3. We present the detail of those improvements to make the proposed clustering algorithm understandable as follows.

Flowchart of IHSC algorithm.
where
The detailed process of using the roulette wheel selection method to initialize the
The initialization of harmony
If the parameter HMCR keeps a relatively small constant along with the increasing iterations, the algorithm would lose local search ability and may not find the global optimum. And if HMCR maintains a relatively large constant, the algorithm would be easy to run into prematurity. Therefore, it is reasonable for HMCR to take relatively small values in early iterations to strengthen the global search ability of the algorithm and take relatively large values in late iterations to enhance its local search ability, so as to find the global optimum. According to lots of experimental results, we find that the proposed IHSC algorithm performs almost best when HMCR varies with the iteration number as shown in Figure 4 and expressed as follows
where

Sketch map of adaptive HMCR.
In addition to the dynamically changed HMCR, we introduce the previous designed roulette wheel selection method for improvising a new harmony. Supposing
where
Routing algorithm
As mentioned previously, the routing algorithm employed by the proposed approach is IHSBEER that we proposed in Zeng and Dong. 16 The basic implementation of the routing process in this article is a little bit different from that of IHSBEER algorithm. That is the BS transmits the packet containing each gateway’s forwarding path to each gateway by multiple communication in reversed order of gateways within the forwarding path at regular intervals. With the routing algorithm, it is able to significantly balance the energy consumption of gateways in transmission phase. Figure 5 depicts the flowchart of IHSBEER algorithm. The detail of IHSBEER algorithm can be seen from Zeng and Dong. 16

Flowchart of IHSBEER algorithm.
Experimental results and analysis
Experimental setting
To verify the superiority of the proposed IHSCR algorithm, it is compared with HSCR, EELBCA, 14 traditional GA- and DE-based clustering algorithms, and DECA 3 via extensive experiments. For focusing on the comparison of the clustering algorithms’ performance, the routing algorithm IHSBEER is also combined with the clustering algorithms compared. And the fitness function as shown in equation (7) is also employed by DECA, GA- and DE-based clustering algorithms. IHSCR and other clustering algorithms compared are all implemented with C++ programming language. The source code of the proposed IHSCR algorithm can be download from the website https://drive.google.com/open?id=0B8qyXW8tulBqdFZjTW5LelloVXc. In our experiments, all the WSNs scenarios have the sensing area of 200 × 200 m2. For the sake of comprehensive comparison, we consider two types of scenarios, that is, WSN#1 and WSN#2, which is similar to that in Kuila and Jana. 3 For WSN#1, the position of the BS was located in the coordinates (200, 100), that is, the right side of the area, while for WSN#2, the position of the BS was located in the coordinates (100, 100), that is, the center of the area. Furthermore, eight cases are conducted for each type of scenarios as shown in Table 1 and Figure 6 in which the black circles denote the regular nodes, the blue squares represent the gateways, and the red stars denote the BS.
The WSNs cases.
WSN: wireless sensor network.

The WSNs cases in WSN#1 and WSN#2: (a) case 1 in WSN#1, (b) case 2 in WSN#1, (c) case 3 in WSN#1, (d) case 4 in WSN#1, (e) case 5 in WSN#1, (f) case 6 in WSN#1, (g) case 7 in WSN#1, (h) case 8 in WSN#1, (i) case 1 in WSN#2, (j) case 2 in WSN#2, (k) case 3 in WSN#2, (l) case 4 in WSN#2, (m) case 5 in WSN#2, (n) case 6 in WSN#2, (o) case 7 in WSN#2, and (p) case 8 in WSN#2.
In the simulation experiments, we use the parameter values as shown in Table 2. And the parameter values of the clustering algorithms compared are set as the same as those in their reference source. Table 3 shows the setting of main parameters of IHSC algorithm and the algorithms compared.
Parameters of simulation.
Message size: the size of data packet sent by each regular node; packet size: the size of data packet sent by each gateway; WSN: wireless sensor network.
Setting of parameters of algorithms.
PopSize: population size;
Performance metrics
To compare the performance of IHSCR with other four clustering algorithms, we conduct 10 independent runs for each algorithm on each WSNs case. And the following five metrics are used to measure the performance of the algorithms:
Network lifetime: 39 the rounds of each node sending data packets until the first gateway or all the regular nodes run out of energy.
Duration from first gateway die (FGD) and last gateway die (LGD): the duration in rounds from the FGD to the LGD.
Active regular nodes: the number of active regular nodes per round.
Energy consumption: the energy consumption of network per round.
Convergence: this metric contains two aspects, that is, the quality of the optimum found by an algorithm and the speed of an algorithm converging to the optimum over function evaluations.
Simulation results and analysis
The simulation results of all the clustering algorithms are the mean of 10 independent runs.
Network lifetime
Figures 7 and 8 present the comparison of the proposed IHSCR with HSCR, DECA, traditional GA, DE, and EELBCA in terms of network lifetime in WSN#1 and WSN#2, respectively. As we can see from Figures 7 and 8, the differences between the performance of HSCR, DECA, traditional GA, DE, and EELBCA in terms of network lifetime over the vast majority of the cases are small. This is largely because all the clustering algorithms have employed IHSBEER algorithm in the routing phase, which can significantly balance the energy consumption of gateways. However, IHSCR gives better results in all the cases than other clustering algorithms compared. That is due to the following four aspects which can make IHSC algorithm find the better solution that balance the lifetime of gateways than the clustering algorithms compared: (1) for WSN clustering, proposing an efficient discrete encoding scheme of a harmony, which reduces the search space to a great extent; (2) for initialization of harmony and improvisation of a new harmony, designing an efficient roulette wheel selection method to choose a gateway for a regular node to join, which makes a great contribution to improving the convergence speed of IHSC algorithm; (3) for improvisation of a new harmony, proposing the dynamically changed HMCR, which can make IHSC algorithm avoid prematurity in early iterations, and enhance its local search ability in late iterations; (4) IHSC algorithm employs a local search scheme to improve the best harmony within the HM in iterations, which makes a great contribution to improving the quality of the optimum found by IHSC algorithm.

Lifetime for cases in WSN#1: (a) case 1 to case 4 in WSN#1 and (b) case 5 to case 8 in WSN#1.

Lifetime for cases in WSN#2: (a) case 1 to case 4 in WSN#2 and (b) case 5 to case 8 in WSN#2.
Duration from FGD to LGD
The metric “Duration from FGD to LGD” is used to compare the performance of the clustering algorithms in terms of balancing the lifetime of gateways. It is worth noting that the smaller is the value of this metric, the better is the level of balancing the lifetime of gateways. Figures 9 and 10 show the comparison of IHSCR with other clustering algorithms in terms of balancing the lifetime of gateways in WSN#1 and WSN#2, respectively. Because all the clustering algorithms have employed IHSBEER algorithm in the routing phase, it will affect the results of the clustering algorithms on this metric more or less. However, it can be seen from Figures 9 and 10 that IHSCR still performs better than other clustering algorithms on this metric in the vast majority of the cases, which means that IHSCR also has an outstanding performance in balancing the lifetime of gateways with respect to other clustering algorithms. This is also due to the four aspects of IHSC algorithm mentioned in section “Network lifetime,” which can make IHSC algorithm find the better assignment solution than other clustering algorithms.

Difference between FGD and LGD in rounds for cases in WSN#1: (a) case 1 to case 4 in WSN#1 and (b) case 5 to case 8 in WSN#1.

Difference between FGD and LGD in rounds for cases in WSN#2: (a) case 1 to case 4 in WSN#2 and (b) case 5 to case 8 in WSN#2.
Active regular nodes
Active regular nodes, that is, the number of active regular nodes per round, are another important metric that is used to measure the performance of the clustering algorithms on balancing the energy consumption of regular nodes. The larger is the value of this metric, the better is the level of balancing the energy consumption of regular nodes. For the sake of fairness, IHSCR is compared with other clustering algorithms in terms of active regular nodes on case 3 and case 8 in WSN#1 and WSN#2, respectively, and the experimental results are showed in Figures 11 and 12. It can be seen from Figures 11 and 12 that the rates of death of the regular nodes for IHSCR and EELBCA are much lower than those for HSCR, DECA, traditional GA- and DE-based clustering algorithms. What is more, IHSCR has better performance than EELBCA according to Figures 11 and 12. That is because EELBCA uses a min-heap containing the CHs to assign the regular nodes by considering the distance between the regular nodes and their CHs, which will make all the clusters contain almost the same amount of member regular nodes. And the regular nodes and gateways may not be uniformly allocated to the sensing area, so lots of regular nodes may be assigned to the farther gateways rather than their nearest gateways for EELBCA. Whereas, IHSCR is able to find the assignment solution that decreases the standard deviation of distance from all the regular nodes to their gateways as far as possible, which can significantly balance the energy consumption of regular nodes. The better performance of IHSCR in terms of this metric is also due to the four aspects of IHSC algorithm mentioned in section “Network lifetime.”

Active regular nodes for case 3 in (a) WSN#1 and (b) WSN#2.

Active regular nodes for case 8 in (a) WSN#1 and (b) WSN#2.
Energy consumption
Energy consumption, that is, the energy consumption of network per round, is a common metric that is used to measure the performance of the clustering algorithms on energy efficiency of the network. The smaller is the value of this metric, the better is the level of energy efficiency of the network. Figures 13 and 14 present the comparison of all the clustering algorithms in terms of energy consumption of network per round on case 3 and case 8 in WSN#1 and WSN#2, respectively. It can be seen from Figures 13 and 14 that IHSCR and EELBCA perform better than other clustering algorithms in all the cases on this metric. This is due to IHSCR and EELBCA can find the better assignment solutions that decrease the standard deviation of distance from all the regular nodes to their gateways than other clustering algorithms. It is worth noting that although EELBCA has a good performance on this metric, it performs worse than other clustering algorithms on network lifetime in the vast majority of the cases, as shown in Figures 7 and 8, because it has not considered the residual energy of the gateways.

Energy consumption for case 3 in (a) WSN#1 and (b) WSN#2.

Energy consumption for case 8 in (a) WSN#1 and (b) WSN#2.
Convergence
In this section, IHSC algorithm is compared with other clustering algorithms in terms of convergence on case 3 and case 8 in WSN#1 and WSN#2, respectively, and the results of the best fitness among the population in each evaluation are showed in Figures 15 and 16. As we can see from Figures 15 and 16, the quality of the optima found by IHSC algorithm is far better than those found by all the other clustering algorithms, and IHSC algorithm also converges faster than most of other algorithms. It is worth noting that the convergence of IHSC algorithm can be divided into four stages, due to the dynamically changed HMCR: first, the fitness value decreases fast along with the increase of HMCR from 0.2 to about 0.5, due to the fast growing local search ability; second, when HMCR increases from about 0.5 to about 0.7, the convergence speed will slow down, because the algorithm achieves a balance between the global search ability and the local search ability; third, the algorithm will accelerate convergence when HMCR increases from about 0.7 to about 0.9, due to the strong local search ability; finally, when HMCR increases from about 0.9 to about 0.99, the convergence speed will slow down again, because it is near to the optimum. Especially, as it can be seen from Figures 15 and 16, HSC algorithm converges faster than IHSC algorithm in early iterations, however, converges slower than IHSC algorithm in middle and later iterations, which is because HSCA is easy to trap in local optima. The outstanding performance of IHSC algorithm in terms of convergence is also due to the four improvements made to HSC algorithm.

Convergence graph for case 3 in (a) WSN#1 and (b) WSN#2.

Convergence graph for case 8 in (a) WSN#1 and (b) WSN#2.
Conclusion and future works
In this article, we propose an energy-efficient clustering and routing algorithm for WSNs, called IHSCR, which is based on HS algorithm. For dealing with the clustering problem, first, an objective function model, which has considered balancing the energy consumption of both gateways and regular nodes as well as considered routing, is established. Then, a new clustering approach, that is, IHSC algorithm, is developed based on four improvements made to the traditional HS algorithm: (1) an efficient discrete encoding scheme of a harmony (i.e. solution) for WSN clustering is proposed, which can contribute significantly to reducing the search space; (2) an efficient roulette wheel selection method is designed to choose a gateway for a regular node to join, which is employed by two steps (i.e. initialization of harmony and improvisation of a new harmony) and can contribute significantly to improving the convergence speed of IHSC algorithm; (3) the dynamically changed HMCR is designed for improvisation of a new harmony, which can make IHSC algorithm avoid prematurity and strengthen its global search ability in early iterations, and enhance its local search ability in late iterations; (4) a local search scheme is proposed to improve the best harmony within the HM in iterations, which can contribute significantly to improving the quality of the optimum found by IHSC algorithm. Besides, in the routing phase, the IHSBEER algorithm that we proposed previously is employed to calculate the forwarding paths for gateways, which can significantly balance the energy consumption of gateways. The proposed IHSCR is compared with HSCR, EELBCA, traditional GA- and DE-based clustering algorithms, and DECA over extensive WSNs cases. The experimental results clearly demonstrate that IHSCR has better performance than other clustering algorithms in terms of network lifetime, balance of the energy consumption of gateways and regular nodes, energy consumption, as well as convergence situation. In the future, we will implement IHSCR algorithm on a real WSNs to validate its effectiveness.
