Abstract

Due to uneven deployment of anchor nodes in large-scale wireless sensor networks, localization performance is seriously affected by two problems. The first is that some unknown nodes lack enough noncollinear neighbouring anchors to localize themselves accurately. The second is that some unknown nodes have many neighbouring anchors to bring great computing burden during localization. This paper proposes a localization algorithm which combined niching particle swarm optimization and reliable reference node selection in order to solve these problems. For the first problem, the proposed algorithm selects the most reliable neighbouring localized nodes as the reference in localization and using niching idea to cope with localization ambiguity problem resulting from collinear anchors. For the second problem, the algorithm utilizes three criteria to choose a minimum set of reliable neighbouring anchors to localize an unknown node. Three criteria are given to choose reliable neighbouring anchors or localized nodes when localizing an unknown node, including distance, angle, and localization precision. The proposed algorithm has been compared with some existing range-based and distributed algorithms, and the results show that the proposed algorithm achieves higher localization accuracy with less time complexity than the current PSO-based localization algorithms and performs well for wireless sensor networks with coverage holes.

1. Introduction

Recently, wireless sensor networks (WSNs) have been applied in various applications, where the sensor nodes’ location information helps us to understand the sensed data in spatial context, and it is also useful for the other protocols including coverage, deployment, and routing [1, 2]. However, sensor nodes are usually randomly deployed by a vehicle robot or aircraft, so they have no prior knowledge of their locations. A simple solution is to equip each sensor node with a global positioning system (GPS) device, but the weakness of high cost and energy consumption makes it is infeasible for large-scale deployment. Therefore, the determination of sensor nodes’ positions, which is referred to as localization, is one of key technologies of WSNs.

The development of microelectronic, wireless communication leads to applications of large-scale WSNs containing hundreds even thousands of sensor nodes deployed in a prohibitively large region. For example, CitySee [3] project deployed 1,200 sensor nodes in an urban area, and LAINet [4] is deployed in a whole forest. Because distributed localization approach allows each sensor node to estimate its own location without any central control or computation unit, which alleviates large communication overhead, so they are more suitable for localization of large-scale WSNs than centralized methods. Further, because many applications require absolute positions such as longitude and latitude, the localization algorithm should be anchors based [5, 6], where anchors are the sensor nodes knowing their global positions, and the rest sensor nodes, referred to as unknown nodes, are localized based on beacon messages broadcasted by anchors. The localization procedure is often iterative because anchors are significantly less than unknown nodes, so some unknown nodes are localized by their neighbour localized unknown nodes instead of anchors. Both the anchors and localized unknown nodes are referred to as reference nodes in this paper.

Due to random deployment of WSNs, the anchors are not evenly distributed, so localization performance is seriously affected by two problems. The first is that some unknown nodes lack enough noncollinear neighbouring anchors to localize themselves accurately. The second is that some unknown nodes have many neighbouring anchors to bring great computing burden during localization. This paper proposes an algorithm combining niching particle swarm optimization (PSO) and reliable references selection to conquer the above problems, in order to localize as many unknown nodes as possible with high localization precision. The main contributions contain the following:(i)It proposes a reliable reference node selection approach based on localization precision, distance to unknown node, and degree of collinearity among reference nodes, in order to obtain a minimum and sufficient set of the best neighbouring references to localize an unknown node.(ii)It presents a niching PSO algorithm to localize an unknown node and selects the best parameters and stop criteria of PSO according to localization precision and number of iterations, in order to conquer ambiguous localization and improve localization precision.(iii)It presents localization algorithms for unknown nodes with less than three neighbour reference nodes, in order to localize as many unknown nodes as possible while guaranteeing localization precision.

The organizations of the rest of this paper are as follows. Section 2 briefly reviews existing localization algorithms for WSNs. Section 3 introduces localization problem and PSO algorithm and presents basic idea of the proposed algorithm. Sections 4, 5, and 6 propose details of our localization algorithm, namely, reliable reference node selection, niching PSO-based localization, and localization algorithms for unknown nodes with less than three neighbour reference nodes. Section 7 analyses time and communication complexities of the proposed algorithm in theory and compares the proposed algorithm with the other algorithms by simulations. The conclusion and future works are given in Section 8.

Lots of localization algorithms have been developed, and most of them consist of two stages: measurement of geographical information between sensor nodes and estimation of positions of unknown nodes. According to different geographical information used in localization, these algorithms can be classified into range-free and range-based.

