Skip to main content
Cognitive Neurodynamics logoLink to Cognitive Neurodynamics
. 2015 Jan 18;9(2):249–256. doi: 10.1007/s11571-014-9324-y

An improved localization algorithm based on genetic algorithm in wireless sensor networks

Bo Peng 1,, Lei Li 2
PMCID: PMC4378581  PMID: 25852782

Abstract

Wireless sensor network (WSN) are widely used in many applications. A WSN is a wireless decentralized structure network comprised of nodes, which autonomously set up a network. The node localization that is to be aware of position of the node in the network is an essential part of many sensor network operations and applications. The existing localization algorithms can be classified into two categories: range-based and range-free. The range-based localization algorithm has requirements on hardware, thus is expensive to be implemented in practice. The range-free localization algorithm reduces the hardware cost. Because of the hardware limitations of WSN devices, solutions in range-free localization are being pursued as a cost-effective alternative to more expensive range-based approaches. However, these techniques usually have higher localization error compared to the range-based algorithms. DV-Hop is a typical range-free localization algorithm utilizing hop-distance estimation. In this paper, we propose an improved DV-Hop algorithm based on genetic algorithm. Simulation results show that our proposed algorithm improves the localization accuracy compared with previous algorithms.

Keywords: Wireless sensor network, Localization, DV-Hop, Genetic algorithm

Introduction

In recent years, wireless sensor networks (WSNs) have gained worldwide attention. A wireless sensor network is composed of plenty of sensor nodes enabled with sensing and actuating capabilities (Akyildiz et al. 2002).

In WSN, sensor node localization problem is an important issue in many location dependent applications, such as object tracking, traffic management and location based routing. When an abnormal event occurs, the sensor node detecting the event needs the position information to locate the abnormal event and report to the base station. The location of the sensor node is the important information that must be included in the report messages. It is meaningless for the report messages without position information. Global Positioning System (GPS) (Parkinson and Spilker 1996) is the most accurate and most perfect positioning technology to this problem but due to its large equipment and high cost it is not feasible.

Because of the high-cost, only a few anchor nodes are equipped with GPS. The other nodes, called unknown nodes, don’t know their own position. The anchor nodes can assist the unknown nodes to locate themselves. The problem of obtaining location information of unknown sensor nodes has become a hot topic in WSN.

Recently, many localization algorithms have been proposed for WSNs, which have been categorized as range-based and range-free algorithms. The range-based algorithms use absolute point-to-point distance or angle information to calculate the location between neighboring sensors. It includes algorithms such as RSSI (Girod et al. 2002), TOA (Girod and Estrin 2001), TDOA (Savvides et al. 2001), AOA (Niculescu and Nath 2003). These algorithms provide higher localization accuracy but require additional hardware for measurement of distance or angle information and are thus expensive for large-scale sensor networks. On the other hand, the range-free algorithms need only the connectivity of network for localization of nodes such as APIT (He et al. 2003), Centroid (Bulusu et al. 2000), Amorphous (Nagpal 1999), DV-Hop (Nicolescu and Nath 2003, 2001), etc. These algorithms provide less accurate, but they are preferred over range-based algorithms because they are easier to implement with less hardware support which is suitable for low power, low cost WSN. Among them, DV-Hop is the most popular because of its facility, feasibility, and has been broadly used in many fields.

In this paper, we proposed an improved DV-Hop algorithm (GADV-Hop) which is based on genetic algorithm (GA) to improve the localization result of DV-Hop. Simulation results show that the improved algorithm improves the localization accuracy compared with previous algorithms.

DV-Hop algorithm

DV-hop algorithm is proposed by Dragos Niculescu and Badri Nath. The DV-Hop algorithm is comprised of three phases. First, each node in the network computes the minimal hop-count value to every anchor node. And then, the average distance per hop can be estimated by a simple formula and then will be broadcasted. When an unknown node receives it, the receiver will estimate the distance to the anchor node. Finally, after the unknown node obtains three or more estimated values from anchor nodes, its location can be figured out by trilateration (Doherty et al. 2001).

