1 Introduction

Forming network clusters is an effective way to improve the scalability and longevity of wireless sensor networks (WSN) [14]. In a cluster-based sensor network, data from cluster members are relayed by a node, namely cluster head, to the base station, which is usually outside the sensor field and could be at a far distance. Ideally the lifetime of a homogeneous WSN is maximized when the residual energy of nodes in the network are about the same, i.e., no single node completely depletes its energy before the others. This is, however, difficult to achieve in a real-world cluster-based networks due to variations in energy consumption as different roles of sensor nodes and various signal transmission distances. The nodes serving as cluster heads consume additional energy to fulfill tasks such as receiving messages from the member nodes and relaying the aggregated messages to the base station. Balancing node energy consumption and extending the overall network lifespan are non-trivial, given many factors that could affect the energy expenditure [5, 6].

Energy consumption of a node is attributed to data acquisition, processing, and transmission. In a complex network, factors such as distance among nodes, distance to the base station, and data throughput greatly influence the residual energy of each node. Methods have been developed that account for one or more such factors to achieve extended network longevity. Low energy adaptive clustering hierarchy (LEACH) [7] is developed to allow different nodes to share the burden of relaying messages. Rotating the role as the cluster head among nodes in the cluster, balances the load and provides a means for fault-tolerance [8]. Energy-efficient unequal clustering (EEUC) [9] selects the cluster head based on the distances between the node and the base station. Leader election with load balancing energy (LELE) [10] takes the residual energy into consideration and nodes with more energy are more likely to serve as cluster head. In [11], the number of neighbors, residual energy, and distance to the base station are used in constructing clusters and selecting cluster heads. Without even looking into the characteristics of each single node, the network itself varies greatly in the number of sensor nodes, their placement, and the arrangement of the base station. A pre-determined communication structure or a randomized clustering scheme is far from fulfilling the critical needs of extending the network longevity. Despite the great efforts in automatically organizing sensor nodes, the dynamic nature of sensor networks and numerous possible cluster configurations make searching for an optimal network structure on-the-fly an open challenge.

In this article, we propose a genetic algorithm-based, self-organizing network clustering (GASONeC) method that provides a framework to integrate multiple factors and optimize dynamic node clustering. In GASONeC, the residual energy, the expected energy expenditure, the distance to the base station, and the number of nodes in the vicinity are employed to search for an optimal, dynamic network structure. Balancing these factors is the key for organizing nodes into appropriate clusters and designating a surrogate node as the cluster head. The factors are encoded into the fitness function of the genetic algorithm (GA). In the optimization process, each GA chromosome represents a designation map of cluster heads. Given these cluster heads, the clusters are then formed following the nearest neighbor rule, and the fitness of a WSN is therefore determined by the evaluation of all clusters. In each transmission round, the network structure is updated dynamically to achieve a balance of residual energy of sensor nodes and hence, extend network longevity.

The contribution of this work is twofold: first, a GA-based clustering method is proposed that provides a network encoding scheme and flexible optimization approach that employs a fitness function to integrate energy and spatial factors. The GA chromosomes encode the selection of cluster heads and dynamic clusters are formed accordingly. The separation of the cluster head selection and network structure make this method versatile for taking various factors into consideration. Second, the expected energy expenditure is derived, together with other energy and spatial metrics, to achieve balanced energy consumption across all nodes and improve network longevity.

The rest of this article is organized as follows. Section 2 presents the related work of constructing clusters to extend network life. Section 3 describes our proposed GASONeC method in detail. To be self-contained, we include a brief review of GA. Section 4 discusses our experimental results in comparison to the state-of-the-art methods. Section 5 concludes this article.

2 Related Work

To balance the energy expenditure among nodes, the LEACH was proposed to create clusters of sensor nodes dynamically [7]. The LEACH method randomly selects nodes as cluster heads and forms clusters accordingly. The randomized process avoids election of certain nodes as the cluster head that could exhaust the energy of these nodes much earlier than the others could. Despite its effectiveness of diversifying cluster heads, the resulted clusters are far from optimal. Some early improvements utilized node distance property. Power-efficient gathering in sensor information systems (PEGASIS) [12] restricts each node to communicate only with a close neighbor to form a node chain, and the nodes within a cluster take turns to transmit data to the base station. In EEUC [9], the distance between sensor nodes and the base station is used to select the cluster head. The clusters closer to the base station are smaller in size than those farther from the base station. To expand the network coverage, Nadeem et al. [13] proposed to divide nodes into four logical regions based on their locations in the field. A gateway node is placed at the center of the area. If the distance of a node to the base station (or the gateway) is less than a threshold, this node uses a direct communication; otherwise, a cluster is formed and the cluster head is selected probabilistically. Nayak and Devulapalli [14] extended the LEACH method by introducing fuzzy logic in creating clusters.