Typical range-free algorithms include centroid, MDS (Multidimensional Scaling), and DV-hop (Distance-Vector hop). Centroid uses the centroid [7] or weighted centroid [8] of positions of neighbour reference nodes as position estimation of an unknown node. These methods rely heavily on number of anchors, and their localization errors are large [9]. MDS [10] computes all pair-wise shortest path between sensor nodes and then applies MDS to get an initial map. Centralized computation is used to estimate positions of sensor nodes, which imposes heavy communication burden on WSNs. MDS can also be applied by each sensor nodes itself in a distributed scheme [11], but the distributed version requires a procedure of local maps combination to determine the entire layout, which increases complexity and is impossible to complete combination if there are many disjoint patches in a given WSN [10]. DV-hop [12] consists of two message flooding phases to determine average hop length between two anchors, and an unknown node estimates its position by trilateration when it receives at least three anchor messages. There is much room to improve localization accuracy of DV-hop, and many enhancements have been proposed, such as checkout DV-hop [13], selective 3-anchor DV-hop [13], DV-hop algorithm based on locally weighted linear regression [14], etc., but they also need flood messages through WSNs. Both MDS and DV-hop are based on the shortest path between sensor nodes, but this path is often zigzag especially in WSNs with coverage holes. To cope with this problem, new methods are utilized to estimate distances between sensor nodes in two-stage centralized range-free localization algorithm [9] and connectivity-based anchor-free three-dimensional localization algorithm [15], but they still need message flooding. Hence, range-free algorithms consume a considerable amount of power when they are applied to large-scale WSNs. Moreover, these algorithms perform satisfactorily when the network has a relatively even node distribution, but their performance is poor for the network of nonuniform node distribution [15].

Range-based algorithms need equip additional hardware to measure distance or angle. The popular ranging techniques include RSS (Received Signal Strength), ToA (Time of Arrival), TDoA (Time Difference of Arrival), and AoA (Angle of Arrival) [16]. After obtaining range information between an unknown node and its neighbour reference nodes, equations about the location of this unknown node can be gained, and they can be solved by an optimization method, such as maximum likelihood [17], least-square calibration [18], second-order cone programming [19], etc. Because evolutionary algorithms require less computational efforts than traditional optimization algorithms, which are more suitable for implementation on individual sensor node [20], they have been pervasively applied to localization problems, such as artificial neural network [21], genetic algorithm [22], and fuzzy logic and extreme learning machines [23].

PSO algorithm performs better in terms of localization accuracy, computational complexity and/or convergence speed compared with the other optimization methods [2430]. PSO and BFA (Bacterial Foraging Algorithm) are applied to localize a WSN deployed by an unmanned aerial vehicle in [24], and simulation results showed that PSO is faster than BFA. The proposed method in [25] divides unknown nodes into two modes: sensor nodes with at least three neighbour reference nodes and sensor nodes with less than three neighbour reference nodes. For an unknown node of the second mode, it utilizes a similar DV-Distance [12] approach to estimate the distance to a multihop anchor and then applies PSO to localize. Gauss-Newton algorithm (GNA) and PSO are applied to localize the sparse WSNs in [26], and simulation results showed that PSO outperforms GNA with large pedometer error. H-best PSO (HPSO) proposed by [27] divides the swarm of particle into several subswarms, and each particle updates according to global and local best fitness. The hybrid PSO proposed in [28] replaces positions of a half of particles with positions close to the best particle, leading to faster convergence than standard PSO. The fuzzy-extreme learning machine with PSO [29] uses resultant force to move approximate node location closer to actual position. PSO-based improved DV-hop algorithm [30] uses PSO to correct estimated positions after DV-hop.

Generally, localization algorithms utilize all neighbour reference nodes to estimate location of an unknown node, which may lead to high localization error, so a reliable anchor selection process is needed. The methods proposed in [31] select three anchors based on minimal hop counts to an unknown node. The selective 3-anchor DV-hop algorithm [13] selects any three noncollinear anchors to form a 3-anchor group and correspondingly generates a 3-anchor estimated position. Reliable anchor pair selection method [32] selects reliable anchor pairs by observing their average hop progresses and estimates the distances to the reliable anchors by geometric approximation of the node. These methods are DV-based, so they are not feasible for range-based localization algorithms. A concept of confidence value is introduced in [33] to alleviate error propagation effect in localization of underwater WSNs, and this value is defined as a decreasing function of localization error, but it does not consider other factors, such as collinearity of anchors and distances to unknown node.