Computing the minimum hop-count value

In the first phase, each anchor node broadcasts a beacon packet with the location of the anchor node and a hop-count value initialized to one, to its neighbor nodes. The format of the packet is {id,xi,yi,Hi}, including the identifier id, coordinate of anchor node i, (xi,yi) and the minimum hop-count value Hi from anchor node i, where the initial value of Hi is 0. After neighbor nodes receive the beacon packet with lesser hop-count value to a particular anchor node, they save the location of the anchor node, and increase the hop-count value by one before transmitting it to other neighbor nodes. Beacon packets with higher hop-count values to a particular anchor node are defined as stale information and will be ignored.

Through this mechanism, each node in the network gets the minimum hop-count value to every anchor node.

Estimating the distance among nodes

In the second step, we estimate the distance between each node. Firstly, each anchor node calculates the average size for one hop, HopSize, using Eq. (1) which is given as:

HopSizei=Σijm(xi-xj)2+(yi-yj)2ΣijmHij 1

where (xi,yi) and (xj,yj) are the coordinate of anchor node i and j, and Hij is the minimum hop-count value between anchor nodes i and j, m is the number of anchor nodes.

After calculating HopSizei, each anchor node broadcasts its HopSizei in the network by using controlled flooding. When an unknown node j receives the HopSizei information from an anchor node, it calculates the distance between itself and the anchor node using Eq. (2) which is given as:

di=HopSizei×Hij 2

where Hij is the minimum hop-count value between anchor node i and unknown node j.

Computing the location

In the third phase, we calculate the location of each unknown nodes. According to the coordinates of the anchor nodes and the distance to them that has been obtained in the second phase, the unknown node calculates its coordinate by using the multilateration method.

Let (x,y) be the coordinate of unknown node P and (xi,yi) the location of the anchor node i. Therefore, distance between the unknown node P and m anchor nodes is given by Eq. (3):

(x1-x)2+(y1-y)2=d12(x2-x)2+(y2-y)2=d22(xm-x)2+(ym-y)2=dm2 3

Equation (3) can be expanded into

x12-xm2-2(x1-xm)x+y12-ym2-2(y1-ym)y=d12-dm2x22-xm2-2(x2-xm)x+y22-ym2-2(y2-ym)y=d22-dm2xm-12-xm2-2(xm-1-xm)x+ym-12-ym2-2(ym-1-ym)y=dm-12-dm2 4

Equation (4) can be written in matrix form AX=b where

A=2(x1-xm)2(y1-ym)2(x2-xm)2(y2-ym)···2(xm-1-xm)2(ym-1-ym) 5
b=x12-xm2+y12-ym2+dm2-d12x22-xm2+y22-ym2+dm2-d22···xm-12-xm2+ym-12-ym2+dm2-dm-12 6
X=xy 7

Coordinate of the unknown node (x, y) is computed as follows:

X=(ATA)-1ATb 8

WSN localization problem

It is supposed that there are m anchor nodes and n unknown nodes in a two-dimensional network. Vector θ=[Z1,Z2,,Zm+n] represent the initial coordinate of sensor nodes and Zi=[xi,yi]T. The coordinates of m anchor nodes are (x1,y1),(x2,y2),,(xm,ym) respectively. The essence of the localization problem is to calculate the coordinates of unknown nodes (xm+1,ym+1),(xm+2,ym+2),,(xm+n,ym+n) based on the given coordinates of m anchor nodes and die distance to the anchor nodes. Therefore, the WSN localization problem can be described as follows:

(x,y)=Fi=1m(xi,yi,di) 9

where (x,y) is the position of the unknown node, (xi,yi) is the position of the anchor node i, and di is the distance between the unknown node and anchor node i.

Genetic algorithm

