Localization of Large-Scale Wireless Sensor Networks Using Niching Particle Swarm Optimization and Reliable Anchor Selection

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.


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 largescale 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 2 Wireless Communications and Mobile Computing 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.

Related Works
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 anchorfree 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 [24][25][26][27][28][29][30].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 fuzzyextreme 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 3anchor 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 rangebased 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.

Background and Basic Idea of Proposed
Localization Algorithm Since the actual distance   is not known, the objective of localization is to minimize the difference between d and d .Therefore, the problem of localizing   is formulated as where   = 1/ d / ∑  =1 (1/ d ), 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 (1 − ) [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.

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 : (1) current location   ; (2) the previous location   of the best fitness; and (3) current velocity   .Besides,  denotes the position of the best particle so far.The basic procedure of PSO is shown in Algorithm 1.
In (5),  1 and  2 are, respectively, cognitive and social acceleration coefficients,  1 and  2 are random numbers uniformly distributed in (0,1), and  is inertia weight defined as where   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 are where   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 is where  = 2/|2 −  − √  2 − 4|,  =  1 +  2 > 4.0.

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.

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 as where   , d , 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 as where   is a reference node to localize   .  is defined as is localized by Algorithm 4 or 5 (11) where ( x , ŷ ) is the estimated location of   to localize   .Further, () of ( 9) is a normalization function to map variable  ∈ [  ,   ] to () ∈ [0, 1], which is defined as Note that   and   are derived from the corresponding variables (i.e.,   , d , or   ) of all neighbour reference nodes of , instead of all reference nodes of whole WSN.Moreover,   ≥ 0 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 (9) is illustrated in Figure 2(a).Suppose  has 6 neighbour reference nodes   ( = 1, 2, ⋅ ⋅ ⋅ , 6), and  and   are shown in Table 1. 1 is chosen as the first one.If we still use  to select the second one,  2 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  5 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),  2 cannot be chosen after  1 and  5 if  = 0.1, although  of  2 is the second largest. 4 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 RS of an unknown node  as input and returns the set of reliable reference nodes SRS.Lines 1 and 2 choose the first reliable reference node  1 , and lines 3-5 choose the second one  2 .Line 9 removes reference nodes if  is not collinear with any two elements of SRS then (10)  ← minimal internal angle of triangles formed by  and any two elements in SRS (11) if  ≥  then (12) SRS ← SRS ∪ {} (13) end if (14)

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 (7), which is the combination of the first two criteria.
Obviously, d =   if  = 0, so   = 0, then (7) is feasible.However,  > 0 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 (7), as shown in Algorithm 3.
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 2, 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  = {  |  = 1, 2, ⋅ ⋅ ⋅ , ,  > 1},  is defined as where d1 ( d2 ) is measured distance between  and  1 ( 2 ) and d13 ( d23 ) is estimated distance from  1 ( 2 ) to  3 .
(iii) Case 3. If   is  3 selected by line 19 in Algorithm 4, the distance is (iv) Case 4. If   is  2 or  3 generated by line 8 or 10 in Algorithm 5, the distance is (v) Case 5.If   is  3 obtained by line 15 in Algorithm 5, the distance is 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)  1 and  2 decide the maximum repeated times of the same   , and  1 <  2 .
(iii)  determines the degree of acceptance of   .For particle group , if an unacceptable (  ) >  repeats more than  1 times, or a nearly acceptable (  ) ≤  repeats more than  2 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).

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.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].

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.
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), (5), and (8), 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  + 2 divisions and  − 1 additions to get   and  extractions of square root, 4 multiplications, For multilateration and Algorithm 3,  is the number of neighbouring reference nodes, so  2 <  × .DV-Distance uses all anchors to localize each unknown node, so its time complexity ( 2 ).Generally,  <  × .Therefore, the time complexity sequence is multilateration < DV-Distance < CPSO = SPSO < (hybrid PSO, HPSO).
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 ( 3 ).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.

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].

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. 1 and  2 are fixed at (−cos(/3), ±cos(/3)), and  3 changes its position in  ∈ [0, ] along the blue arc, where  is the angle between line  3 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 2/3, and it decreases as  decreases from 2/3 to .Moreover, different  generates different varying trends.In the proposed algorithm, we utilize  = (100 + 5)/180 as the threshold to decide the collinearity of anchors.

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 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  > 1 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 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: (iii) There are about 63.4% and 67.4% unknown nodes whose  ≤ 0.06 using SPSO and multilateration.
Although their CDFs are almost the same, the number of unknown nodes with  > 0.01 of SPSO is less than multilateration, so  of multilateration is larger than SPSO.

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

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 [0, 0.2763] ([0.0018, 0.1593]) using DV-Distance, while that of niching CPSO is located in [0, 0.0074] ([0, 0.0286]).Moreover, all the above differences become larger and larger with the increase of  and .

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.
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 threedimensional (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.

Figure 4 :
Figure 4: The maximum number of iterations of the same continuous .

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

Figure 6 :
Figure 6: Positions of reference nodes to analyse the collinearity.

Figure 16 :
Figure 16: Impacts of coverage hole on   .
where  is the number of anchors.The position of anchor   is denoted by (  ,   ).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.,   ) for   .The set of reference nodes is denoted byRS = {  |  = 1, 2, ⋅ ⋅ ⋅ ,   },  ≥   ≥ .The position of reference node   is denoted by (  ,   ).Obviously, if   is anchor   , (  ,   ) = (  ,   ); if   is localized unknown nodes   , (  ,   ) = (x  , ŷ ).Actual distance: distance between the actual positions of   and   .It is denoted by   .Estimated distance: distance between the estimated position of   and   .It is denoted by d .Update particle  according to the following formula:   =   +  1  1 (  −   ) +  2  2 ( −   ),   =   +   (5) (6) end while Algorithm 1: Basic procedure of PSO algorithm. of   in general case.Using estimated position ( x , ŷ ), the estimated distance d is d

Table 1 :
conf and   and  of   in Figure1.
Line 10 computes .Line 12 appends reference nodes with  ≥  into SRS.Note that SRS may contain only two reference nodes according to this algorithm.If so,  is localized by Algorithm 4 with  1 and  2 as inputs.

Table 3
(ii)  and   of SPSO and multilateration are almost the same, but SPSO localizes more unknown nodes than multilateration.

Table 3 :
Comparison of four localization algorithms.
and  on  of both niching PSO methods are little, as shown in Figure11. 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,andthat 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 e. Figure 7.5.1.Impacts of  and .Generally, the more anchors in a WSN obtain the more accurate localization.Figure10