Utilizing Genetic Algorithm and Artificial Bee Colony Algorithm to Extend the WSN Lifetime

Extending the lifetime of Wireless Sensor Networks (WSN) is an important issue due to the mission assigned to these networks. The sensors collect data relevant to a specific field. Then, the sensors send the collected data to a base station where it is analyzed, and a suitable reaction can be taken. Sensors in WSN depend on a battery with limited energy to do their work. Data transmission and receiving consume energy, which may lead to the loss of the whole network or some of the essential nodes. For this reason, energy must be preserved as long as possible to prolong the network lifetime. Several types of research were presented with different approaches to minimize power consumption. In this paper, we present a hybrid technique that includes two population-based algorithms: genetic algorithm (GA) and artificial bee colony (ABC) with clustering approaches. This proposed novel technique aims to reduce the dissipation of power consumption per sensor node in the WSN, and as a consequence, the lifetime of the WSN is extended. The ABC algorithm was used to improve an initial population, which was used in the GA. Also, we used two approaches of clustering; clustering based on genetic algorithm and K-means clustering beside LEACH protocol. The experimental results show that the proposed approach approved its efficiency in lifetime extending through an increasing number of the operational nodes per round and transmission.


I. INTRODUCTION
IRELESS sensor network (WSN) is a group of independent nodes connected wirelessly; these nodes are small and have limited battery life.These nodes are used to sense and collect data from the surrounding environment, send this data to a base station where data has to be stored and analyzed [1,2].A large number of sensors have to be deployed to interact with the real world, these sensors have limited storage, computation, and battery capacity.For this reason, this type of network faces many challenges, maintaining sensor network topology, transmission media, production cost, and power consumption.
The most important challenge for wireless sensor networks is energy consumption, caused by using of a tiny chip device with a limited power source.The energy of the sensors' batteries is consumed in data traffics between nodes and they need the limited computation.Therefore, researchers in this field focus on improving the WSN performance.They reduce the total energy consumed, which in turn affects the overall life of the network [3].Sensor energy consumption depends on the method used to transmit and route the data, where the sensor nodes run on limited energy in the network, and a lot of energy is consumed when data is transmitted and received [4,5].

W VOLUME 21(1), 2022
The researchers depend on the network topology and how the sensors may aggregate to minimize energy consumption.Therefore, they considered clustering of nodes as a major role in WSN optimization [2,6].In other words, clustering is an effective approach to organize the work of sensor nodes in the network by dividing them into zones called clusters.
The sensors are grouping into groups of different sizes called clusters.Each cluster has a head node (Cluster Head CH) that collects the data from other sensors on the group and sends it to the base station instead of sending data to the base station by each node as shown in Figure 1.
Figure 1.Clustering Operational Stage in WSN [7] Appropriate use of routing protocols can increase the life of WSN.LEACH is one of these protocols.This protocol distributes sensor nodes into clusters, each cluster contains normal nodes and a single cluster head (CH).CH receives information from normal nodes and accumulates that information and forwards it to the sink node.Many other algorithms have been proposed to improve network lifetime, such as the Genetic algorithm and Artificial Bee Colony Optimization (ABCO) that is based on swarm intelligence [8].
In this paper, we demonstrate a novel hybrid approach for energy saving in the WSN based on the combination of genetic algorithm (GA) and artificial bee colony (ABC) along with a K-means clustering in order to improve the general performance of WSN.The proposed approach reduces energy consumption by choosing the predefined clusters heads (CH) in positions that are nearby to the base station (BS).It uses the K-means clustering to balance energy distribution and approve its efficiency as in [9].

II. LITERATURE REVIEW
In this section, we discuss previous works on some Low Energy Adaptive Clustering Hierarchy (LEACH), Genetic Algorithm based Routing Protocol (GA), and Artificial Bee Colony (ABC).