Genetic algorithm (GA) is a part of evolutionary computing. Genetic Algorithms were first proposed by Holland (1975) and more recently reviewed and enhanced by Goldberg (1989), Forrest and Mitchell (1993) and many others. The genetic algorithm is an optimization technique derived from the principles of evolutionary theory. It has been applied to a myriad of optimization problems, such as the function optimization, traveling salesman problem, neural network optimization and others. It is also an efficient search method that has been used for localization problem in WSNs.

Figure 1 shows the flow chart of genetic algorithm.

Fig. 1.

Fig. 1

Genetic algorithm

An implementation of a genetic algorithm begins with a population of chromosomes (individuals). The evolution of individuals is based on the laws of natural selection and genetic information recombination within the population. A “fitness” value is assigned to each member of the population by a fitness function that gives a measure of the solution quality. The fitter chromosomes are then selected to produce offspring for the next generation in such a way that those chromosomes which represent a better solution to the target problem are given more chances to reproduce than those chromosomes which are poorer solutions.

The main operators of genetic algorithm are selection, crossover and mutation. The genetic operators give each individual the chance of optimization and ensure the evolutionary tendency with the selection mechanism of survival of the fittest. Crossover simply combines the symbol strings of two parents to form two new individuals with different chromosome string that inherits solution characteristics from both parents. However, crossover cannot produce information that doesn’t already exist within the population. Mutation covers this need by injecting new information in the produced chromosome string. The injection is done by randomly altering symbols of the chromosome (Kazarlis et al. 1996).

An improved DV-Hop algorithm based on GA

WSN localization algorithm mathematical model

As in DV-Hop algorithm the distance is an estimated value, so there must be error. The main goal of the localization problem in WSN is to minimize the error.

Genetic algorithm which simulates biological evolution method such as natural selection and genetic mechanism is a method of searching the optimal solution, owning a strong global searching ability (Holland 1975; Goldberg 1989).

In the WSN, the node localization algorithm can obtain the positions of unknown nodes by the optimization method from the perspective of global optimization. Several algorithms based on optimization methods have been proposed to solve this localization problem in WSN (Li and Zhou 2011; Gao et al. 2010; Nan et al. 2007; Liu 2010; Gu et al. 2013). Genetic algorithm is a search heuristic, which can be applied as a method of searching the optimal solution. So we can use genetic algorithm for node localization in WSN. We establish a mathematical optimization model by using the distance between the unknown node and anchor nodes, then use genetic algorithm to solve the optimization model. In this way, we can obtain the position of the unknown node.

In this paper, we present an improved DV-Hop algorithm based on GA.

Suppose that there are m+n sensor nodes in a sensor network, which includes m anchor nodes, whose locations are known, and n unknown nodes whose locations are unknown. The coordinate of anchor node is (xi,yi),(i=1,2,,m), and the coordinate of unknown node is (x,y).

According to the second phase of DV-Hop (Section “Estimating the distance among nodes”), we get the distance di between an unknown node and the anchor nodes i,(i=1,2,,m). So we can get the following equations:

(x-x1)2+(y-y1)2=d1(x-x2)2+(y-y2)2=d2···(x-xm)2+(y-ym)2=dm 10

Because the distance is an estimated value, so there must be error. Therefore, we proposed an improved DV-Hop based on GA to minimize the error of localization problem in WSN, and the localization problem can be formulated as:

F(x,y)=MinΣi=1,,m(x-xi)2+(y-yi)2-di 11

According to the objective function shown in Eq. (11), we set the fitness function as follows:

fitness(x,y)=αF(x,y) 12

where α is a positive real coefficient.

Proposed algorithm: GADV-Hop

The general steps of our proposed algorithm GADV-Hop are summarized as follows:

  • Step 1

    Calculate the minimum hop-count value from each node to each anchor node;

  • Step 2

    Estimate the average size for one hop of each anchor node according to Eq. (1);

  • Step 3

    By using the minimum hop-count value and the average size for one hop, each unknown node estimates the distance to the anchor node according to Eq. (2);

  • Step 4

    Determine the population feasible region of each unknown node and generate initial population in the feasible region;

  • Step 5

    Evaluate the fitness of each individual;

  • Step 6

    Three genetic operations (crossover, mutation, and selection) are performed to generate the next generation. This procedure is repeated until the termination criterion is satisfied.

