A quantum inspired PSO algorithm for energy efficient clustering in wireless sensor networks

: Clustering is done in wireless sensor networks (WSN) to conserve the energy of sensor nodes in the network. Decreasing the energy consumption of nodes prolongs the lifetime of the WSN. A quantum bit can exist in “ 0 ” state, “ 1 ” state or a linear superposition of “ 0 ” and “ 1 ” states, unlike the binary bit which can exist in only “ 0 ” state or “ 1 ” state. In this paper, we propose a Quantum inspired PSO (particle swarm optimization) called Quantum-inspired PSO for Energy Efficient Clustering (QPSOEEC). The algorithm is tested by giving different values to the number of sensor nodes and cluster heads, varying the base station position, etc. Then, our results are compared to existing algorithms that demonstrate the superiority of our algorithm.


Introduction
A wireless sensor network (WSN) is a network of nodes deployed within an area in random positions. These nodes interact with each other to collect data, process it and then communicate with a base station (BS). Most often, these sensors are battery operated. Once the sensors are deployed in a specific field, say, in the deep sea or in the battlefield, it is difficult to either replace the battery or supply additional energy. Therefore, the main challenge is to conserve the energy in

PUBLIC INTEREST STATEMENT
Energy Conservation has become a very important factor in the design of any system nowadays. Wireless sensor networks consume lot of energy and various algorithms have been developed to minimize the energy consumption. Clustering algorithms help to minimize energy consumption. Nature Inspired algorithms like PSO have been used to achieve energy efficiency. In this work, propose to use Quantum computing concepts in conjunction with PSO. The advantage of this approach is that the number of parameters to be used decreases, even though by a small amount. Quantum computing will surely change the way we look at computers. The challenge with Quantum computing is that as of now Quantum computers don't exist in a fullfledged form. Hence, it is not possible to test our algorithm on an actual quantum computer. Once Quantum computers become available, the power of our algorithm can be realized.
WSN's. Various mechanisms have been used by researchers for conserving energy and one of the most effective methods is Clustering. In Clustering, the network is divided into various clusters. Each cluster has a cluster head (CH) which collects the data from all member nodes (sensors) of its cluster. Then, the CH aggregates the data and sends it to the BS.
The BS processes the data as per the requirement and performs actions like notifying an event.
The energy consumption of the network is affected by clustering. CH selection is a NP-Hard optimization problem (Latiff, Tsimenidis, & Sharif, 2007). Researchers prefer PSO to other algorithms because it is easy to implement, converges quickly and can escape from the local optima.
In this paper, we present an algorithm where position updates are performed using Quantum Inspired methods and CH selection is done using PSOECHS (Rao, Jana, & Banka, 2017). The algorithm is labeled as Quantum-inspired PSO for Energy Efficient Clustering (QPSOEEC). It is compared with existing algorithms like LEACH (Heinzelman, Chandrakasan, & Balakrishnan, 2002) and PSOECHS (Rao et al., 2017).
The following are our contributions: -Quantum PSO-based position updates followed by PSO-based CH selection -Deriving a weight function for cluster formation -Demonstrating the efficiency of our proposed algorithm over existing algorithms through simulation The rest of the paper is organized as follows. Section 2 contains a review of literature related to the field of interest. Preliminaries like introduction to PSO and QPSO along with the network model and energy model are explained in Section 3. Section 4 consists of derivation of the fitness function, position update using QPSO, selection of CH, and formation of clusters. Section 5 contains discussion of the simulation results. Finally, the conclusion is explained in Section 6.

Review of related works
2.1. Nature inspired approaches for clustering Tillett, Rao, and Sahin (2002) proposed a novel method called PSO (particle swarm optimization), which uses the concept of a swarm for Clustering problem. The main disadvantage of this method is that there may be energy imbalance in the network because it assigns nodes that are not CH nodes to CH nodes based on the distance only. Guru, Halgamuge, and Fernando (2005) proposed PSO-based cluster formation. There may be some residual energy in the sensor nodes that are ignored in this paper. Latiff et al. (2007) proposed the PSO-C algorithm that is used to perform energy aware CH selection. Its disadvantage is that during cluster formation, sensor nodes that are not CH nodes are assigned to the nearest CH and this may cause the network to become inefficient in terms of energy. This also has one more disadvantage that it decreases lifetime of the network. Rao et al. (2017) reported that the PSO-ECHS algorithm performs CH selection while maintaining the energy efficiency. Here, the PSO algorithm performs CH selection. In cluster formation, a weight function is calculated and used by non-CH nodes to join their CHs.

