# Synchronous Firefly Algorithm for Cluster Head Selection in WSN

Authors: Madhusudhanan Baskaran; Chitra Sadagopan
Journal: The Scientific World Journal
 (2015)

---

## Abstract

Wireless Sensor Network (WSN) consists of small low-cost, low-power multifunctional nodes interconnected to efficiently aggregate and transmit data to sink. Cluster-based approaches use some nodes as Cluster Heads (CHs) and organize WSNs efficiently for aggregation of data and energy saving. A CH conveys information gathered by cluster nodes and aggregates/compresses data before transmitting it to a sink. However, this additional responsibility of the node results in a higher energy drain leading to uneven network degradation. Low Energy Adaptive Clustering Hierarchy (LEACH) offsets this by probabilistically rotating cluster heads role among nodes with energy above a set threshold. CH selection in WSN is NP-Hard as optimal data aggregation with efficient energy savings cannot be solved in polynomial time. In this work, a modified firefly heuristic, synchronous firefly algorithm, is proposed to improve the network performance. Extensive simulation shows the proposed technique to perform well compared to LEACH and energy-efficient hierarchical clustering. Simulations show the effectiveness of the proposed method in decreasing the packet loss ratio by an average of 9.63% and improving the energy efficiency of the network when compared to LEACH and EEHC.


---

## Body

## 1. Introduction

Wireless Sensor Network (WSN) finds extensive application in both civilian and military applications. It has been extensively used in target tracking, surveillance, monitor natural disasters, biomedical applications, habitat monitoring, and building management systems [1]. Sensor nodes in natural disasters sense/detect an environment to forecast disasters. In biomedical applications, sensor surgical implants monitor patient’s health. In seismic sensing, sensors ad hoc deployment in a volcanic area detects earthquakes/eruptions [2]. WSN nodes use nonrechargeable storage device with restricted energy and in general replacing batteries is not possible. Thus, energy efficiency is an important issue, and designing power-efficient protocols is critical to prolong life of the sensors [3]. Typically WSNs monitor specific areas using sensors collect data and send to base station (BS). A typical WSN organized hierarchically is shown in Figure 1. In hierarchical structure, to save energy some nodes selected based on the objective function act as Cluster Head (CH) and aggregate data from its entire neighbor. The CH then sends the data to the BS and thus reduces network overheads to ultimately save energy in each node.Figure 1
WSN architecture.WSNs unlike traditional networks have their own design/resource constraints which include limited energy, shorter transmission range, limited bandwidth, and minimal processing power in nodes. Based on the deployment scheme, network size varies with the environment. One of the most important activities in WSN is data aggregation which is the process of gathering data from multiple sensors, fusion of the data, and reduction of redundant transmission. Hierarchical techniques have been found to be quite effective in data aggregation.LEACH randomizes rotation of nodes as CH and thus distributes energy load among network sensors evenly. The idea of LEACH protocol is that nodes become CH periodically with every period having two stages. The first stage is cluster construction and the next is data communication [4]. During the cluster formation each node selects a random number and compares with threshold values t(n). If the number is less than t(n), then it is chosen as CH; else it remains as a regular node in that round. The threshold t(n) is given by (1)tn=p1-p∗rmod⁡1/pifn∈G0ifn∉G,where p is the percentage of the Cluster Heads over all nodes. r is the round number. G is the set of nodes that have not been CH in the first 1/p rounds.Table1 reviews popular hierarchical data aggregation protocols [5].Table 1
Information maintained in the neighborhood table.
Protocol
Organization type
Objectives
Characteristics
LEACH
Cluster
Improve network life time
CHs are rotated randomly for specific time using threshold.
HEED
Cluster
Increase number of rounds
Nodes with different power levels are assumed.
PEGASIS
Chain
Average energy spent by node
Network knowledge is required for computation
Hierarchical chain based protocols
Chain
Energy × delay
Uses chain scheme with binary values.
EADAT
Tree
Improves the number of available nodes at each round.
Broadcasting is achieved from sink
PEDAP-PA
Tree
Balances node dissipation such that all nodes die simultaneously.
Uses the popular Minimum Spanning Tree to achieve its goalFrom Table1 it can be observed that clustering objectives are varied with one of the key objectives being improvement in the network lifetime. Often a clustering objective facilitates meeting application requirements [6–10].As LEACH depends on probability model efficiency in energy savings may not be obtained as CHs may be close to each other [11]. To overcome the disadvantages of LEACH many protocols have been proposed in literature to overcome the suboptimal solution. Various heuristic algorithms based on Genetic Algorithm (GA), Particle Swarm Optimization (PSO), and Artificial Bee Colony (ABC) algorithm have been proposed.In this work, investigations were carried out using the firefly heuristic. A novel firefly heuristic to avoid the local minimum problem is proposed. Firefly heuristic is based on the light intensity produced by fireflies. The intensity of light produced is mapped to the objective function and hence fireflies with low intensity are attracted towards fireflies with higher light intensity. In this work, a hybrid firefly algorithm, synchronous firefly algorithm, is proposed based on(i)
ranked sexual reproduction capability of select fireflies,(ii)
the fireflies created by this method having the best genes from the ranked fireflies.The advantages of the proposed technique are(i)
faster convergence,(ii)
avoidance of multiple local optima.