Creation of the initial population

For improving localization accuracy or convergence rate, we restrain a population feasible region as shown in Fig. 2. Assume that the unknown node N has three nearest anchor nodes A1,A2,A3, whose coordinates are (x1,y1),(x2,y2) and (x3,y3), and (H1,H2,H3) are minimum hop-count value between anchor nodes A1,A2,A3 and unknown node N respectively. The communication radius of all the sensor nodes is R.

Fig. 2.

Fig. 2

Population feasible region

We construct three squares by using the three anchor nodes to be the center, and using (2RH1,2RH2,2RH3) to be the length of the three squares respectively. Intersection of the three squares (shaded zone) is the population feasible region of unknown node N. Initial population is randomly generated in the feasible region, and the coordinate upper and lower bounds of the unknown node N can be defined as follows:

maxi=1,2,3(xi-RHi)xNmini=1,2,3(xi+RHi)maxi=1,2,3(yi-RHi)yNmini=1,2,3(yi+RHi) 13

where (xN,yN) is the coordinate of unknown node N.

Crossover

In this paper, we use an arithmetic crossover operator that defines a linear combination of two chromosomes. Two parents chromosomes (x1,y1) and (x2,y2) that selected randomly for crossover, may produce two offspring (x1,y1) and (x2,y2).

x1=x1α+x2(1-α)y1=y1α+y2(1-α) 14
x2=x2α+x1(1-α)y2=y2α+y1(1-α) 15

where α is a random number in range of [0,1].

Mutation

The mutation operator performs a random move to the neighbor in the population feasible region. An individual (x,y) is chosen for mutation, then the new coordinate (x,y) is defined as follow:

  • cos(θ)0
    x=x+|xmax-x|·cos(θ)y=y+|ymax-y|·sin(θ) 16
  • cos(θ)<0
    x=x+|xmin-x|·cos(θ)y=y+|ymin-y|·sin(θ) 17

where xmin,xmax,ymin,ymax are the upper and lower bounds of coordinates, θ[0,2π] is an angle randomly produced.

Simulation and Experimental Results

In order to evaluate location performance of the proposed algorithm, the experimental simulations are achieved by MATLAB 7.11.0. And then we analyze its performance and compare it with DV-hop algorithm and the GA based algorithm proposed in Li and Zhou (2011).

The experiment region is a square area with the fixed size of 100 m × 100 m in all the experiments, and 100 sensor nodes are deployed randomly in this two-dimensional area. As shown in Fig. 3, red pentacles represent anchor nodes and black dots represent unknown nodes. Each node has the same communication radius, which is set to 30 m. The experimental parameters values are shown as Table 1.

Fig. 3.

Fig. 3

Nodes distribution

Table 1.

The experiment parameters

Parameter Value
Population 20
Generation 300
Crossover probability 0.9
Mutation probability 0.6

In order to compare GADV-Hop, DV-Hop and algorithm in Li and Zhou (2011), we use the location error of each unknown node, which is defined by the following equation:

Error=(xest-xi)2+(yest-yi)2 18

where (xest,yest) is the estimated coordinate of the unknown node, (xi,yi) is the actual coordinate of the unknown node i.

Figure 4a, b show the error of each unknown node between the three algorithms under the different conditions: (a) R = 30, Anchor node = 10; (b) R = 30, Anchor node = 20. In the experiments, the communication radius is set to 30 m, and the number of anchor nodes is 10 and 20 respectively. As shown in Fig. 4a, b, GADV-Hop algorithm is relatively stable, and the localization error is lower than the conventional DV-Hop and the algorithm proposed in Li and Zhou (2011).

Fig. 4.

Fig. 4

Localization error of each unknown node. a R = 30, Anchor node=10. b R = 30, Anchor node = 20