Heuristic approaches for clustering
LEACH (Heinzelman et al., 2002) is a very popular algorithm used for clustering. Here, clusters are formed by the nodes with one node performing as the CH. Those nodes that are not CH (non-CH nodes) perform the job of transmitting data to CH and the CH receives the data. The CH has to collect the data received and transmit it to a remote BS. The disadvantage of this algorithm is the possibility of a CH with low energy being selected. This may cause it to stop functioning, affecting the network. In PEGASIS (Lindsey & Raghavendra, 2002), each node communicates only with a node that is its close neighbor and takes turns transmitting to BS. As far as energy efficiency is concerned, PEGASIS is better than LEACH but it may become unstable when there are networks of large size. TL-LEACH (Loscri, Morabito, & Marano, 2005) introduces the concept of using a Two level hierarchy. Here, local cluster BSs (primary CHs and secondary CHs) are rotated randomly. The disadvantage is that electing secondary CHs causes extra overhead. In addition, there may be an energy imbalance in the network because non-CH nodes are assigned to CHs based on the distance only. M-LEACH (Zhou, Jiang, & Xiaoyan, 2006) and LEACH are almost similar except that M-LEACH forwards data to the next hop CH node; it does not send directly to the BS. The disadvantage is that it does not take into account the cluster formation phase. In V-LEACH (Yassein, Khamayseh, & Mardini, 2009), some CHs are selected as vice CHs. These vice CHs become CHs when the main CHs die. Disadvantage is the additional energy required for selecting Vice CHs. In E-LEACH (Xiangning & Yulin, 2007), nodes having more residual energy are made as CHs for the next round. This can extend the life of the network.

Quantum computing based algorithms
Sun, Feng, and Xu (2004) proposed a Quantum-based PSO. They consider an individual particle of a PSO system moving in a quantum multidimensional space. In (Yang, Wu, & Min, 2015), the authors propose Improved Quantum-behaved PSO with Elitist Breeding (EB-QPSO). Here, elitist breeding strategy is used to escape from local optima and perform efficient search by the swarm. Sun, Fang, Wu, Palade, and Xu (2012)

PSO introduction
Real life swarms inspire PSO (Kennedy, 2011). An example is a flock of birds searching for food and shelter. Each bird is analogous to a particle. Here, each bird will be having a position and velocity; in the same way, a particle of the swarm will be having a position and velocity. In PSO, N denotes the total number of particles. A Position Vector and a Velocity Vector define each particle P. The position vector X = ðx 1 ; x 2 ; :::::; x D Þ signifies a solution and velocity vector V = ðv 1 ; v 2 ; ::::; v D Þ is responsible for exploration of search space. Here, D denotes dimensionality of the search space. It has the same value for all particles. A fitness function, which depends on the application for which the algorithm is being used, is used to evaluate each particle. The objective of PSO is to find that position of a particle, which results in the best value of fitness function. In the initialization stage of PSO, a position and velocity are assigned to each particle. During each iteration, the best/ personal best of a particle denoted as P best i and global best of the swarm denoted as G best are calculated. The aim is to reach a global best solution. To attain this, the position of the particle, X and velocity, V are updated by the following equations: where ω = inertia weight ð0<ω<1Þ C 1 , C 2 = acceleration coefficients, r, R = random numbers uniformly distributed in the interval (0,1), d = dimension component, and The updation process is repeated until an acceptable value of G best is generated. Here, ω, the Inertia weight, is used to control the velocity. C 1 is the Cognitive scaling parameter and C 2 is the Social scaling parameter. Usually, C 2 = C 2 . P best i and G best are calculated as follows: Each particle will try to attain its "personal best" while at the same time trying to move the group towards the Global Best. Clerc and Kennedy (2002) stated that convergence of the PSO occurs when each particle converges to its local attractor p t i;d , which is defined as follows:

QPSO introduction
where ψ t d = C 1 r (C 1 r+ C 1 R) Here, C 1 , C 2 , r and R are as in (1). Each particle will converge to its own local attractor. At the same time, various parameters like the current position of the particle, its personal best position, its local attractor and the global best position of the particle will also converge to one point. This leads to convergence of the algorithm.
Quantum PSO (QPSO) (Sun et al., 2004) is developed based on the above analysis.
Each single particle in QPSO is a spin-less particle moving in an N-dimensional Hilbert space with some energy. Its state is characterized by a wave function which depends only on its position. The probability of a particle appearing at a position denoted by x t i in the iteration t is determined from a probability density function (Liu, Sun, & Xu, 2006).
Using the Monte Carlo method, a particle will fly according to the following formulas: where α = contraction expansion (CE) coefficient α and randv are uniformly distributed random numbers in the range [0,1] m best = mean best m best is calculated as follows: where N = swarm size.
The CE coefficient is a parameter that can be adjusted to maintain a balance between local and global search of the algorithm during the search process. It is controlled by using a time-varying decreasing method (Sun et al., 2012) as follows: The QPSO algorithm is a probabilistic optimization algorithm. A major advantage of QPSO algorithm over PSO is that in QPSO, only the position vector is required for calculations whereas in PSO, both Position and velocity vectors are needed.

The energy model used
The Energy model used is the same as the one used in LEACH (Heinzelman et al., 2002) and PSO-ECHS (Rao et al., 2017). The energy consumed by a node to transmit a l-bit data packet is as follows: where l = no. of bits in the data packet, E elec = the energy dissipated/bit for running the transmitter/receiver circuit, ε fs = amplification energy (using free space method), ε mp = amplification energy (using multipath model), d = propagation distance, and Similarly, energy consumption by the receiver to receive l-bit of data is given by Several factors such as digital coding, modulation, filtering, and signal spreading influence the E elec .
Overall energy that is spent by the sensor node in order to transmit data and receive data is given as follows:

The network model
The sensors are deployed randomly and, once deployed, are assumed to be stationary. A single node can operate as both Sensor as well as CH. Each node performs sensing at regular intervals of time. A node sends data to its CH or BS. Usually the number of sensors will be greater than the number of CHs. The sensors (CH or BS) use different levels of transmission power depending upon the distance to which data will be sent. An assumption is that sensor nodes are homogeneous and have equal capacity for processing and communication.

Proposed algorithm
The QPSOEEC is a nature-inspired algorithm, which combines the good features of both PSO and Quantum computing. The main advantage of our proposed algorithm over existing algorithms is that in the position-updating phase, only one parameter, the position vector, is required. The QPSOEEC algorithm has the following three steps: (1) Position updating (2) CH selection (

3) Formation of clusters
The position updating is done using QPSO (Yang et al., 2015) and selection of CH is done using PSO-ECHS (Rao et al., 2017). The advantage of using QPSO for position updating is that many parameters are not needed as in Rao et al. (2017); only the position vector is needed. In the CH selection phase, the sensor nodes send information, which indicates their location and residual energy to the BS. Only those nodes, which meet a threshold energy, become eligible to be a CH. The CH selection algorithm is run at the BS. Then, cluster formation phase starts.
In cluster formation, a weight function is derived based on factors like distance, node degrees of CHs and energy as in Rao et al. (2017). The sensor node joins the CH with the highest weight value.

Deriving the fitness function
The fitness function is derived in the same way as in Rao et al. (2017). f 1 is dependent on the average distance among clusters and average distance between CH and BS. Our aim is to minimize f 1 : where m ¼ no: of CH 0 s; (13) l j = no. of sensor nodes in cluster, j j = distance between sensor s i and its selected CH, and CH j distðCH j ; BSÞ = distance between CH CH j and the BS.
f 2 is defined as the reciprocal of total energy of all selected CHs. Our aim is to minimize f 2 .
Our aim is to minimize the fitness.

