Abstract
Accurate and quick localization of randomly deployed nodes is required by many applications in wireless sensor networks and always formulated as a multidimensional optimization problem. Particle swarm optimization (PSO) is feasible for the localization problem because of its quick convergence and moderate demand for computing resources. This paper proposes a distributed two-phase PSO algorithm to solve the flip ambiguity problem, and improve the efficiency and precision. In this work, the initial search space is defined by bounding box method and a refinement phase is put forward to correct the error due to flip ambiguity. Moreover, the unknown nodes which only have two references or three near-collinear references are tried to be localized in our research. Simulation results indicate that the proposed distributed localization algorithm is superior to the previous algorithms.
1. Introduction
Networks of distributed autonomous nodes that can sense their environment cooperatively are called wireless sensor networks (WSNs) which have great potential for diverse applications in scenarios such as hazardous environment exploration, military target tracking and surveillance, health monitoring, and home automation. In most of these applications, location information of sensor nodes which supports many other network services is critically important.
So far, a wide variety of localization methods have been proposed according to diverse application requirements which can be roughly divided into two types: range-based and range-free. The range-free algorithms mainly use the connectivity between sensor nodes to estimate the locations of unknown nodes without any ranging techniques. The range-based algorithms use some ranging techniques [1] such as Time of Arrival (TOA), Angle of Arrival (AOA), Time Difference of Arrival (TDOA), and Radio Signal Strength (RSS) to measure the distances or angles between unknown nodes and their neighbouring anchor nodes and formulate the localization problem as a multidimensional optimization problem after the ranging information is measured. At the same time, it provides more accurate localization results than range-free algorithms. Compared with the classical optimization methods, bioinspired optimization algorithms such as simulated annealing algorithm (SAA), genetic algorithm (GA), and particle swarm optimization (PSO) solve the localization problem though population-based techniques. They are easier to implement, have faster convergence, and require less computing resources. Hereinto, PSO is an evolutionary computation method based on swarm intelligence without using evolution operators such as crossover and mutation. It is an efficient global optimization algorithm with the advantages of simple operation and avoiding local minima. A lot of literatures apply bioinspired algorithms to implement nodes localization in WSN.
A simulated annealing based localization algorithm in wireless sensor network is proposed in [2] which uses lots of anchor nodes to localize all unknown nodes. The accuracy of this approach is not as good as the PSO algorithm in [3] according to the performance evaluation. A two-phase localization algorithm for WSN presented in [4, 5] is centralized and not feasible for large-scale sensor networks. The localization algorithm which uses a combination of SAA and GA proposed in [4] solves the flip ambiguity problem. An iterative PSO-based algorithm proposed in [6–8] localizes the unknown nodes with three or more neighboring anchors. A new objective function is presented in [9] to evaluate the fitness of particles based on the probabilistic distribution of ranging error. Literature [10] extends the node localization problem to three-dimensional space.
In this paper, we propose a distributed localization algorithm based on PSO which can also extend to large-scale sensor networks. The main contributions of this paper have the following two aspects. (1) It reduces the initial search space by bounding box method to speed up the convergence. (2) It proposes a distributed two-phase PSO algorithm to solve the flip ambiguity problem and localize more target nodes.
The rest of this paper is organized as follows. Section 2 overviews the theory and application of PSO algorithm. Section 3 introduces our improved PSO algorithm for distributed localization in WSNs. Simulation and analysis are presented in Section 4. Section 5 concludes this paper and look forward to the future work in the end.
2. Particle Swarm Optimization Algorithm
2.1. The Theory of PSO Algorithm
Particle swarm optimization (PSO) is a popular bioinspired stochastic global search algorithm proposed by Kennedy and Eberhart [11] that models social behavior of a flock of birds. In this algorithm, all individuals in a population are seen as particles in a multidimensional solution space. First of all, randomly initialize a group of particles in a population. Each of them is a feasible solution and its fitness value is determined by its position in the search space. Each particle moves in the solution space towards the randomly weighted average of the historical personal best position and the historical global best position and finds the current global solution.
Assume that, in an n-dimension objective search space, the population consists of s particles. The position and velocity of the particle i are
PSO algorithm for minimize the objective function f(⋅) (1) Initialize ω, (2) Initialize the maximum number of iteration (3) Initialize the target fitness F (4) Initialize gbest: (5) for each particle i do (6) for each dimension d do (7) Initialize (8) Initialize (9) (10) end for (11) if (12) for each dimension d do (13) (14) end for (15) end if (16) end for (17) Initialize (18) while ( (19) for each particle i do (20) for each dimension d do (21) if (22) (23) elseif (24) (25) end if (26) if (27) (28) elseif (29) (30) end if (31) end for (32) if (33) for each dimension d do (34) (35) end for (36) end if (37) if (38) for each dimension d do (39) (40) end for (41) end if (42) end for (43) (44) end while
2.2. The Application of PSO in WSN Localization
PSO is a kind of optimization algorithm which belongs to range-based methods. That means it needs to measure the distance between the sensor nodes with known locations called beacons and the other sensor nodes which need to be localized, named target nodes. We consider the whole sensor network and sensor nodes as a two-dimensional coordinate system and coordinate points, respectively. Let (x, y) be the coordinate of a target node T, (
The main problem in the process is the flip ambiguity due to near-collinear beacons which have been solved very well in the next section. Moreover, the calculation time has been decreased by reducing the initial search space on the premise of guarantee accuracy.
3. An Improved PSO Algorithm
In this section, a range-based distributed localization algorithm for wireless sensor networks is described. Differences between classical PSO algorithm and our proposed algorithm are reflected in the following four points.
3.1. Define the Initial Search Space by Bounding Box Method
The classical PSO algorithm employs a set of feasible solutions within the search space, called a swarm of particles with random initial locations. In our proposed algorithm, we reduced the initial search space by using a bounding box method.
To facilitate understanding, an example is described in Figure 1. Node n is an unknown node with three beacons or settled nodes

Sketch map of bounding box method.
3.2. Anticipation of Nearly Collinear References
An example of flip ambiguity phenomenon is showed in Figure 2. Node A is located by using references B, C, D, and E which are almost collinear and it is possible to estimate A as its flipped location

Flip ambiguity phenomenon.
The more the references are, the less the probability of flip ambiguity occurrence is. Therefore, when the number of references is small, we should have anticipation about whether these references are near-collinear by using the following rules.
If there are only three references, any two of them should not be too close to each other. When the distance between any two references is less than a predefined threshold, these references are judged to be near-collinear. Calculate the distance from any one reference to the straight line which is determined by any two of the rest references. When the value is less than a predefined threshold, these references are judged to be near-collinear.
The above rules can be used in combination to prevent the occurrence of flip ambiguity. When the references of a target node are judged to be near-collinear, the target node will not be localized in this iteration. In the following iteration, the target node may have more references and will be localized until its new references are judged to be non-near-collinear.
3.3. A Refinement Phase to Correct the Error due to Flip Ambiguity
The refinement phase is to relocalize those nodes which still have flip ambiguity problem after the anticipation phase. To inspect whether the flip ambiguity happened, we analyze the relationship between the settled node and its nonneighbor nodes. As seen in Figure 2, if node A is localized in the wrong location
3.4. Localize the Target Nodes That Only Have Two References or Three Near-Collinear References
After those target nodes which have at least three non-near-collinear references are all localized, the remaining ones that only have two references or three near-collinear references can be localized by using the refinement phase at last.
3.5. Algorithm Steps
The main purpose of WSN node localization is to estimate the positions of N target nodes as much as possible by using M beacons with known locations in a distributed range-based way. The process of our proposed approach is as follows.
N target nodes and M beacons are randomly deployed in a two-dimensional sensor field. The transmission radii of target nodes and beacons are both r. Beacons possess location awareness and transmit their coordinates frequently. The target nodes that get settled at the end of iteration serve as beacons during the next iteration. The target node that falls within the transmission range of three or more non-near-collinear references is considered as a localizable node. The measured distance from a localizable node to each of its neighboring references is simulated as the actual distance plus a Gaussian additive white noise which can be expressed as Each localizable node runs the improved PSO algorithm to localize itself by finding the coordinates (x, y) that minimize the value of the objective function (2). In the refinement phase, some of the nodes localized in the previous step should be relocalized by adding an extra term (3) to the objective function (2) owing to their estimated position falls into the wrong neighborhood. Above steps are repeated until either all target nodes are settled or no more nodes can be localized. After those target nodes which have at least three non-near-collinear references are all localized, the remaining ones that only have two references or three near-collinear references can be localized by using the refinement phase at last. The total localization error
4. Simulation and Analysis
4.1. Compared with the Classical PSO Algorithm
Simulation was carried out in MATLAB environment.
The parameters of the proposed node localization algorithm are set as follows:
population = 30, iterations = 150; acceleration constants inertia weight ω is decreased linearly from limits on particle positions:
In order to show the advantage of our algorithm more intuitively, we made some contrast figures to analyze each step independently as follows.
Firstly, we use methods described in Sections 3.2 and 3.3 to avoid the flip ambiguity phenomenon. An example in a trial shows the different localization results between the experiments with and without methods 3.2 and 3.3.
As shown in Figure 3 (the red circle represents the location of beacon node, the blue circle represents the location of target node, the blue asterisk represents the location estimated by the PSO algorithm, and the blue straight line represents the localization error, that is, the distance between the actual node location and the estimated location), flip ambiguity phenomenon leads to large localization errors. To avoid such problems, we use methods described in Sections 3.2 and 3.3 to reposition. As a result, large localization errors have been corrected in Figure 4.

Result with flip ambiguity phenomenon.

Result without flip ambiguity phenomenon.
Figure 5 directly shows the difference from a purely numerical perspective. The blue curve and red curve which represent the variation tendency of the localization error defined as

Localization error
Secondly, we reduced the initial search space by using a bounding box method which is described in 3.1. 30 trial experiments are conducted for

Computing time for
Finally, in our algorithm, we localize the target nodes that only have two references or three near-collinear references by using the refinement phase at last which is described in 3.4. 30 trial experiments are conducted for

Localizable nodes percentage for
4.2. Compared with the HPSO Algorithm
The HPSO method [8] divides the whole swarm into subswarms and the particle with the best fitness in the local swarm is termed as population = 50, iterations = 150; acceleration constants inertia weight population = 50, iterations = 150; acceleration constants inertia weight ω is decreased linearly from
The parameters of our proposed node localization algorithm are set as follows:
In order to compare the three different algorithms, ten trial experiments for each algorithm are conducted in the MATLAB environment.

Localization error

Computing time t with number of beacons M.
Average of localization error and computing time for

Localization error

Computing time t with percentage noise
5. Conclusion and Future Work
In this paper, an improved PSO algorithm is proposed to solve the distributed localization problem in WSN, which can be regarded as a multidimensional optimization problem. To improve the localization precision and algorithm efficiency, we present some methods in Section 3 whose effectiveness has been proved by the simulation results. In order to show the advantage of our algorithm more intuitively, we made some contrast figures to analyze each method independently. The experimental results show that our method which can localize more unknown nodes with higher precision in less computing time is superior to the other two methods.
Further, the control of iterative error propagation and energy consumption are potential and significant directions. In this paper, we considered the nodes localization problem in two-dimensional space. However, in real environment, sensor nodes are distributed in three-dimensional space. Some research will be taken on our proposed algorithm in three-dimensional space. Moreover, the proposed algorithm may be extended for nodes localization in mobile wireless sensor network. The effectiveness of these planning works will be validated in experiments in the future.
Footnotes
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
Acknowledgments
This work is supported by National Natural Science Foundation of China (nos. 61472278, 60872064, and 61102125) and the Natural Science Foundation of Tianjin (no. 12JCYBJC10200).