## 2. Related Work

Hussain et al. [12] presented a wide taxonomy on CH selection techniques in WSN with comparative analysis. Hu et al. [13] proposed a multihop heterogeneous cluster-based optimization algorithm (MHCOA) which reduces the number of CHs, saving an average of 16.7% network energy with minimal end to end delay. Peng et al. [14] presented an energy-efficient prediction clustering algorithm to reduce energy consumption when broadcasting in clustering phase and prolong network lifetime. Bencan et al. [15] proposed an energy-heterogeneous clustering scheme (EHCS) which allows variations in the initial energy of the nodes based on the distance to sink to avoid the energy-hole problem.Optimization techniques for cluster formation and CH selection using PSO, GA, and ACO have been extensively proposed in the literature. Kuila and Jana [16] proposed PSO based CH selection technique with a multiobjective function considering energy consumption of the CHs and delay in forwarding the data packets. In the proposed system, each particle’s dimension is equal to the number of sensor nodes in the network. Natarajan et al. [17] applied LEACH and PSO for optimal selection of energy-aware clusters and CHs. Ma et al. [18] proposed Dual Cluster Heads using Niching Particle Swarm Optimization (DCH-NPSO) which generated two CHs per cluster: Master Cluster Head (MCH) and the Slave Cluster Head (SCH). Ma et al. [19] proposed Adaptive Assistant-Aided Clustering Protocol using Niching Particle Swarm Optimization (AAAC-NPSO) to improve system lifespan and data delivery by optimizing energy dissipation in the networks. Shankar et al. [20] discussed an optimal radius algorithm and hybrid PSO algorithm for selection of CH to extend the lifetime of the network. Ali and Shahzad [21] studied PSO, ACO for routing overhead, route optimality, and energy consumption. Simulation results conclude that PSO and ACO based protocols are efficient routing optimization approaches for WSNs.Rana and Zaveri [22] proposed an integrated approach of CH selection and routing in two-tier WSN using GA based CH selection with A-Star algorithm based routing to extend life of WSN. This approach leads to significant improvements in the network lifetime over other techniques. Peiravi et al. [23] proposed a multiobjective two-nested Genetic Algorithm (GA) based clustering for optimizing the network lifetime for different delay values. Kuila et al. [24] proposed a GA based load balanced clustering algorithm for WSN. Gupta et al. [25] presented GA based routing (GAR) to optimize the distance travelled by the data to reduce energy consumption. New routing schedules were calculated by the proposed GA based on the current network state. Cheng et al. [26] presented Dynamic Load Balanced Clustering Problem (DLBCP) and a dynamic GAs based solution to solve the dynamic network optimization requirements. Özdemir et al. [27] employed Multiobjective Evolutionary Algorithm based on Decomposition (MOEA/D) to optimize cluster-based WSNs. The proposed technique improved coverage and network lifetime compared to NSGA II.Karaboga et al. [28] presented a novel energy-efficient clustering mechanism, based on Artificial Bee Colony algorithm to prolong the network lifetime. Kumar and Kim [29] proposed a new Efficient Learning Automata Based Cell Clustering Algorithm (ELACCA) for WSNs. Hoang et al. [30] proposed a harmony search algorithm for development of centralized cluster-based protocols by minimizing the intracluster distances between the cluster members and their CHs.From literature it can be seen that GA, PSO, and ACO have been extensively used for CH selection. Though GA has good global search characteristics, convergence is poor. Representation of weights in PSO is done arbitrarily and hence search is limited to either global or local space. In this work, it is proposed to investigate the firefly metaheuristic which finds optimal global solution with fast convergence even under multiparameter optimization strategy.Yang [31, 32] demonstrated that though PSO achieves better global optima for various test functions for multimodal optimization than GA firefly algorithm is superior to both PSO and GA in terms of both efficiency and success rate. Similarly, Łukasik and Żak [33] demonstrated the superiority of firefly algorithm in continuous constrained optimization tasks when compared to PSO. Fister Jr. et al. [34] reviewed the use of firefly algorithm in various application domains. The authors conclude that the firefly can efficiently handle multimodal problems, has fast convergence, and is effectively used for general, global, and also local search heuristic.