Closely related to the node distance is the degree of node, i.e., the number of neighboring nodes. In [15], the degree of connectivity is the main factor of selecting a cluster head. Intuitively, a node with more neighbors is a good candidate to serve as the cluster head, since a node with a low degree of connectivity received a less amount of data from its neighbors to aggregate and to forward to the base station. In the initial phase, each node is involved in the neighborhood information exchanges, i.e., hello protocol, that allows it to determine its degree of connectivity and the location of the base station.

Alternatively, measures of energy have been used in search for the optimal cluster structure. In a stable election protocol (SEP) [16], nodes are allowed to be initialized with different amounts of energy. It uses weighted probabilities to select cluster heads according to the residual energy. Developed distributed energy-efficient clustering (DDEEC) [17] improves upon SEP by categorizing nodes based on their energy level. The nodes with higher energy are named the “advanced nodes” and are those from which cluster heads are selected. Threshold sensitive stable election protocol (TSEP) [18] extends SEP by grouping nodes into three different energy levels, and the cluster head is selected based on a threshold. Modified LEACH (MODLEACH) [19] introduces a cluster head replacement scheme using a threshold. If the residual energy of a cluster head exceeds this threshold, it continues to serve as the cluster head for the next round. Arunraja et al. [20] proposed a distributed energy efficient clustering algorithm that selects cluster heads based on residual energy. Nodes with the least communication costs and high residual energy are included in a cluster.

More recently, combining energy and distance metrics has been extensively explored to identify the optimal network structure. WCA [21] aggregates the degrees of nodes, transmission power, mobility, and battery power with weights in every round. The nodes with the least weighted sum are chosen as the cluster heads. A hybrid energy efficient distributed (HEED) clustering method  [22] combines the residual energy with the distance of nodes to their neighbors or the number of neighbors in the process of selecting cluster heads. LELE [10] method selects a cluster head based on the residual energy and the distance between a node and its neighbors. The node with the largest amount of energy and the number of neighbors is chosen as the cluster head. In [11], cluster heads for the subsequent rounds are selected based on the number of neighbors, residual energy, and distance to the base station. In [23], a two-level fuzzy method is used that includes factors of local and global levels. In the local level, the node’s capability to serve as a cluster head is evaluated based on its energy and the number of neighbors; whereas, in the global level, three parameters have been considered: centrality, closeness to the base station, and the distance between cluster heads. In [24], a fuzzy logic approach is used for cluster head selection by considering the number of neighboring nodes, residual energy, energy dispersion and distance to the base station.

Searching for a balance among the aforementioned factors is non-trivial and optimization methods are usually used. A GA has been applied in the routing protocol of a WSN [2528]. A key objective is to define an appropriate fitness function that encodes the network structure and its goodness. A genetic algorithm and weighed clustering algorithm (GA-WCA) [29] consist of two phases: first, a GA is used to determine the cluster heads based on their locations; second, a WCA algorithm forms the clusters by assigning each node to a cluster head, which depends on the load balancing factor and the total distance from all neighbor nodes to the cluster heads. Seo et al. [30] employed the distance in fitness function to select a cluster head. In the energy harvesting genetic-based unequal clustering-optimal adaptive performance routing (EHGUC-OAPR) method [28] the base station uses an EHGUC algorithm to form unequal size clusters followed by an OAPR algorithm to construct an optimal routing among cluster heads. In genetic algorithm based energy efficient clusters (GABEEC) [26] clusters are created in the set-up phase and remain the same without changes. The GA is used to select cluster heads in each round. The selection of new cluster heads is based on the residual energy of the current cluster heads and the member nodes (Table 1).

Table 1 Summary of the state-of-the-art methods

3 GASONeC for WSN Clustering

3.1 Sensor Energy Model

We adopt the first order radio model (as shown in Fig. 1) for describing energy expenditures in a wireless sensor. The energy expenditure E of a node s is the total energy used to acquire, process, transmit, and receive data:

$$E_s=E^A_s(l)+E^P_s\left( l^{\prime }\right) +E^R_s\left( l^{\prime \prime }\right) +E^T_s\left( l^{\prime },d\right) ,$$
(1)

where \(E^A_s(l)\) denotes the energy used to acquire l bits of data, \(E^P_s(l^{\prime })\) denotes the energy used to process \(l^{\prime }\) bits of data, \(E^R_s(l^{\prime \prime })\) denotes the energy used to receive \(l^{\prime \prime }\) bits of data from nearby nodes if node s serves as a cluster head, and \(E^T_s(l^{\prime }, d)\) denotes the energy of transmitting \(l^{\prime }\) bits of data over a distance d. \(E^R_s(l^{\prime \prime })\) is non-zero only if node s serves as a cluster head. We assume the amount of energy used by each node in data acquisition is the same.

Fig. 1
figure 1

First order radio model. The energy expenditure model is a function of message length

When computing the energy to transmit or receive a message of l bits, we adopt the following formulas for the transmitter energy consumption \(E^T_s\) and receiver energy consumption \(E^R_s\):

$$E^T_s= E_i + l d^n$$
(2)
$$E^R_s= E_i + l E^{*}$$
(3)

where \(E_i\) is the idle energy expenditure and d is the distance between the transmitter and receiver as shown in Fig. 1. Depending on the distance between the transmitter and receiver, the transmission energy consumption \(E^T\) is proportional to a different order of the distance and can be modeled by varying the power term n. In this model, we use \(n=4\) for long distance transmission, i.e., transmitting messages from the cluster head to the base station, and \(n=2\) for short distance transmission, e.g., a node its cluster head. The communications within the cluster take the short distance transmission; the communications between the cluster head and base station require long distance transmission. \(E^{*}\) in Eq. (3) represents the cost of the beam forming approach to reduce the energy consumption.

Based on the consumed energy, the residual energy of a node s at time t is computed as follows:

$${\tilde{E}}_s(t)=E_s(0) -\sum _{i=1}^t E_s(i),$$
(4)

where E(0) is the initial energy of the node and t is the time in term of transmission rounds. The residual energy of every node is updated in each round.

Nodes are stationary and their geospatial locations are known to the base station. In each network transmission round, the network structure is computed based on the current network status and is broadcast to the nodes. The nodes receive the cluster head assignments and communicate to the base station via the associated cluster heads.

3.2 Energy and Spatial Factors for Longevity

To extend the longevity of a WSN, the key is to avoid some nodes depleting energy before the others. Ideally, network life is maximized when nodes retain the same amount of energy throughout the entire network lifespan. A widely employed energy metric is the residual energy [22]. The nodes with a lower amount of residual energy are less preferred to serve as cluster heads due to the extra energy needed to relay messages from the member nodes. However, the residual energy presents the current status and does not characterize the energy level of a node after the next transmission round, which is a direct measure of the goodness of a network clustering structure. Unless the clustering structure remains the same for the life of the network, the dynamically formed local communication requires different amounts of energy contributions from the to-be cluster head. Hence, it is crucial to gauge the expected energy expenditure for each node in a possible network structure.

Assume l bits of data are collected by each node in a round. In a cluster that consists of \(N_s\) nodes, data are aggregated by the head node s. Following Eqs. (1) and (2), the expected energy consumption (denoted with \({\hat{E}}\)) of a non-cluster head node \(s^{\prime }\) and a head node s can be computed as follows:

$${\hat{E}}_{s^{\prime }}= E + l D^2\left( s^{\prime }, s\right) ,$$
(5)
$${\hat{E}}_{s}= E + N_s l E^{*} + (N_s+1) l D^4(s, BS)$$
(6)

where E is the constant energy expenditure that includes energy used for data acquisition, processing and being idle. Functions \(D(s^{\prime },s)\) and D(sB) give the distances between nodes \(s^{\prime }\) and the cluster head s and from node s to the base station B, respectively, which are approximated with Euclidean distance.

In addition to the energy metrics, a network spatial feature is another influencer to the network life. The spatial characteristics such as the distance to the base station and local node density (LSD) provide additional dimensions for intelligent clustering. It becomes more important when the amount of the residual energy of nodes is very similar, in which case the best network structure is as good as random clustering if spatial factors are not considered.

To characterize the local node density, a neighborhood distance threshold \(\delta\) is used. The density is proportional to the number of neighbors within the \(\delta\)-vicinity as follows:

$$G_s(\delta ) \propto \Vert S_s \Vert ,\quad \text {and}\quad S_s=\left\{ s_i; D(s, s_i)\le \delta \right\}$$
(7)

where \(S_s\) is the set of nodes in the \(\delta\)-vicinity of s and function \(\Vert \cdot \Vert\) gives the set size.

3.3 Dynamically Structuring Sensor Network Using GA

Structuring a sensor network requires grouping nearby nodes into clusters and designating a surrogate node as the cluster head to each cluster. It is essentially a multi-parameter optimization problem, in which energy and spatial factors need to be optimized concurrently to achieve overall network longevity.

In GASONeC, a binary chromosome is used to specify the cluster heads in the network, in which a one represents a cluster head and a zero represents a member node to a cluster. An example is shown in Fig. 2 and the cluster heads are highlighted with filled circles. The dash arrows depict the cluster membership. When a node becomes inactive, i.e., out of power, its corresponding gene value is set to −1, which exempts the node from further GA operations.

Fig. 2
figure 2

GA chromosome and the mapping to network clusters

The mapping to node clusters from a chromosome is to minimize the network communication distance \({\mathbb{D}}\) as follows:

$${\mathbb {D}}=\sum _{i=1}^C \sum _{j=1}^{N_{s_i}} D\left( s_i, s_j\right)$$
(8)

where C is the number of clusters in a network and \(N_{s_i}\) is the number of member nodes in a cluster headed by node \(s_i\). In practice, minimizing \({\mathbb{D}}\) is equivalent to assigning nodes to clusters following the nearest neighbor rule.

3.3.1 Fitness Function

A key component of the GASONeC method is the fitness function. As discussed in Sect. 3.2, there are many factors that influence the network’s life. Fitness function provides a means to optimize several factors concurrently. The following is a fitness function that integrates energy and spatial factors:

$$f_1=\sum _s \frac{E_s(t)}{E_s(0)}+\frac{\tilde{E}}{\hat{E}}+\frac{1}{\hat{D}},$$
(9)

where \(E_s(t)\) is the residual energy of node s at round t and \(E_s(0)\) is the initial energy of node s. \({\tilde{E}}\) is the total energy cost if the messages are transmitted directly from all nodes to the base station and \({\hat{E}}\) is the expected energy expenditure. \({\hat{D}}\) is the total distance between the cluster heads and the base station:

$$\hat{D}=\sum _{i=1}^{C} D(s_i, BS)$$
(10)

where each \(s_i\) is a node that serves as a cluster head. The terms are normalized to the range of (0 1). This objective function includes normalized residual energy, the ratio of expected energy expenditures, and the inverse of the total distance between cluster heads and the base station. When distance is considered, a node that is closer to the base station is usually preferred. That is, maximizing the inverse of the distance gives us a solution with minimum distance. Similarly, we aim to minimize the expected energy expenditures, and an inverse operation is used. As to the residual energy, the goal is to maximize it. Yet, we should avoid possible bias induced by its dynamic range. Hence, a normalization is performed. Without knowledge of the priority of the factors, we assume these three terms are equally important and therefore the fitness function takes even weights. However, in cases where it is clear one or more factors play a more vital role, uneven weights can be employed in the fitness function.

Figure 3 depicts a scenario in the middle of network life. Table 2 gives the states of the nodes in this exemplar scenario. The nodes marked with red served as cluster heads in the previous transmission rounds, and their remaining energy is relatively low. In this new round, node 5 and node 8 are potential cluster heads to be selected. Based on the residual energy and distance to the base station, node 5 is at an advantage. Its residual energy is at 0.7 and distance to the base station is at 30. If node 5 serves as the cluster head, the cluster headed by node 5 includes nodes 1, 7, and 8, as depicted with the blue circle in Fig. 3. If node 8 serves as the cluster head, its cluster includes 1, 5, 7, 9, and 10. That is, node 9 is no longer a member of the cluster headed by node 4, and node 10 is no longer a member of the cluster headed by node 14. Hence, the expected energy for those nodes changes, as shown in Table 2. Let \({\tilde{E}}\) be 0.5. The fitness value for the chromosome that specifies nodes 4, 5, 13, and 14 as the cluster head is 1.51 and the fitness value for the chromosome that specifies nodes 4, 8, 13, and 14 as the cluster head is 1.57. Hence, node 8 is more likely to be selected as the cluster head. Since node 8 alleviates the burden for node 14, which is already at a fairly low energy level, the network structure is clearly a better choice. The inclusion of the expected energy expenditures allows a global balance among nodes.