The main criterion of the localization problem is the average localization error. Here the average localization error is defined as ratio between the total error of the unknown nodes and the number of the unknown nodes, and can be calculated according to the following equation:

AvgError=Σi=1n(xest-xi)2+(yest-yi)2n 19

where n is the number of the unknown nodes.

Figure 5 shows the variation of the average localization error with change of the number of anchor nodes. The number of total nodes in the region is 100 and the number of anchor nodes increases from 10 to 90. From Fig. 5 we observe that as the number of anchor nodes increases in the region, average localization error of the three algorithms decreases, and the average localization error by the GADV-Hop algorithm is obviously smaller than DV-Hop and algorithm in Li and Zhou (2011) in all considered conditions.

Fig. 5.

Fig. 5

Average localization error in different anchor node density

With increasing the number of anchor nodes in the network, the minimum hop-count value between the anchor and unknown nodes decrease. Due to lesser hop-count value, the average size for one hop HopSize of the anchor node will be more accurate, and the estimated distance between the anchor node and the unknown node will be closer to its actual distance. Therefore, as the number of anchor nodes increases in the region, the localization error of the algorithms decreases.

Figure 6 shows how the average localization error of the three algorithms fluctuated with the change of communication radius. It can be seen from Fig. 6, our algorithm GADV-Hop achieves lower average localization error than other two algorithms in all considered conditions, and with the increase of communication radius, the average localization error increases gradually. The reason is that with the increase of the communication radius, the estimated distance will be smaller, thus affecting the localization accuracy.

Fig. 6.

Fig. 6

Average localization error with the change of communication radius

As can be seen from the simulation results of Figs. 4a, b, 5 and 6, our proposed GADV-Hop algorithm achieves better performance than DV-Hop and the algorithm in Li and Zhou (2011). In all considered conditions, the localization error by our proposed GADV-Hop is smaller than the other two algorithms. By using a restrained population feasible region, the GADV-Hop algorithm can locate the unknown nodes more accurately and can achieve a much faster convergence compared with the GA-based algorithm proposed in Li and Zhou (2011). The average localization error decreases as ratio of anchor nodes increases. And as the communication radius increases, the average localization error also increases.

Conclusion

Node localization is an important issue in WSNs, since many applications depend on knowing the locations of sensor nodes.

Most of the existing range-free algorithms use different heuristic-based or mathematical techniques to increase the positioning accuracy and furthermore the positioning accuracy is relatively low. Localization in WSNs is an optimization problem, whose aim is to minimize the total estimation error of localization problem in WSN. In recent years, there have been several optimization based localization algorithms. In this paper, we combined the optimization method to solve WSN localization problem, and proposed an improved DV-Hop algorithm based on GA for locating the unknown nodes. This proposed GADV-Hop algorithm restrains the feasible region of initial population and improves the quality of initial population. By using the restrained population feasible region, the GADV-Hop algorithm can locate the unknown nodes more accurately and can achieve a much faster convergence.

The simulation results show that our proposed method can improve location accuracy than the original DV-Hop algorithm and a GA-based method proposed in Li and Zhou (2011) without any additional hardware support.

Acknowledgments

The author would like to express gratitude to all those who have helped her during the writing of this paper. She deeply appreciates the contribution to this paper made in various ways by her friends and classmates.