## 3. Problem Formulation

WSN can be represented by graphG=(V,E) with vertices V={v1,v2,…,vn} and edges E={e1,e2,…,em}. Each edge has weights which represents certain network parameters denoted by(2)wi=w1i,w2i,w3i,…,wpii=1,…,m,where wki (k=1,2,…,p) represents parameters of the network.x
=
(
x
1
,
x
2
…
,
x
m
) can be defined by(3)xi=1ifeiselected0otherwise.The objective of the heuristic algorithm is given by(4)min⁡z1x=∑i=1mw1iximin⁡z2x=∑i=1mw2ixi⋮min⁡zpx=∑i=1mwpixi, where zix is the ith objective to be minimized for the problem.In this work, three quality of service parameters, packet loss rate, end to end delay, and remaining energy, are considered to build the objective function as a minimization problem.


## 4. Methodology

The first order energy model for energy consumed when communication occurs between two nodes is shown in Figure2.Figure 2
The first-order energy model.For distanced between two nodes, the transmitter energy consumption [34] for transmitting k bit is given by (5)ETXk,d=kEelec+kεfsd2,d<d0kEelec+kεampd4,d>d0.The energy consumed by the receiver is given by (6)ERXk=kEelec. In the above equations, transmitting and receiving 1 bit data’s energy consumption is denoted by Eelec. εfs, εamp represent the coefficients of energy consumption for different channel propagation models. d0 is a threshold value denoted as d0=εfs/εamp, to distinguish free-space path loss model from a multipath fading model. Energy consumption for integration of l data packets of k bit is expressed as EDA(k)=l∗k∗EDA, where EDA is energy consumption for integration of data of 1 bit.


### 4.1. Proposed Firefly for Cluster Head Formation