Position update
Position update is done using QPSO (Yang et al., 2015). It is based on quantum computing. The state of the particle can be described with only a position vector unlike the PSO (Rao et al., 2017) where we need position vector and velocity vector. The updating of the position of particle is done by (6).

Cluster head selection
CH selection is done as in PSO-ECHS (Rao et al., 2017). The CHs are selected from the normal sensor nodes based on the energy efficiency. The fitness function is designed such that total energy consumption is minimized.

Cluster formation
Cluster formation is done using a weight function as in Rao et al. (2017). Sensor nodes use a weight function to join a CH which is denoted as CH weight . It is defined as follows: where Energy factor ¼ E residual ðCH j Þ distðs i ; CH j Þ Ã distðCH j ; BSÞ Ã degðCH j Þ Here L is a constant, assumed to be 1 L = residual energy of CH CH j distðs i ; CH j Þ = distance between sensor s i and CH j distðCH j ; BSÞ = distance between distðCH j ; BSÞ and BS degðCH j Þ = degree of node CH j During cluster formation, each sensor node calculates the CH weight using (15) and joins the CH with highest weight value. Table 1 shows the comparison of energy consumption in LEACH, PSOECHS, and QPSOEEC when no. of sensors is 300, no. of CH's is 15, and BS is at (100,100).
As can be seen from the table, the energy consumption using QPSOEEC is better than LEACH and PSOECHS. Similar results were obtained for the cases where number of sensors were varied from 400 to 700 and number of CH's varied from 30 to 50. The resultant graphs are shown later. The overall algorithm is explained in Algorithm 1.

Simulation environment
Our algorithm was tested using C (Dev C++) and results plotted using MATLAB (R2015a) on Windows 8 Pro Platform. For our simulation, the number of sensor nodes was varied from 300 to 700 and CHs from 15 to 50. Each Sensor node is initialized with energy of 2J. The sensing field is of 200 × 200 m 2 ( Table 2). In the test environment, comparison of the Total Energy Consumption is done while varying the number of sensors from 300 to 700 and CHs from 15 to 50. For the first case of 300 Sensors and 15 CHs, the BS was placed at (100,100), (200,200), and (300,300) and the results were obtained. Furthermore, the number of sensors was changed to 400, 500, and 700. The number of CHs was also varied as 35, 40, and 50.
The PSO parameters used as in Rao et al. (2017) are given in Table 3.

Performance metric used
The performance metric used is Energy Consumption. We have considered the Total Energy consumption for a particular number of Rounds (in our case 5000     plotted when number of Sensors is 300 and number of CHs is 30 with BS position varying as (100,100), (200,200), and (300,300) are shown in Figures 4-6. Figures 7-9 depict the scenario when number of sensors is 400 and number of CHs is 40 with the BS position varied as (100,100), (200,200), and (300,300). Figures 10-12 depict the scenario when number of Sensors is 500 and number of CH's is 50 with the BS position varied as (100,100), (200,200), and (300,300). The graphs obtained when number of Sensors is 700 and number of CHs is 35 and BS position varied as (100,100), (200,200), and (300,300) are shown in Figures 13-15.

Conclusion and future work
In this paper, an algorithm called QPSOEEC is proposed. The proposed algorithm uses only one parameter, the position vector whereas PSO requires both position and velocity vectors. The simulation results of QPSOEEC algorithm are compared with existing algorithms LEACH and PSO-ECHS. The no. of sensors and CHs and also the position of the BS were varied. The experimental results show that our algorithm performs better than LEACH and PSO-ECHS in terms of Total Energy Consumption. The values of total energy consumption using QPSOEEC are 89% better than LEACH and 71% better than PSOECHS.           The challenge with Quantum computing is that as of now Quantum computers don't exist in a full-fledged form. So, it is not possible to test our algorithm on an actual quantum computer. Once Quantum computers become available, the power of our algorithm can be realized.