3. Background and Basic Idea of Proposed Localization Algorithm

3.1. Localization Problem Statement

Definition 1 (anchors). The sensor nodes whose positions are known before localization are called anchors. The set of anchors of a WSN is denoted by , where is the number of anchors. The position of anchor is denoted by .

Definition 2 (unknown nodes, actual position). The sensor nodes that need to be located by a certain localization algorithm are called unknown nodes. The set of unknown nodes of a WSN is denoted by , where is the number of unknown nodes. The actual positions of is denoted by , which is not known in real application.

Definition 3 (neighbour). Let be the radius of communication range of sensor nodes. Given two sensor nodes and , if is located in the radio range of , is referred to as a neighbour of . Because all sensor nodes have the same communication range, is also a neighbour of .

Definition 4 ((range-based) localization). Give a WSN consists of sensor nodes, including anchors and unknown nodes, the distances between any pair of neighbour nodes can be measured. The (range-based) localization problem is to localize the unknown nodes using the positions of anchors and distances between neighbour nodes.

Definition 5 (estimated position). If an unknown node is localized during localization, it will get an estimated position, and it becomes a localized unknown node. The estimated position of is denoted by .
Obviously, the purpose of localization is to make for .

Definition 6 (reference nodes). During localization, both anchors and localized unknown nodes are called reference nodes. The set of reference nodes is denoted by . The position of reference node is denoted by . Obviously, if is anchor , ; if is localized unknown nodes , .

Definition 7 (actual distance, measured distance, and estimated distance). An unknown node and a reference node have three types of distances:(i)Actual distance: distance between the actual positions of and . It is denoted by .(ii)Measured distance: distance measured by a certain technique. It is denoted by . Because any measurement technique has error to some extent, we assume , where is a Gaussian distribution.(iii)Estimated distance: distance between the estimated position of and . It is denoted by .Figure 1 shows an example of these types of distances between and .
Suppose unknown node has neighbour reference nodes , we can solve the following equations to get :where is unknown quantity to solve and is position of . Due to the distance measurement error , , i.e., we cannot get the actual position of in general case. Using estimated position , the estimated distance isSince the actual distance is not known, the objective of localization is to minimize the difference between and . Therefore, the problem of localizing is formulated aswhere , which gives more influence to those reference nodes nearer to , represents the degree of irregularity of the communication range of sensor nodes, and is the side length of the deployment region of WSN. In real applications, the communication range of sensor nodes is not a perfect circle due to multipath fading, unstable signal propagation, and noise, so is introduced in (3). Given , the communication range of a sensor node varies randomly in different directions between an upper bound and a lower bound [34].
The first constraint guarantees the solution locates within the communication range of all neighbouring reference nodes, and the second constraint guarantees the solution locates within the deployment region. The third constraint denotes has neighbour reference nodes.
Due to the distance measurement error , in (3) is often a multimodal function, so we have to use optimization algorithm to solve it. It has been proved that PSO can solve this problem well in related references; this paper tries to improve its performance further.

Definition 8 (localization error). The distance between the actual and estimated positions of is called its localization error, which is denoted by . Obviously, Localization error is an important criterion to evaluate a localization algorithm.

3.2. Particle Swarm Optimization Algorithm

PSO is a popular multidimensional optimization algorithm, which models the behaviour of a flock of birds searching for corn [35]. In PSO, a swarm of particles explores in a D-dimensional hyperspace to search the global solution of an objective/fitness function. Three D-dimensional vectors are used to describe a particle : current location ; the previous location of the best fitness; and current velocity . Besides, denotes the position of the best particle so far. The basic procedure of PSO is shown in Algorithm 1.

 Initialize a swarm of particles in the given search space with random positions and velocities.
while stop criteria are not met do
  Compute the fitness values of all particles.
  Compute for all particles, and .
  Update particle according to the following formula:
,
end while

In , and are, respectively, cognitive and social acceleration coefficients, and are random numbers uniformly distributed in (0,1), and is inertia weight defined aswhere is maximum number of allowable iterations and and are, respectively, maximum and minimum weight. Further, velocities are bounded within to prevent particles from exceeding the search space. The stop criteria in line 2 used in existing PSO-based localization algorithms arewhere is the acceptable minimal (also the optimal) value of .