References

  1. Akyildiz IF, Su W, Sankarasubramaniam Y, Cayirci E. Wireless sensor networks: a survey. Comput Netw. 2002;38:393–422. doi: 10.1016/S1389-1286(01)00302-4. [DOI] [Google Scholar]
  2. Bulusu N, Heidemann J, Estrin D. GPS-less low cost outdoor localization for very small devices. IEEE Pers Commun Mag. 2000;7(5):28–34. doi: 10.1109/98.878533. [DOI] [Google Scholar]
  3. Doherty L, Pister K, Ghaoui LE (2001) Convex position estimation in wireless sensor networks. In: Proceedings of the IEEE INFOCOM, Anchorage, pp 1478–1521
  4. Forrest S, Mitchell M. Relative building-block fitness and the building-block hypothesis. In: Whitley LD, editor. Foundations of genetic algorithms 2. San Mateo: Morgan Kauffman; 1993. [Google Scholar]
  5. Gao Y, Zhuang Y, Ni T, Yin K, Xue T (2010) An improved genetic algorithm for wireless sensor networks localization. In: Proceedings of IEEE fifth international conference on bio-inspired computing: theories and applications (BIC-TA), pp 439–443
  6. Girod L, Estrin D. Robust range estimation using acoustic and multimodal sensing. Proc IEEE/RSJ Int Conf Intell Robots Syst. 2001;3:1312–1320. [Google Scholar]
  7. Girod L, Bychovskiy V, Elson J, et al (2002) Locating tiny sensors in time and space. In: Proceedings of the IEEE international conference on computer design: VLSI in computers and Processors, pp 214–219
  8. Goldberg DE. Genetic algorithms in search, optimization and machine learning. Reading: Addison Wesley; 1989. [Google Scholar]
  9. Gu MS, Yan YS, You L, Zuo Z. An improvement of localization algorithm based on particle swarm optimization and simulated, annealing in wireless sensor networks. J Inf Comput Sci. 2013;10(5):1497–1505. doi: 10.12733/jics20101585. [DOI] [Google Scholar]
  10. He T, Huang C, Blum B, Stankovic J, Abdelzaher T (2003) Range-free localization schemes in large scale sensor networks. In: Proceedings of the 9th annual international conference on mobile computing and networking (MobiCom), pp 81–95
  11. Holland JH. Adaptation in natural and artificial systems. Ann Arbor: The University of Michigan Press; 1975. [Google Scholar]
  12. Kazarlis SA, Bakirtzis AG, Petridis V. A genetic algorithm solution to the unit commitment problem. IEEE Trans Power Syst. 1996;11(1):83–92. doi: 10.1109/59.485989. [DOI] [PubMed] [Google Scholar]
  13. Li WW, Zhou WN (2011) Genetic algorithm-base localization algorithm for wireless sensor networks. In: Proceedings of seventh international conference on natural computation. IEEE, pp 2096–2099
  14. Liu DS. Improved genetic algorithm based on simulated annealing and quantum computing strategy for mining association rules. J Softw. 2010;5(11):1243–1249. doi: 10.4304/jsw.5.11.1243-1249. [DOI] [Google Scholar]
  15. Nagpal R (1999) Organizing a global coordinate system from local information on an amorphous computer, A.I. Memo1666, MIT A.I. Laboratory
  16. Nan GF, Li MQ, Li J (2007) Estimation of node localization with a real-code genetic algorithm in WSNs. In: Proceedings of the sixth international conference on machine learning and cybernetics, vol 2. IEEE, pp 873–878
  17. Nicolescu D, Nath B. DV based positioning in ad hoc networks. J Telecommun Syst. 2003;22(1–4):267–280. doi: 10.1023/A:1023403323460. [DOI] [Google Scholar]
  18. Nicolescu D, Nath B (2001) Ad-hoc positioning system. In: Global telecommunications conference (GlobeCom). IEEE, vol 5, pp 2926–2931
  19. Niculescu D, Nath B (2003) Ad-hoc position systems (APS) using AOA. In: Proceedings of 22nd annual joint conference of the IEEE computer and communication societies ( INFOCOM’ 2003), 3
  20. Parkinson BW, Spilker J (1996) Global positioning system: theory and applications. In: Progress in Aeronautics and Astronautics, 793. American Institute of Aeronautics and Astronautics
  21. Savvides A, Han CC, Srivastava MB (2001) Dynamic fine-grained localization in ad-hoc networks of sensors. In: Proceeding of 7th annual intemational conference on mobile computing and networking, pp 166–199

Articles from Cognitive Neurodynamics are provided here courtesy of Springer Science+Business Media B.V.

RESOURCES