A. LEACH PROTOCOL
Low Energy Adaptive Clustering Hierarchy (LEACH) The LEACH protocol is proposed as the first clustered based routing protocol in the WSN with elegant solutions to conserve energy consumption.It has drawbacks due to the randomized cluster head (CH) election [10].Therefore, many researchers enhanced the performance of a wireless sensor network by improving the LEACH protocol.
Salem and Shudifat in [11] enhanced the LEACH protocol by specifying a cluster head according to the lowest degree of distance from the base station, which reduced power consumption in cluster head nodes and so in the whole network.While [12] enhanced the LEACH protocol by adding features to LEACH protocol in order to reduce the consumption of the network resource in each round by looking at TDMA based MAC protocol.Their results showed a significant reduction in network energy consumption compared to LEACH.In [13], the authors proposed low-energy adaptive clustering hierarchy (LEACH) routing protocols named intra-balanced LEACH (IBLEACH), which extends the life cycle of LEACH protocol by balancing the energy consumption in the network.
LEACH-SM protocol (Low-Energy Adaptive Clustering Hierarchy with Spare Management) [14] was proposed as a modified version of the LEACH protocol.LEACH-SM has three features that can help to increase the WSN life: first, selecting the optimal collection of spares to maximize the WSN lifetime; second, deciding how long spares should remain asleep and third, estimating the WSN lifetime as determined by the energy consumption of all its sensor nodes.O-LEACH protocol [15] was proposed to improve existing LEACH and LEACH-C.The proposed protocol dynamically selects a cluster according to the residual energy of nodes.
The long distance between sensors and sink in WSN uses a lot of energy and decreases the lifetime of the network.As clustering can decrease the used energy of WSN, an intelligent technique for forming and managing clusters was proposed by different authors.Genetic Algorithm (GA) based clustering algorithm and ABC algorithm were proposed in different ways to enhance the using of LEACH protocol.Researchers used Artificial Bee Colony (ABC) to optimize the clustering method in the LEACH protocol.In the following two subsections, we explore researches that adapted these algorithms to enhance the clustering method and extend the network lifetime.

B. GENETIC ALGORITHM BASED ROUTING PROTOCOL (GA)
Genetic algorithm is used to decrease the connecting distance a little and thus the longevity of the network can be increased a little [16].In [17], the authors used the GA to increase the sensor area coverage by finding the best position to maximize the sensor area coverage.While authors in [18] used GA to create energy-efficient node positioning in WSN.
In [10], the authors proposed a traditional clustering algorithm, a Genetic Algorithm (GA).They used the two major parameters distance and energy to evaluate the fitness function.Their work results proofed that the proposed protocol enhanced the network lifetime and performed better than the LEACH protocol.In [19], they enhanced the LEACH protocol by using two fitness functions for comparison purposes.Their experiment results showed that the proposed method increased the lifetime and the throughput of WSN significantly.
In [20], the authors proposed a new method to maximize the lifetime and to improve the stable period of WSNs called Genetic Algorithm-based Energy-Efficient adaptive clustering hierarchy Protocol (GAEEP).They used GA to find the optimum number of cluster heads (CHs) according to their locations to minimize the energy.They found through their experiment that the GAEEP protocol increased the reliability of the clustering process.
In [9], the authors proposed a hybrid technique based on k-means and improved genetic algorithm (GA).This technique aimed to enhance the performance of wireless sensor networks, as the energy consumption reduced, and the lifetime of the network extended.They reduced the energy by finding the optimal number of clusters using improved GA.They used the k-means clustering to balance energy distribution.Their experimental results, which were simulated by NS2, showed that the proposed technique achieved more energy-efficiency and more reliability compared with famous algorithms like LEACH, GAEEP, and GABEEC protocols.
In [21], the authors proposed a new method to extend the lifespan of WSN.They defined the partitioning collection of sensors as a set of k-cover problem.They used GA with a new operator called reconfiguration operator and a new fitness function.They used GA to utilize the fewer sensors in order to define and present the set K-cover.The proposed fitness function generated more covers with less number of sensors and created a set of unused sensors as a backup without any extra computational cost.They came paired their function with frequently used fitness function in literature which was defined as the total number of disjoint set available with a solution.

C. ARTIFICIAL BEE COLONY (ABC)
Artificial bee colony (ABC) enhanced the clustering model in WSN by reducing the dissipation energy of sensor nodes and balancing energy consumption [3,8].The ABC algorithm relies on three types of bees (employed, Onlooker, and Scout bees) to generate the optimal solution.Employed bees are responsible for finding local solutions while onlooker bees are responsible for finding the global optimum.The contribution of their paper has improved the network's performance based on clustering which means clustering is a critical task in WSN.The merit of ABC requires a few control parameters compared with other algorithms such as LEACH, HEED, and PSO.
In [22], the authors presented a new approach based on an ant colony optimization algorithm with special parameters called lifetime aware routing algorithm for wireless sensor networks (LTAWSN).The main purpose of this technique is to reduce energy consumption based on the competency function with two energy metrics.Also, LTAWSN considered the distance between the node and the destination node as an important factor to assign the candidate neighbors.In other words, LTAWSN achieved more balancing transmission between sensor nodes and extend network lifetime whereby dividing of the dissipation energy equally among the sensor nodes in WSN.LTAWSN compared to ACA, ACLR, and EAACA and the result showed it to be the best technique among them.
In [23], the authors proposed a new routing protocol on the ABC algorithm to solve the delay-energy trade-off problem.In their approach, they counted each food source as a possible and feasible candidate path between each original and destination node.They used the artificial bees in the population to modify the positions of the food sources to find out where they are.They defined a fitness function to evaluate the food source with the highest nectar value.The obtained simulation results showed that the proposed protocol can achieve a good trade-off between routing delay and energy.
These two algorithms proved their efficiency in extending the network lifetime.Therefore, hybridization of these two algorithms may be feasible and we may get better results than using each one alone.In the following section, we explain how we combine these two algorithms along with K-means clustering methods, and then, the results and experiment section shows that these two algorithms can prolong the network lifetime more than before.