Most of the existing PSO-based localization algorithms are based on the above PSO version, and we call it standard PSO (SPSO). This paper also investigates CPSO (PSO with constriction coefficient) [36], which applies constriction coefficient to prevent explosion, ensure convergence, and eliminate the arbitrary parameter. The update formula of CPSO iswhere , .

3.3. Basic Idea of Proposed Localization Algorithm

The localization procedure is distributed and iterative. The anchors broadcast beacon messages, including its identifier, coordinate, and information to measure distance, to its neighbour sensor nodes, and the unknown nodes receiving at least three beacon messages are localized. These localized unknown nodes become new reference nodes to provide beacon messages to their neighbours. This procedure is repeated until none of unlocalized unknown nodes can receive at least three beacon messages. If some unknown nodes are not localized yet, they request beacon messages of reference nodes in two and three hops to assist their localization. Therefore, an unknown node may appear as one of the following modes during localization:(i)Mode 1: it has at least three neighbour anchors.(ii)Mode 2: it has less than three neighbour anchors, but it has at least three neighbour reference nodes.(iii)Mode 3: it has less than three neighbour reference nodes.

The unknown node of Mode 1 and Mode 2 selects reliable reference nodes before estimating its location by niching PSO algorithm, and the unknown node of Mode 3 needs special localization algorithm. These algorithms are presented in the next three sections.

4. Reliable Reference Node Selection

Reliability of a reference node is based on its localization error and distance to an unknown node. Localization error cannot be computed in real applications due to the absence of actual positions of unknown nodes, but the sequence of iterative localization and of PSO-based localization algorithm represent localization error to a great extent. Therefore, the reliability of reference node to localize an unknown node is defined aswhere , , and are, respectively, the sequence of iterative localization of , measured distance between and , and fitness of . , , and are weights of different parts of . is defined aswhere is a reference node to localize . is defined aswhere is the estimated location of to localize .

Further, of is a normalization function to map variable to , which is defined as

Note that and are derived from the corresponding variables (i.e., , , or ) of all neighbour reference nodes of , instead of all reference nodes of whole WSN. Moreover, according to the definition of each variable.

Reference node with the largest is chosen as the first reliable one. If there are several reference nodes have the same , each of them can be selected as the first reliable reference node. The second one is chosen based on the following value:

The reason of removing the second part of is illustrated in Figure 2(a). Suppose has 6 neighbour reference nodes , and and are shown in Table 1. is chosen as the first one. If we still use to select the second one, is the best choice. Whichever reference node we choose as the third one, the triangle formed by these chosen reference nodes will be too narrow and long to judge whether they are collinear or not.

Reference node with the largest is chosen as the second, so is chosen in Figure 2. If several reference nodes have the same , the farthest to the first chosen reference node is selected. After selecting two reference nodes, the rest reliable reference nodes are chosen based on and degree of collinearity among reference nodes. Any three reference nodes can form a triangle, and we utilize the minimal internal angle of this triangle to measure degree of collinearity of these reference nodes. If is smaller than a predefined threshold , the observed reference node is nonreliable. As shown in Figure 2(b), cannot be chosen after and if , although of is the second largest. is chosen as the third one. This process is repeated until all neighbour reference nodes of are investigated.

The detailed selection algorithm is presented in Algorithm 2. This algorithm takes the set of all neighbour reference node of an unknown node as input and returns the set of reliable reference nodes . Lines 1 and 2 choose the first reliable reference node , and lines 3-5 choose the second one . Line 9 removes reference nodes being collinear with current set of reliable reference nodes . Line 10 computes . Line 12 appends reference nodes with into . Note that may contain only two reference nodes according to this algorithm. If so, is localized by Algorithm 4 with and as inputs.

Input: unknown node and its neighbour references set ,
Output: selected reference nodes set
 Compute   for all
 Compute for all  
,  
while   do
  
  if   is not collinear with any two elements of   then
  
  if    then
    
  end if
  end if
  
end while
return

5. Niching PSO-Based Localization Algorithm

5.1. Choice of Stop Criteria of PSO

The stop criteria of PSO determine number of iterations and consequently determine time complexity of localization algorithm. There are three types of stop criteria: a prespecified maximum number of iterations, achievement of a specified acceptable solution, and lack of change in a certain successive iteration [35]. The existing PSO-based localization methods utilize , which is the combination of the first two criteria.