Fig. 3
figure 3

An exemplar scenario of network restructuring

Table 2 States of the network nodes in the exemplar scenario in Fig. 3

Alternatively, we take into account the local node density as shown in Eq. 7 and have the following fitness function:

$$f_2=\sum _s \frac{E_s(t)}{E_s(0)}+\frac{\tilde{E}}{\hat{E}}+ \frac{1}{\hat{D}}+\frac{1}{N}\sum _{s^{\prime }}G_{s^{\prime }}(\delta ),$$
(11)

where \(s^{\prime }\) denotes nodes serving as cluster heads. Including node density favors the choice of cluster heads with more close neighbors. Note that the first term on the residual energy is an aggregation of energy of all nodes including cluster heads and member nodes; whereas, the last term includes only the nodes serving as cluster heads.

figure a

3.3.2 Genetic Algorithm-Based, Self-Organizing Network Clustering

Algorithm 1 presents GASONeC method. In this algorithm, \(q \in [1, Q]\) denotes the number of generations, and the population size is P. The pool of chromosomes, denoted by U, is initialized with randomly generated individuals. An intermediate pool of chromosomes, denoted by \({\tilde{U}}\), is used to hold the individuals created in a generation. In the crossover operation, two chromosomes are randomly selected from U and, according to the crossover probability \(\alpha\), two new chromosomes are created by switching consecutive genes. In the mutation operations, the value of a randomly picked gene is altered between 0 and 1 according to the mutation probability \(\beta\).

GASONeC starts with randomly initialized chromosomes and clusters are then formed for an instance of network structure based on each chromosome following Eq. (8). In addition, each chromosome is evaluated according to the objective function in Eqs. (9) or (11). Such initialization provides multiple random network structures for the optimization process.

In the evolution process, an intermediate pool of chromosomes, denoted with U, are created. GA operations are performed to randomly select individuals. If a crossover probability allows, a pair of chromosomes are used to generate two new individuals by exchanging part of the genes in the chromosomes. If a mutation probability allows, mutation is performed over an individual by randomly changing the value of a gene, i.e., change a randomly selected bit from 1 to 0 or vice versa. The three GA operations continue until a specified number of chromosomes are generated for U. In most cases, the size of this intermediate pool of chromosomes is greater than the population size for GA so that better breeds are more likely to survive. Each newly generated chromosome is evaluated according to the objective function to get a fitness value. A random selection with respect to the fitness value is used to decide which chromosomes continue to the next round of evolution.

The evolution terminates when one of the following criteria is satisfied (1) the maximum number of generations is reached; or (2) the fitness converges. Upon completion of the GA evolution, the chromosome that gives the best fitness value is used to restructuring the nodes.

We assume the population size of the intermediate pool is R and the number of the generation is Q. Since the size of the intermediate pool is much greater than or equal to the population size P, the complexity of GA is O(RQ). In addition, the evaluation of a chromosome is an independent process of the GA, which is a function of two sequential processes: node clustering and network evaluation. In the clustering process, each node needs to compute the distance to the cluster head. Hence, the complexity is O(NC), where N is the number of nodes and C is the number of clusters. The cluster evaluation is of O(C), and the overall complexity is O(NCRQ). In practice, \(R,Q \ll N,C\), we have O(NC) as a reasonable complexity approximation.

4 Experimental Results and Discussion

4.1 Experimental Settings

In this evaluation, the WSN has the following properties:

  • There is one base station that receives data from nodes;

  • Nodes are stationary and their locations are known;

  • Provided with sufficient energy, each node can directly reach the base station;

  • The characteristics and initial energy of each node are the same.

Table 3 lists the network parameters used in these experiments. In running GA, we use the population size of 30 for 30 generations. The crossover probability and mutation probability are 0.8 and 0.006, respectively. Note that a large mutation rate may lead to loss of good solution; whereas a small crossover rate could hinge the convergence [32]. The neighborhood distance threshold \(\delta\) is 20 m when LSD is calculated.

Table 3 Network properties

The average performance of ten repetitions is reported. In each experiment, nodes are randomly placed in the field and the base station is also randomly placed at a certain distance to the field center. Comparison studies are conducted with eight state-of-the-art methods including LEACH [7], MODLEACH [19], HEED [22], PEGASIS [12], SEP [16], TSEP [18], M-GEAR [13], DDEEC [17], GA-WCA [29], and GABEEC [26], among which GA-WCA and GABEEC are methods that employ GA.