Firefly algorithm metaheuristics work on the principle of the flashing lights of fireflies. The intensity of the light helps a firefly swarm move to brighter and attractive locations which can be mapped to an optimal solution in the search space. The algorithm standardizes some of the firefly characteristics and can be listed as follows:(i)
Each firefly can be attracted to another irrespective of their sex.(ii)
The brightness produced by the firefly is directly proportional to its attractiveness and between two fireflies, the firefly with higher brightness attracts the one which has lower brightness. A firefly moves randomly if it is not able to find a brighter neighboring firefly.(iii)
In the mathematical model, firefly’s brightness is based on the objective function.Firefly metaheuristic is chosen for its capability of providing optimal solutions for multiobjective problems. In this work, a novel fitness function considering energy, end to end delay, and packet loss rate is proposed and given by (7)Fx=Pd/Pt×Eir/Einitexp⁡-ed/em,where Pd is the number of dropped packets. Pt is the total number of packets sent. Eir is the remaining energy in node i. Einit is the initial energy. ed is the end to end delay. em is the maximum allowable delay.The cluster formation and CH selection in firefly are given in Algorithm1.Algorithm 1:Pseudocode for cluster formation and CH selection in firefly.
Objective functionf(x), x = (x1,…,xd)T
Generate initial population of firefliesxi (i=1,2,…,n)
Light intensityIi at xi is determined by f(xi)
Define light absorption coefficientγ
while (t<MaxGeneration)
fori=1:n all n fireflies
forj=1:i all n fireflies
if (Ij>Ii), Move firefly i towards j in d-dimension; end if
Attractiveness varies with distancer via exp⁡[-γr]
Evaluate new solutions and update light intensity
end forj
end fori
Rank the fireflies and find the current best
end whileIn firefly algorithm [30], variation of light intensity and the formulation of the problem in terms of attractiveness are crucial as the objective function is encoded into it. The light intensity is calculated using γ; the fixed light absorption coefficient and the light intensity I can be computed based on distance r such that (8)I=I0e-γr,where I0 is the original light intensity. Approximating using Gaussian law we have(9)Ir=I0e-γr2.The attractiveness β of a firefly is given in (10)βr=β0e-γr2,where β0 is the attractiveness at r=0.In two-dimensional space the distance between two fireflies can be given by their Euclidean distance asrij=(xi-xj)2+(yi-yj)2. A firefly i moves to a more attractive firefly j by (11)xi=xi+β0e-γr2xj-xi+αrand-12.In this work, binary values are used to represent the nodes in each solution. The challenge in this type of encoding is between the real-valued vector space RN and binary space 0,1N and given by (12)Xik=1,ifrand⁡≤11+exp⁡-Xik0,otherwise,where k=1,…,N and rand⁡~U(0,1).In the proposed synchronous firefly algorithm, the fireflies are ranked and the best fireflies selected using tournament selection. The selected fireflies reproduce among themselves by crossover and mutation. An example of the proposed technique is shown. Table2 shows the partial solution for the best fireflies obtained using tournament selection.Table 2
Firefly
n1
n2
n3
n4
n5
n6
n7
n8
n9
n10
soln 1
0
1
0
0
1
1
1
1
1
1
soln 2
0
1
1
0
1
1
0
1
0
0
soln 3
0
0
1
1
0
1
0
1
1
0After crossover and mutation, the reproduced fireflies are given by Table3.Table 3
newsoln 1
0
1
0
0
0
1
0
1
0
0
newsoln 2
0
1
1
0
1
0
1
0
1
1
newsoln 3
0
1
0
0
1
1
0
0
1
0
newsoln 4
0
0
1
0
0
1
1
0
1
1The new solutions are added to the firefly pool and the next iteration of the firefly is continued.


### 4.2. Parameters for Network Simulation

The performance evaluation of the proposed algorithm was carried out using MATLAB. The base station is located 50 meters away from(0,0) of the network. The base station is assumed to have infinite power source:(i)
Nodes are static and do not change location after deployment.(ii)
All nodes have uniform energy at the time of deployment.(iii)
Base station is located outside the network area.(iv)
Each node has a unique ID.(v)
The transmission power in the node varies based on the distance between the communicating devices.Table4 shows the simulation parameters used in this work.Table 4
Simulation parameters.
Parameters
Values
Initial energy of nodesEinit
0.5 J
Amplification coefficient of the free space modelEfs
10 pJ⋅m2/b
Amplification coefficient of the multipathtransmission model Eamp
0.0013 pJ⋅m2/b
Table data fusion rateEDA
5 nJ/b
Circuit lossEelec
50 nJ/b
Clustering probability of nodesp
0.05
Data packet length
4000 b
Control packet length
80 b