III. DESCRIPTION OF THE PROPOSED SYSTEM
We suggest an approach based on three phases in order to provide energy saving in WSN.The first phase aims to generate the initial population of sensor nodes based on the ABC algorithm instead of a random way.In the second phase, we apply K-means clustering to assign the best location of clusters head based on two fitness parameters of the wireless network: Direct Distance to Base Station (DDBS) and cluster-based Distance (CD).Finally, we use GA to find the best distribution of nodes surrounding their cluster head.The following three sections explaine these phases in detail.

A. FIRST PHASE: INITIAL POPULATION GENERATION BY K-MEANS
K-means algorithm is based on two major steps; group the data that should be together and determine the center of a cluster.The main idea is to use both Euclidean distance and node's residual energy.The central node collects the information about other sensor nodes in WSN and then implements the K-means clustering algorithm.Figure 2 illustrates the main steps of K-means clustering.There are two classes of the K-Means clustering algorithm: centralized and distributed.In centralized clustering, a central node collects necessary information from each node in WSN individually and then sends clustering results to the same individual nodes [6].On the other hand, in the distributed kmeans clustering every node in WSN decides which of these nodes will be the cluster head based on the information exchanged between all nodes [6].Many experiments prove that Distributed K-means clustering is effective for the task VOLUME 21(1), 2022 of WSN clustering and cluster heads (CH) selection in comparison with the LEACH and HEED protocols.In simple words, Distributed K-means clustering can decrease the consumed energy based on Euclidean distance between CH and member nodes belonging to that cluster [24].Refinement of the initial population uses the artificial bee colony algorithm (ABC) to find a good location for the cluster head.It uses the direct distance to base station (DDBS) and cluster-based distance (CD) fitness parameters to map the best location for a random centroid in WSN.
At this phase and after determining the number of clusters (K), we generate the initial population of nodes within a specific range [1,1000], then we select the first coordinate for the base station (BS) and centroid the first (K) coordinate for clusters head.The fundamental task for the cluster head is to gather data from whole sensor nodes that belong to that cluster then forward it to the BS in the WSN [6].
In this technique ABC honeybees are classified into three different groups according to their tasks: • The employed bees: they are responsible for finding the location of clusters head and collecting information about them.• The onlooker bees: Onlooker bees receive initial information from employed bees to improve the searching process.In other words, they are responsible for finding locations for clusters head based on their experience and the information provided by employed bees.• The scout bees: the scout bees use random way to search for other clusters head locations in the zones that rejected locations.
The employed bees candidate the initial location for the centroid.Then, they discover the neighbors of the initial location by formula (1).For each iteration, they use a fitness to compute the new location (neighbor) to determine if it is better than the initial one to store it in the repository.The onlooker bees select new locations using the roulette wheel selection method (formula (2)).In case of the employed bees suggested location cannot improve further, the scout bee creates a new random location by using formula (3).The output of this phase is the best set of locations for the sensor nodes, which we used as an initial population in GA [25].
( ) where fitthe fitness value of the specific location, SNnumber of locations (equal to No. of employed bees).

B. SECOND PHASE: GENETIC ALGORITHM CLUSTERING THE OUTPUTS
The outputs of the first phase represent the input to the clustering task, which is the genetic clustering algorithm based on Euclidean distance between the sensor nodes.This phase is divided into three fundamental steps: • The initial clustering involves dividing the whole nodes (N) into (K) clusters, identifying initial clusters head at random, then classifying remaining nodes based on the Euclidean distance.• The re-clustering step involves calculating centroids for each cluster.On the other hand, this step is repeated until no change for every CHs.• The third step in the clustering phase is CH selection.
It involves assigning an ID number to each node within each cluster based on the distance between the node itself and the centroid.Small ID means closest node to the centroid, for more details see [24].The following code illustrates the clustering phase: 1. Generate initial population randomly.2. Elect CHs and BS of initial population randomly.3.For each CH Calculate wireless Fitness Parameters (DDBS and CD) 4. Apply ABC Algorithm with the best location of CH. 5. Use the result of ABC as initial population by GA. 6. Apply k-means clustering on an initial population 7. Apply GA to obtain wireless sensor network with high energy.
Clustering based on GA satisfies a trade-off between coverage and energy consumption parameters in WSN, whereby use the ratio of total energy consumption to the total distances of nodes as shown in formula 4. A higher ratio (F (i)) is preferred.In the first term of formula (1), a large number of clusters with the shortest distance between the member nodes and CHs (a) achieved the best trade-off between consumed energy and total distances of nodes.The same were applied to the second term of formula (1). Figure 3 illustrates the sequence of steps for clustering based on GA as appeared in [4].
where T-the number of transmission, ei -the energy needed to transmit data between member nodes and the CH, e jthe energy needed to transmit data from the CH to the BS, Da - a distance between sensor member nodes corresponding to CH, Db -distance between CHs and BS.