Obviously, if , so , then is feasible. However, in real applications, and it is difficult to give a feasible . If we observe the curves of , as shown in Figure 3 taking three test cases as examples, we can find that drops significantly before the first 100 iterations, and it keeps the same during the last 300 iterations. We also perform simulations with 1,200 different test cases using PSO-based localization algorithm and count the maximum number of iterations of the same continuous . The results are illustrated in Figure 4. There are more than 99.08% test cases keeping the same during 200 continuous iterations. On the contrary, the first iteration to achieve the final does not obey any rule, as shown in Figure 5.

Therefore, if is very large, it may waste many iterations when the same repeats continuously; but if is small, it may not achieve the best fitness. We adopt the combination of above-mentioned three stop criteria instead of , as shown in Algorithm 3.

Input: unknown node and the set of selected neighbour references
Output: estimated position of
 Initialize the search space , and divide into disjoint parts
 Evaluate the distances of to each
 Generate a group of particles in each region
 Evaluate the fitness values of all particles
 Evaluate   of all particles, and   of particles group
, ,
,
for    to    do
  for    to    do
   if    then
    Update particles of group
    Re-evaluate the fitness of these particles
    Update and
    if  then
     return  
    else  if    then
     
    else
     
    end if
    if    then
     
    end if
   end if
   end for
   if    then
    return  
   end if
  end for
  return  
Input: unknown node and its neighbour references
Output: estimated position of if can be localized
measured distances of to
positions of
roots of
if    then
  return  
else
  
   if   =   then
   return    cannot be localized
   end  if
   
  if    then
   return  
   else
   
   if    then
    
   else
    
   end if
   solution of Algorithm 3 using as inputs
   return  
  end if
end if
5.2. Niching PSO-Based Localization Algorithm

We investigate the unknown node with low localization accuracy and find that these sensor nodes are often localized at the symmetric positions of their true coordinates, which is referred to as flexible ambiguity in rigid theory [37]. Although localization algorithms based on rigid theory can cope with this problem, they need identify global-rigid patches [38, 39]. In this paper, niching technique is utilized to cope with this problem. Niching is an important technique for multimodal optimization, and lots of existing niching PSO algorithms require a niching parameter based on Euclidean distance or topology among particles [40, 41], where each particle still searches for the optima in entire space.

In the proposed algorithm, particles are divided into several subswarms, and each group searches for different subregions of the whole search space of PSO. The final result is the best particle of all subswarms. Because the reference nodes chosen by Algorithm 2 are noncollinear, this method can achieve a unique and best estimation. Moreover, the particles are constricted in a fixed subregion, so it does not need a niching parameter based on the calculation of Euclidean distance. The detailed localization algorithm is shown in Algorithm 3.

In Algorithm 3, the radio range of sensor nodes is represented by its circumscribed square. For an anchor, the side length of the square is . For a localized unknown node, the side length is , because the localization error of unknown node is less than , according to simulation results of Section 7.4. In first, the algorithm generates search space of particles based on the following method (line 1):(i) Case 1. If has at least two neighbour references and , is defined as

where and are, respectively, coordinates of the top left and bottom right corners of , if , otherwise .(ii) Case 2, If has only one neighbour reference node , is the circumscribed square of the communication range of .

is divided into equal and disjoint subregions further. The distance of to is evaluated in line 2. It is calculated as follows:(i) Case 1. If is a neighbour reference node, .(ii) Case 2. If is selected by line 17 in Algorithm 4, the distance is