## 4.1. Proposed Firefly for Cluster Head Formation

Firefly algorithm metaheuristics work on the principle of the flashing lights of fireflies. The intensity of the light helps a firefly swarm move to brighter and attractive locations which can be mapped to an optimal solution in the search space. The algorithm standardizes some of the firefly characteristics and can be listed as follows:(i)
Each firefly can be attracted to another irrespective of their sex.(ii)
The brightness produced by the firefly is directly proportional to its attractiveness and between two fireflies, the firefly with higher brightness attracts the one which has lower brightness. A firefly moves randomly if it is not able to find a brighter neighboring firefly.(iii)
In the mathematical model, firefly’s brightness is based on the objective function.Firefly metaheuristic is chosen for its capability of providing optimal solutions for multiobjective problems. In this work, a novel fitness function considering energy, end to end delay, and packet loss rate is proposed and given by (7)Fx=Pd/Pt×Eir/Einitexp⁡-ed/em,where Pd is the number of dropped packets. Pt is the total number of packets sent. Eir is the remaining energy in node i. Einit is the initial energy. ed is the end to end delay. em is the maximum allowable delay.The cluster formation and CH selection in firefly are given in Algorithm1.Algorithm 1:Pseudocode for cluster formation and CH selection in firefly.
Objective functionf(x), x = (x1,…,xd)T
Generate initial population of firefliesxi (i=1,2,…,n)
Light intensityIi at xi is determined by f(xi)
Define light absorption coefficientγ
while (t<MaxGeneration)
fori=1:n all n fireflies
forj=1:i all n fireflies
if (Ij>Ii), Move firefly i towards j in d-dimension; end if
Attractiveness varies with distancer via exp⁡[-γr]
Evaluate new solutions and update light intensity
end forj
end fori
Rank the fireflies and find the current best
end whileIn firefly algorithm [30], variation of light intensity and the formulation of the problem in terms of attractiveness are crucial as the objective function is encoded into it. The light intensity is calculated using γ; the fixed light absorption coefficient and the light intensity I can be computed based on distance r such that (8)I=I0e-γr,where I0 is the original light intensity. Approximating using Gaussian law we have(9)Ir=I0e-γr2.The attractiveness β of a firefly is given in (10)βr=β0e-γr2,where β0 is the attractiveness at r=0.In two-dimensional space the distance between two fireflies can be given by their Euclidean distance asrij=(xi-xj)2+(yi-yj)2. A firefly i moves to a more attractive firefly j by (11)xi=xi+β0e-γr2xj-xi+αrand-12.In this work, binary values are used to represent the nodes in each solution. The challenge in this type of encoding is between the real-valued vector space RN and binary space 0,1N and given by (12)Xik=1,ifrand⁡≤11+exp⁡-Xik0,otherwise,where k=1,…,N and rand⁡~U(0,1).In the proposed synchronous firefly algorithm, the fireflies are ranked and the best fireflies selected using tournament selection. The selected fireflies reproduce among themselves by crossover and mutation. An example of the proposed technique is shown. Table2 shows the partial solution for the best fireflies obtained using tournament selection.Table 2
Firefly
n1
n2
n3
n4
n5
n6
n7
n8
n9
n10
soln 1
0
1
0
0
1
1
1
1
1
1
soln 2
0
1
1
0
1
1
0
1
0
0
soln 3
0
0
1
1
0
1
0
1
1
0After crossover and mutation, the reproduced fireflies are given by Table3.Table 3
newsoln 1
0
1
0
0
0
1
0
1
0
0
newsoln 2
0
1
1
0
1
0
1
0
1
1
newsoln 3
0
1
0
0
1
1
0
0
1
0
newsoln 4
0
0
1
0
0
1
1
0
1
1The new solutions are added to the firefly pool and the next iteration of the firefly is continued.


## 4.2. Parameters for Network Simulation