4.2 Network Longevity

To maximize the network life, no node shall deplete its energy before any others. That is, between transmission rounds, the residual energy of all nodes is at the same level. In practice, however, this is infeasible, especially when the data volume transmitted within a round is large. Nevertheless, by restructuring the network, the discrepancy among nodes can be suppressed and the network life then improves.

Figure 4 illustrates the average residual energy (in terms of percentage with respect to the initial energy) of nodes in the field using the GASONeC method. In these experiments, 100 nodes were randomly placed in a field of 100 m by 100 m, and the base station was positioned in the center of the field (Fig. 4a) and at the field boundary (Fig. 4b). The fitness function used in this experiment included energy terms and the distance to the base station, i.e., the fitness function in Eq. (9). Ten experiments were conducted with randomly placed nodes, and the average energy levels of all nodes at the transmission rounds of 500, 1000, and 1500 were visualized.

Fig. 4
figure 4

The percentage of the residual energy of the nodes. a Network with base station placed in the center of the field, b network with base station placed in the boundary of the field

It is evident that the residual energy of all nodes is mostly at the same level throughout the network’s life .Footnote 1 Table 4 lists the variance of the residual energy of these two exemplar cases. The energy discrepancy among the nodes increases as the transmission continues. This is inevitable in practice due to the geospatial difference among the nodes. On the other hand, if we allow more generations in GA, it is possible to identify a better network structure to minimize the variance of the residual energy. As a consequence, it takes longer time to come to a solution, which impacts the efficiency of the network.

Table 4 Residual energy (J) variance of nodes

Figure 5 depicts the average number of live nodes throughout the entire network lifespan using the state-of-the-art methods. In Fig. 5a, b, 100 nodes are randomly placed in a 100m by 100m field. Figure 5a illustrates results with the base station placed in the field center, and Fig. 5b illustrates the results with the base station placed on the field boundary. Figure 5c, d illustrate results of a sensor field with randomly placed nodes in an area of 400 m by 400 m. The base station locations for Fig. 5c, d are at the field center and on the field boundary, respectively. In these plots, the x-axis shows the number of network transmission rounds (in 1000s); whereas the y-axis shows the percentage of live nodes. Note that the number of nodes deployed in the field is the same in all cases (see Table 3). As the network transmission continues, the number of live nodes decreases as more nodes deplete their energy.

Fig. 5
figure 5

Network lifetime in terms of network transmission rounds. a Base station in the center of a 100 m by 100 m field. For clear visualization and consistence among all figures, the x-axis in a is truncated. The number of rounds when the last node depletes all its energy for GASONeC is 14,500. b Base station on the boundary of a 100 m by 100 m field. c Base station in the center of a 400 m by 400 m field. d Base station on the boundary of a 400 m by 400 m field

The node density greatly affects the network longevity. Figure 5a, c shows the same placement of the base station, but the node density in Fig. 5c, i.e., field 400 m by 400 m, is much lower. Due to the increased distance between nodes, the network life is shortened. A similar pattern can also be observed when the base station is placed on the boundary of the field, as shown in Fig. 5b, d. Essentially, the density is a transformed view of distance. As the distance between nodes increases, the advantage of forming node clusters becomes less significant in extending the network life.

Placement of the base station also has an impact on the network life, particularly to GASONeC method. Comparing Fig. 5a, b, the network life using GASONeC is much longer when the base station is placed in the center of the field. The other methods are not affected as much as GASONeC although the decrease in network life is observed with the base station placed on the field boundary.

Table 5 presents the average network transmission round of different methods when the first node became unavailable due to energy exhaustion. By comparing the results with respect to the base station placement, it is clear that as the distance between nodes and the base station increases the average network life is shortened. This is mostly due to the extra energy required to forward data to the base station. If we compare the results with respect to the field size, networks in a larger area (i.e., sparse sensor network) tend to have shorter lifespan. In these experiments, GASONeC facilitated the greatest number of network transmission rounds. In contrast to the second best results, the maximum improvement rate of network life is 43.4 %.

Table 5 The average number of network transmission rounds before the first node became unavailable due to energy exhaustion

4.3 Local Node Density