where ( is measured distance between and ( and () is estimated distance from ( to .(iii) Case 3. If is selected by line 19 in Algorithm 4, the distance is(iv) Case 4. If is or generated by line 8 or 10 in Algorithm 5, the distance is(v) Case 5. If is obtained by line 15 in Algorithm 5, the distance is

Input: unknown node and its neighbour reference
Output: estimated position of if can be localized
measured distances of to
positions of
if    then
  return   cannot be localized
end if
if    then
  
else
  
  
  if    then
   return    cannot be localized
  end if
  
end if
return   solution of Algorithm 3 using as inputs

Lines 3-7 generate a group of particles in each search region and initialize some variables. is the local best position of particle group , records the number of successive iterations with same , and decides whether particle group continues to update or not. Lines 8-29 are main iteration process of niching PSO. There are four thresholds:(i) judges the difference between current and previous .(ii) and decide the maximum repeated times of the same , and .(iii) determines the degree of acceptance of . For particle group , if an unacceptable repeats more than times, or a nearly acceptable repeats more than times, the particles of this group will stop evolution.

This algorithm returns results under one of the following conditions:(i)It reaches the maximum number of iterations (line 8).(ii)One group of particles achieves an acceptable fitness (line 15).(iii)All groups of particles stop updating (line 26).

6. Localization of Unknown Nodes of Mode 3

The unknown node belonging to Mode 3 is localized in a way similar to DV-Distance [12] in [21], which utilizes multihop anchors to avoid error accumulation. However, if the multihop anchor is far from the unknown node to be localized, the estimated distance between them is highly unreliable [42]. Therefore, the reference nodes chosen to localize an unknown node should be as near as possible.

6.1. Localization of Unknown Node with Two Neighbour References

Unknown node with only two neighbour reference nodes and is localized by Algorithm 4. After getting positions and measured distances of these two references (lines 1-2), it solves equations in line 3. If there is only one solution, line 5 returns it as a result. Otherwise, line 7 decides its position by two-hop neighbour references . cannot be localized if (line 9). Otherwise, line 11 computes distances between each solutions and each by function and calculates two sums , which is the sum of (see ) of all whose distance to is larger than . Line 13 returns the solution with the largest as a result. If these two sums are the same, line 15 obtains the common neighbours of and . If , line 17 chooses with the largest ; otherwise, line 19 chooses with the largest . Next, line 21 estimates a position using Algorithm 3, and line 22 returns the coordinate which is nearer to than the other as a result.

6.2. Localization of Unknown Node with One Neighbour Reference

If has only one neighbour reference , it is localized by Algorithm 5. The first two lines are similar to those of Algorithm 4. Line 3 obtains two-hop reference nodes . If has at least two members, line 8 selects two of them and which have the largest . If has only one element, line 10 chooses this element as . Line 11 obtains three-hop neighbour reference nodes , and line 15 selects of the largest as . Finally, line 17 computes position of by Algorithm 3 with as inputs. If or is empty, cannot be localized (line 5 and 13).

If an unknown node with less than three neighbour reference nodes cannot be localized by Algorithms 4 and 5, it is abandoned localization because its estimated location is highly unreliable if it utilizes reference nodes in more than three hops to localize itself [38].

7. Performance Analysis and Comparisons

Because our algorithm is range-based, anchor-based, and distributed, we compare it with the algorithms of same type, which are iterative multilateration, DV-Distance [9], SPSO-based localization [21, 22], HPSO [23], and hybrid PSO [24].

7.1. Complexity Analysis

We analyse the time complexity of algorithms in first. Suppose all the input data have the same number of binary digits, then the time complexity can be calculated in terms of times of basic arithmetic operations in an algorithm, such as addition, subtraction, multiplication, and division.

Both multilateration and DV-Distance use standard least-square approach to estimate position of an unknown node. Based on (1), the estimation iswhere

In , matrix needs subtractions and multiplications; matrix needs multiplications, subtractions, and additions.

Equation needs 3 matrix multiplications and 1 matrix inversion. If Algorithm 6 is applied to calculate matrix multiplication, it needs additions and multiplications. Further, matrices and are, respectively, and , so needs additions and multiplications, needs additions and multiplications, and needs additions and multiplications. Suppose and , , so it needs 6 multiplications, 1 division, and 1 subtraction.

Input: two matrices and
Output:
for    to  
  for    to  
   
   for    to  
    
   end for
  end for
end for

In total, and need multiplications, 1 division, additions, and subtractions. Hence, the time complexity of multilateration and DV-Distance is .

The time complexities of PSO algorithms stem from the evaluation of fitness and update of particles. For each iteration, HPSO updates each particle with the local best fitness, global best fitness, and previous individual best fitness, so its complexity is higher than SPSO. Reference [24] has already showed that the complexity of each iteration of hybrid PSO is higher than SPSO. Based on (3), , and , CPSO and SPSO have the same time complexity in each iteration.

Let be the number of particles in CPSO. During each iteration, CPSO uses (3) to calculate the particles’ fitness, which needs divisions and additions to get and extractions of square root, multiplications, subtractions, and additions to get . Equation needs multiplications, additions, and subtractions to update particles. During each iteration of Algorithm 3, it needs 5 comparisons in lines 14, 16, and 21, and it also needs comparisons to get of each particle and of each group of particles (line 13). It also needs comparisons to get . Let be the number of iterations, Algorithm 3 needs divisions, multiplications, additions, subtractions, extractions of square root, and comparisons. Hence, the time complexity of Algorithm 3 is . Generally, , so it is important to decrease .

For multilateration and Algorithm 3, is the number of neighbouring reference nodes, so . DV-Distance uses all anchors to localize each unknown node, so its time complexity . Generally, . Therefore, the time complexity sequence is .

As for communication complexity, multilateration requires each sensor node to broadcast one package, including its positions and information to assist the receiver to measure distance, to its neighbour nodes, so its communication cost is . DV-Distance needs three message flooding stages in whole network, so its communication complexity is . The communication cost of existing PSO-based localization algorithm is the same as multilateration. The proposed localization algorithm needs transmit a few more packages than multilateration, because our algorithm requires unknown nodes localized by Algorithms 4 and 5 to obtain information of two- and three-hop neighbour reference nodes.

7.2. Parameter Selection of PSO Algorithm

The performance of PSO-based localization algorithms is greatly impacted by the PSO’s parameters. Given the possible scopes of these parameters, a comprehensive performance comparison under each combination of parameters is presented in [43]. Table 2 presents the best parameters achieving the optimal performance in [43].

7.3. Choice of in Algorithm 2

In Algorithm 2, decides the degree of collinearity of reference nodes, so we perform simulations to choose a feasible value. As shown in Figure 6, we deploy 3 reference nodes on a circle of radius , and an unknown node at the centre of the circle. and are fixed at , and changes its position in along the blue arc, where is the angle between line and positive direction of axis . The other setups are the same as Section 7.2. The results are shown in Figure 7. We can see that increases as increases from 0 to , and it decreases as decreases from to . Moreover, different generates different varying trends. In the proposed algorithm, we utilize as the threshold to decide the collinearity of anchors.

7.4. Comparison of Different Localization Algorithms

The simulations are performed on MATLAB 2012a, and PSO is implemented in C language. The configurations of WSNs are as follows: is 2000 to 3000 at step of 200, is 0.1 to 0.4 at step of 0.05, is 0 to 0.2 at step of 0.05, is 100 to 200 at step of 20, and is 0 to 0.2 at step of 0.05. Both anchors and unknown nodes are deployed in the given region randomly.

The parameters of SPSO and CPSO are chosen based on Table 2. According to corresponding references, parameters of HPSO are , ; parameters of hybrid PSO are , . CPSO has groups of particles and each group has 10 particles. For Algorithms 2 and 3, to give the same weight for each part of (see ). according to Section 7.3. , according to the analysis in Section 5.1. to make the algorithm iterate as many times as possible. Algorithm 3 utilizes niching CPSO to localize an unknown node.

The average and standard deviation of are, respectively, denoted by and ; and those of are, respectively, denoted by and . Moreover, the number of unknown nodes with is denoted by (NFL represents “number of fail localized unknown nodes”), and the and of these nodes are excluded when analysing and . Simulation results are shown in Table 3, and we can see that(i), , and of DV-Distance are the largest among all localization methods. DV-Distance utilizes all anchors of a WSN to localize each unknown node, and some anchors may be collinear, so matrix of may be singular, which leads to high localization error.(ii) and of SPSO and multilateration are almost the same, but SPSO localizes more unknown nodes than multilateration.(iii)Both HPSO and hybrid PSO outperform SPSO in terms of and , but HPSO needs more iterations than hybrid PSO. On the other hand, of HPSO and hybrid PSO is larger than SPSO. Further, and of hybrid PSO are larger than HPSO, because the replacement strategy of hybrid PSO leads to premature convergence. However, hybrid PSO uses less iterations than HPSO and SPSO.(iv)Niching CPSO performs better than the other algorithms in terms of , , and . In particular, of niching CPSO is 71.75%, 65.98%, 38.24%, 38.04%, and 4.19% of that of hybrid PSO, HPSO, SPSO, multilateration, and DV-Distance, respectively. Moreover, only seldom unknown nodes cannot be localized by niching CPSO.

We further compare cumulative distribution functions (CDF) of and of localization algorithms, as shown in Figures 8 and 9, from which we can draw the following conclusions:(i) of DV-Distance is the worst. Its distributes in 0.01-1 uniformly, and only 33.4% unknown nodes have .(ii)For niching CPSO localization algorithm, of more than 90% unknown nodes are less than 0.06, which is the best among all localization algorithms. Moreover, its largest is 416, and of more than 87% unknown nodes is less than 300. Therefore, niching CPSO achieves the highest localization precision with the smallest number of iterations among all algorithms.(iii)There are about 63.4% and 67.4% unknown nodes whose using SPSO and multilateration. Although their CDFs are almost the same, the number of unknown nodes with of SPSO is less than multilateration, so of multilateration is larger than SPSO.(iv) of HPSO and hybrid PSO are between SPSO and niching CPSO, but their are smaller than SPSO.

7.5. Impacts of Different Setups on Niching PSO-Based Localization

Based on the best parameters of SPSO and CPSO presented in Section 7.2, we compare the performance of Algorithm 3 using SPSO and CPSO with different network setups.

7.5.1. Impacts of and

Generally, the more anchors in a WSN obtain the more accurate localization. Figure 10 shows that niching PSO-based methods obey this rule, but the impacts of and on niching CPSO are less than those on SPSO, because the variation of niching SPSO is more obvious than niching CPSO. This figure also denotes that of niching SPSO is larger than niching CPSO. of niching CPSO and niching SPSO, respectively, belong to 0.0196-0.0280 and 0.0488-0.0772, and their , respectively, belong to 0.0152-0.0280 and 0.0424-0.0806.

The impacts of and on of both niching PSO methods are little, as shown in Figure 11. of niching SPSO is 469.68-485.33, and that of niching CPSO is 206.96-210.98. On the contrary, of niching SPSO is 11.99-15.22, and that of niching CPSO is 132.52-137.24, so the varying range of of niching CPSO is larger than niching SPSO.

7.5.2. Impacts of DOI and

Figure 12 shows that has little impacts on , while becomes larger as increases. When , of niching CPSO and niching SPSO is, respectively, 0.001 and 0.0131. When , of niching CPSO is about 26.9%-45.2% of niching SPSO, and of niching CPSO is about 25.2%-44.1% of niching SPSO.

Figure 13 shows that is almost the same under different and same . Both niching CPSO and niching SPSO have the minimal under , which is, respectively, 133.33 and 379.38. However, niching CPSO and niching SPSO exhibit different variation when . of niching SPSO is 500 for all . of niching CPSO is 254.13 when , which is the largest, and it is, respectively, 221.93, 216.43, and 216 when , 0.15, and 0.2. On the contrary, of niching SPSO is about 68.63 when , and it is 0 when . of niching CPSO is 120.69-148.08, and it is the largest when .

7.5.3. Impacts of Coverage Holes

We compare the impacts of coverage holes of WSNs on niching CPSO-based localization algorithm and DV-Distance, because the former is the best one among all PSO-based localization algorithms according to the above simulations, and the latter relies on connectivity information among sensor nodes.

Figure 14 illustrates the simulation region with three coverage holes, and the other setups as the same as above. Figures 15 and 16 show that the impacts of coverage holes on DV-Distance are more obvious than those on niching CPSO. The difference of () between WSNs with holes and without hole is located in () using DV-Distance, while that of niching CPSO is located in (). Moreover, all the above differences become larger and larger with the increase of and .

8. Conclusions

Due to random deployment of large-scale WSNs, anchors are not evenly distributed, so some unknown nodes may have not enough neighbouring anchors to localize itself, while some others may have overmuch neighbouring anchors to give a great burden to localize. Therefore, this paper presents a distributed, range-based, anchor-based localization algorithm using niching PSO with constriction coefficient and reliable references selection. This algorithm consists of three phases:(i)Reliable references selection based on distance to unknown node, angle between reference nodes, and localization precision of reference nodes.(ii)Generation and division of search space.(iii)Position estimation using niching PSO.

This algorithm uses a new stop criterion to decrease number of iterations, and a comprehensive method to choose the most reliable references to improve localization accuracy. It also presents localization algorithm for the unknown nodes with less than three neighbour reference nodes. Theoretical analysis shows that the proposed method has low complexity compared with the other PSO-based localization algorithms. Simulation results show that niching CPSO utilizes less iteration to achieve higher localization precision, and it is impacted less by number of sensor nodes, number of anchors, and degree of irregularity compared to the other algorithms.

Nowadays, the large-scale WSNs are applied to three-dimensional (3D) region more and more, and new PSO variants such as Enhanced leader PSO (ELPSO) [44] are developed recently, so we will study the application of recent PSO variants in 3D WSNs in future.

Data Availability

Data are obtained from real experiments.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

This article is partly supported by National Key Research and Development Plan of China (Grants nos. 2017YFC0804406 and 2018YFC1406203). This paper is also supported by Shandong Education Department Grant J16LN73.