C. THIRD PHASE: USING GENETIC ALGORITHM FOR WORKING WITH HIGH ENERGY SENSOR NODES.
In this phase, we computed the energy of returned sensor nodes, we used the higher power sensors as a GA primer based on k-means clustering.Below is a representation of the sensor's nodes in binary code, the cluster head is 1 and the remaining nodes are 0. The selected nodes represent the chromosomes.Parent1 0 0 1 1 0 1 0 1 0 1 Parent2 1 1 0 0 0 0 1 1 1 0 We used Energy Dissipation as objective function in GA as shown in formula (4).Assume the residual energy (Et) for the sensor node after (t) rounds then the energy at (t + 1) appeared in formula (5), where Ed is the dissipate energy.where nthe number of nodes connected to the cluster head, Enenergy dissipated in the amplifier, d(nhn) is the distance between node n and cluster head nh.

IV. SIMULATION AND EXPERIMENTS RESULTS
In our experiments, we used MATLAB in a scenario of 1000 sensor nodes distributed over an area of 100 * 100 m 2 .Also, we used the following parameters in our simulation experiment: 1. Eo: Initial energy of each node with 3 joul value.2. ETx: Energy consumed for transmitter with 5010( 9) Joules = bit value.3. Rx: Energy consumed for receiver with 3 joul value.4. EAD Data Aggregation Energy with 3 joul value.5. Eamp: Energy consumed for amplifier in the node with 3 joul value.6. Size of the data package: number of bits per each message which equal to 4000 bits.We applied the simulation over several algorithms, and we make a comparison between them.First, we ran the experiment using LEACH protocol without any additional restriction.Second, we applied the ABC with the K-means clustering.Third, we applied the GA algorithm over the same environment with K-means clustering.Finally, we applied the proposed algorithm.
Table 1 shows the results obtained by the simulations.The experiments measure two parameters: the total number of rounds and the number of transmissions which we read until the end of the network lifetime.We repeat the experiments several times and we take the average for either the total number of round or for the number of transmissions.The total number of rounds per node represents the life of the sensor node.The LEACH protocol terminates when all nodes are dead.All experiments started with high energy sensor nodes.In GA, the length of the chromosome was 10 VOLUME 21(1), 2022 bits, and thus GA produced off-springs with high quality.In simple words, using ABC beside GA and LEACH protocols record reasonable results.Fig. 4 shows a comparison between the four algorithms.In the proposed algorithm, the artificial bee colony (ABC) generates an initial population randomly.Then, we applied CD and DDBS parameters to obtain the best locations for sensor nodes as shown in Fig. 5.The comparison between the cost of the coordinate for the location in the first iteration and the last iteration showed the improvement in ABC.We can say the number of maximum iterations is important to factor in ABC.Then the sensor nodes distributed surrounding of their clusters heads as shown in Fig. 6.

V. CONCLUSION AND FUTURE WORK
A new novel hybrid approach is designed to enhance the lifetime of wireless sensor networks (WSN).The new approach uses the artificial bee colony (ABC) to enhance the initial population that presents the first step in GA.ABC helps in finding the best population (closest nodes to CHs and BS) rather than having random way.Then, the clustering methods with (CD and DDBS) WSN fitness parameters are applied to decrease the distance between member sensor nodes and CHs and BS.In addition, genetic algorithm is used to generate the offspring (sensor nodes) with high energy in each iteration.Therefore, the proposed algorithm in this paper prolongs the WSN lifetime; the operational nodes through transmission survive for a long time (maximum number of rounds) through applied transfer energy fitness parameter in WSN.In the future, the proposed algorithm may be used in different applications such as smart home, smart agriculture, manufacturing, etc.

Figure 6 .
Figure 6.The Energy consumed per transmission