The performance evaluation of the proposed algorithm was carried out using MATLAB. The base station is located 50 meters away from(0,0) of the network. The base station is assumed to have infinite power source:(i)
Nodes are static and do not change location after deployment.(ii)
All nodes have uniform energy at the time of deployment.(iii)
Base station is located outside the network area.(iv)
Each node has a unique ID.(v)
The transmission power in the node varies based on the distance between the communicating devices.Table4 shows the simulation parameters used in this work.Table 4
Simulation parameters.
Parameters
Values
Initial energy of nodesEinit
0.5 J
Amplification coefficient of the free space modelEfs
10 pJ⋅m2/b
Amplification coefficient of the multipathtransmission model Eamp
0.0013 pJ⋅m2/b
Table data fusion rateEDA
5 nJ/b
Circuit lossEelec
50 nJ/b
Clustering probability of nodesp
0.05
Data packet length
4000 b
Control packet length
80 b


## 5. Result and Discussion

Simulations were carried out using LEACH, EEHC, firefly, and synchronous firefly algorithm. LEACH was used to compare the proposed algorithm due to its popularity in the literature and being a random method. Table5 tabulates the simulation results of packet loss rate and end to end delay for various clustering techniques. Figures 3–5 show the results number of clusters formed, lifetime computation, and remaining energy, respectively.Table 5
Average packet loss rate and end to end delay.
Number of nodes
LEACH
Energy efficient hierarchical clustering
Firefly based clustering
Hybrid firefly based clustering
Packet loss ratio %
75
8.3
7.52
6.93
6.07
150
12.74
11.34
10.2
9.06
225
13.15
12.66
10.66
10.42
300
18.3
17.06
15.62
15.53
375
24.68
23.04
21.26
21.05
450
34.48
32.76
24.08
23.05
End to end delay in second
75
0.0011
0.0012
0.0012
0.0010
150
0.0012
0.0014
0.0013
0.0011
225
0.0116
0.0131
0.0121
0.0109
300
0.0197
0.0160
0.0146
0.0136
375
0.0404
0.0421
0.0369
0.0352
450
0.0436
0.0440
0.0466
0.0437Figure 3
Number of clusters formed.Figure 4
Lifetime computation.Figure 5
Remaining energy computation.The proposed hybrid firefly algorithm minimized the packet loss rate by 2.27% when compared to firefly based clustering with 225 nodes and by 39.74% when compared to LEACH with 450 nodes. The proposed hybrid firefly algorithm minimized the end to end delay by 6.42% when compared to firefly based clustering with 450 nodes and by 8.69% when compared to LEACH with 150 nodes. Figure3 shows number of clusters formed for various clustering techniques for different number of nodes.It is observed that the proposed algorithm increases the number of clusters hence reducing the energy consumption significantly. Figure4 shows the lifetime computation in the form of percentage of nodes alive for various clustering techniques when the number of nodes used is 225.The proposed hybrid firefly algorithm increased lifetime by 66.67% when compared to firefly based clustering in 400 rounds and by 66.67% when compared to LEACH in 600 rounds.Figure5 shows the remaining energy computation for various clustering techniques when the number of nodes is 225. The proposed hybrid firefly algorithm has an overall average remaining energy of 88.37% when compared to firefly based clustering in 500 rounds and by 28.57% when compared to LEACH in 600 rounds.


## 6. Conclusion

This work proposed a novel firefly based clustering protocol to select Cluster Head in WSNs. LEACH protocol needs the user to specify probability for use with a threshold function to determine whether a node will become a CH or not leading to NP problem. In the proposed hybrid firefly algorithm, the best fireflies selected using tournament selection are allowed to reproduce among themselves by crossover and mutation. The proposed method achieves faster convergence and avoids multiple local optima. Simulation results demonstrate the efficiency of the proposed method in decreasing the packet loss rate by 15.4% to 39.74% when compared to LEACH and by 6.16% to 30.66% when compared to energy-efficient hierarchical clustering. The proposed hybrid firefly algorithm also increased the lifetime of the network. Future work can be carried out to investigate the impact on increasing specific quality of service parameter.



---

*Source: 780879-2015-10-01.xml*