Communication to the cluster head in a dense sensor area usually costs less energy for the member nodes. Hence, selecting a node that has more close neighboring nodes to serve as a cluster head is advantageous to reduce energy expenditures. In the GASONeC method, we devise a fitness function that includes the energy terms as well as local node density to facilitate joint optimization. Figure 6 illustrates the percentage of live nodes using fitness functions with local node density, i.e., Eq. (11), and without local node density, i.e., Eq. (9).

Fig. 6
figure 6

The percentage of live nodes using fitness function with/without the number of neighbors. The base station is located in the center of the field. a An area of 100 m by 100 m. b An area of 400 m by 400 m

Figure 6a shows the results of a sensing field of 100 m by 100 m. The solid line with circles depicts the performance of using fitness with local node density; whereas the dash line with solid dots depicts the performance of using fitness without local node density. One hundred nodes are randomly placed in the field, and the average of ten experiments is reported. It is clear that by including the local node density in the GA fitness function, the network life is significantly extended. The network transmission rounds at which the first and the last nodes become unavailable are reported in Table 6. The network life improvement is about fourfold with respect to the round of first node discontinuation.

Table 6 The network life span with and without using the number of neighbors in the fitness function: FND—the round at which first node dies, LND—the round at which the last node dies

However, when the field size increases to 400 m by 400 m, the advantage of including local node density disappears, as shown in Fig. 6b. The lifespans of WSNs using these two fitness functions are almost the same. The network transmission rounds at which the first and last nodes became unavailable in a field of 400 m by 400 m are reported in Table 6, which shows the closeness of the performances. Since the number of nodes in these two cases is the same, it is evident that using local node density yields a better performance in a dense sensor network.

4.4 Impact of the Base-Station Location to Network Structure and Life

Placement of the base station determines the energy expenditure of the nodes; it also affects the network structure. Figure 7 depicts the network clusters with different base station placements. Figure 7a, b shows two cases with the base station placed in the field center and at 300 m away from the center. The cluster heads are highlighted with solid dots and the other nodes are marked with colored circles. Each color represents a cluster. These demonstrate the early network clusters when the energy level of nodes is close to the maximum. The number of clusters increased when the base station was placed far from the sensor field. A similar phenomena was observed with a denser sensor field with 100 nodes in a 100 m by 100 m area, as shown in Fig. 7c, d.

Fig. 7
figure 7

Node placements and clusters (depicted in different colors). The sensor field is a 100 m by 100 m area. a Six clusters are formed out of 50 nodes with the base station at the field center. b Twenty-six clusters are formed out of 50 nodes with the base station at a distance of 300 m from the field center. c Nine clusters are formed out of 100 nodes with the base station at the center. d Fifty-six clusters are formed out of 100 nodes with the base station at a distance of 300 m from the field center

Intuitively, when the base station is placed far from the sensor field, it is preferred that clusters are formed to conserve energy. However, this contradicts maximizing the network life because a significant amount of energy is usually required by the cluster head to relay messages from its member nodes. Table 7 lists the average number of clusters in a sensor field of 100 m by 100 m. It is clear that including the local node density in the GA fitness function makes little difference in the number of clusters. In all cases, the cluster counts are very close. Despite that the number of clusters increases when the number of nodes increases, the proportion of the cluster count and node count remains similar. As the distance to the base station enlarges, the number of clusters increases. With the goal of minimizing the energy discrepancy among the nodes, small clusters are favored by GASONeC when the base station is far from the field.

Table 7 The average number of clusters in a sensor field of 100 m by 100 m

Table 8 presents the average network life with respect to the base station distance to the sensor field. Both fitness functions with and without local node density are considered in this comparison. Clearly the network life reduces when the base station is placed farther away from the sensor field. It is, however, interesting to observe that as the number of nodes increases, the network life is slightly improved. Despite that the volume of data acquired and transmitted within the network increases, the larger number of nodes helps to subside the demand of long-distance data transmission, which facilitates extended network life. Also in this 100 m by 100 m field, local node density also serves as a factor to extend network life when the base station is relatively closer. As shown in the table, when the distance of the base station to the field center is >200 m, the network life (with respect to the first node die) based on the fitness function with the local node density that greatly decreases. As the distance to the base station increases, the energy consumption of the cluster head increases dramatically. LSD favors clusters with many nearby sensors, which usually results in large clusters. For a large cluster, however, the amount of data to be transmitted greatly magnifies the energy cost (recall that the energy cost of a long distance transmission is proportional to \(d^4\)), which drains the energy of the cluster head quickly and hence, exhausts the energy of those cluster heads. On the other hand, the effect of such a distance is trivial when the base station is close. In these cases, using local node density improves network life.

Table 8 Average network life with respect to the base station locations

Figure 8 illustrates the average network life (in terms of network transmission rounds) with respect to the node density. Figure 8a, b depict the results with 50 nodes in the 100 m by 100 m field, and Fig. 8c, d depict the results with 100 nodes in the same field. It is evident that the location of the base station dramatically affects the network life. When the base station is placed far away from the sensor field, more energy is consumed to transmit data, which shortens the network life. Comparing the network life change between the base station placed at 0 (i.e., center of the field) and 100 (or 100 and 150, etc.) shown in Fig. 8b and that shown in Fig. 8a, such an impact is more significant when the local node density is employed in the optimization. Similar observations can be obtained from Fig. 8c, d.

Fig. 8
figure 8

Network life in a sensor field of 100 m by 100 m. a Fifty nodes in the field and the fitness function without local node density. b Fifty nodes in the field and the fitness function with local node density. c One hundred nodes in the field and the fitness function without local node density. d One hundred nodes in the field and the fitness function with local node density

It is interesting to note that when local node density is used in the optimization, the network life is not inversely proportional to the base station distance. The exceptional cases are shown in Fig. 8b, d when the base station is placed at 200 m and 250 m. The network life is surprisingly longer when the base station is placed at 250 m compared to that of when the base station is placed at 200 m. Note that the location of base station is randomized on the radius of certain distances to the sensor field center and the network life reported is the average of ten independent runs. This is possibly due to the instability of including local node density in the fitness function. In contrast, such an anomaly is absent in Fig. 8a, c.

4.5 Efficiency

In the GASONeC method, the most time consuming process is fitness evaluation. Given a chromosome, clusters are formed according to the nearest neighbor rule and fitness is then evaluated according to the cluster. In our experiments, GA employs 30 chromosomes in any generation and 60 offspring are created. Thirty generations are performed to conclude the optimization. The methods are implemented in C# language and experiments are conducted in a computer with an Intel core i5 2.6 GHz CPU, 4 GB memory, and Windows 7 operating system.

Table 9 lists the average time (in s) and the standard deviation that is used to form clusters in each transmission round by the GASONeC method. The fitness function includes energy terms, distance and local node density. The “BS to field” denotes the distance from the base station to the sensor field center. The time reported is before the first node became unavailable due to energy exhaustion. That is, the number of nodes remains the same. Despite that the standard deviation increases when the number of nodes is doubled, the average time is very close for all cases. It is evident that the efficiency of GASONeC is mostly independent from the field size as well as the number of nodes. The overall average time across all experiments is 0.58 s with a standard deviation of 0.05.

Table 9 Average time (in s) is used to identify optimal network structure in each transmission round using GASONeC

5 Conclusion

Forming network clusters is an effective way of improving the scalability and longevity of WSNs. A pre-determined communication structure or a randomized clustering scheme is far from fulfilling the critical need of maximizing the network life. Despite the great efforts in automatic organizing nodes, the dynamic nature of sensor network and numerous possible cluster configurations make searching for an optimal network structure on-the-fly an open challenge. To address this problem, we propose a GA-based, self-organizing network clustering method that provides a framework to integrate multiple factors and optimize dynamic node clustering. In the GASONeC method, we devise a concise way of encoding nodes and propose fitness functions that include residual energy, expected energy expenditure, distance to the base station, and local node density in search for an optimal, dynamic network structure. Balancing these factors is the key of organizing nodes into appropriate clusters and designating a surrogate node as the cluster head.

Compared with state-of-the-art methods, the GASONeC method greatly extended the network life and the improvement is up to 43.44 %. The results showed that as the distance between nodes and the base station increases, the average network life is shortened. This is due to the extra energy required to forward data to the base station. Moreover, when the base station is placed far from the sensor field, it is preferred that more clusters are formed to conserve energy. The node density greatly affects network longevity. Due to the increased distance between nodes, the network life is shortened. The average running time of GASONeC is very close for all cases. It is evident that the efficiency of GASONeC is mostly independent from field size and number of nodes. The overall average time across all experiments is 0.58 s with a standard deviation of 0.05. The efficiency of GASONeC is satisfactory.

In future work, we plan to explore the effectiveness of GASONeC in heterogeneous network structures. In addition, the parallel programming will be investigated to reduce the optimization time for constructing the network clusters.