A Weighted and Distributed Algorithm for Range-Based Multi-Hop Localization Using a Newton Method

Wireless sensor networks are used in many location-dependent applications. The location of sensor nodes is commonly carried out in a distributed way for energy saving and network robustness, where the handling of these characteristics is still a great challenge. It is very desirable that distributed algorithms invest as few iterations as possible with the highest accuracy on position estimates. This research proposes a range-based and robust localization method, derived from the Newton scheme, that can be applied over isotropic and anisotropic networks in presence of outliers in the pair-wise distance measurements. The algorithm minimizes the error of position estimates using a hop-weighted function and a scaling factor that allows a significant improvement on position estimates in only few iterations. Simulations demonstrate that our proposed algorithm outperforms other similar algorithms under anisotropic networks.


Introduction
Nowadays, Wireless Sensor Networks (WSNs) have gained relevance in many aspects of our lives because they have the capacity to innovate our environment including body sensor networks, smart houses, automation, transportation, business, security, agriculture to military applications, to mention a few. A WSN is typically composed of a large number of tiny devices called sensor nodes. Due to the characteristics of a sensor node, which contains constrained resources in processing, memory, sensing, and non-renewable with low-power batteries, wireless transmissions must be used efficiently to save energy. Furthermore, even though RF transmissions are around 10 times more energy-expensive than processing, all aspects of energy saving must be carefully taken into account (e.g., leaking energy) to preserve the autonomy of the entire network [1][2][3][4].
Commonly, WSNs are randomly deployed in large geographical areas with the aim of detecting environmental events on sensor nodes. Such events must be reported to other nodes using short-range wireless transmissions until reaching one or more sink nodes for reporting data. Clearly, routing protocols play an important function in multi-hop networks, that is to say, the shortest route from one sensor node to another sensor node allows the entire network to save energy [5,6]. However, it is imperative for data reporting to know where the detected event comes from. In other words, for a broadcast event the time-location parameter is more important than the sensor identity itself. Thus, positions of sensor nodes should be known a priori before to run a WSN application, and so the background stage in most WSN applications is the localization process. In this stage, the geographic-location must be discovered using RF transmissions with neighboring sensors and specific algorithms [7][8][9][10][11]. An interesting research dealing with multi-hop localization is presented in [12]. It manages an hybrid approach where the DV-Hop scheme is improved by promoting unknown sensor as anchor nodes, where these virtual anchors are one-hop neighboring sensor of the real anchors, and their localization are obtained using the estimated distances from the RSSI technique. The authors claim that this scheme can be employed when the density of anchors in the network is low.
In distributed localization algorithms dealing with realistic multi-hop WSN scenarios, estimating among neighboring sensors can suffer from hardware imperfections, changing environments, network topologies, and node densities, which consequently can affect the estimation of the sensor positions [13][14][15][16][17]. For instance, the work in [18] addresses the multi-hop localization problem in severe multi-path scenarios deriving from changing environments. It integrates the non-line-of-sight (NLOS) path information to maximize a reduced-complexity pseudo-maximum likelihood scheme to estimate the position of unknown sensors.
Another interesting approach is proposed in [19] addressing hardware imperfections called wireless ad hoc system for position (WASP). It handles complex radio propagation signals coming from beacons to determine localization of unknown sensors by using novel extensions for ToA measurements. This approach provides high accuracy at minimum hardware and processing cost. It uses a robust least squares algorithm (RLS) for localization that removes iteratively suspicious bad range measurements by recomputing node positions. However, in our work, we pursuit a different approach where the outlierness level of each measurement is controlled by weights that could attenuate the possible influence of atypical observations on the solution of the optimization problem. In [20], the localization problem is addressed using a robust statistic, which reduces the influence of outliers in the estimation process.
The last reasons imply that the accuracy and rate of convergence of range-based iterative algorithms for multi-hop network localization are highly dependent of topologies; therefore, robust approaches must be applied in order to minimize errors in position estimates. Moreover, it is well known that the mathematical formulation of the localization scheme typically requires solving a nonlinear and non-convex optimization problem [21][22][23][24][25].
In this research, a robust and weighted localization algorithm is proposed based on the Newton method approach (RWNM). The algorithm presents the flexibility that any unknown sensor, in a distributed way, can use a dynamic scaling parameter that weights neighboring sensors with the goal of reducing errors in position estimates. Such a scaling parameter is dependent on distance errors with neighboring sensors and the hop-proximity of them towards anchor nodes. Results demonstrated that our approach has a good performance in multi-hop networks with irregular distributions on sensor nodes. It overcomes similar approaches in accuracy on position estimates and requires fewer iterations than others, which is essential in distributed schemes to save energy.
Summarizing, the main contributions of the work are as follows: • A novel localization method is introduced that is robust to outliers. To remove or mitigate the influence of possible atypical measurements, the proposed method uses two kind of weights: one is based on the average hop-proximity to the anchors, and the other is based on the determination of the degree of outlierness degree in the noisy distances. • The proposed method is based on the Newton method, which improves the unknown sensors' positions in a few iterations, even though when rough initial estimates are given.

•
The method demonstrates good performance under both isotropic and anisotropic topologies.
The rest of this paper is structured as follows. Section 2 describes the effect of large errors and outliers that could be present in the position estimation process. Section 3 details the problem formulation for multi-hop network scenarios. Section 4 describes the proposed algorithm. Section 5 determines the computational complexity of the algorithm. Section 6 shows some experimental results using isotropic and anisotropic networks, and finally Section 7 draws the main conclusions.

Reducing the Impact of Outliers in the Estimation Process
Commonly when data X = {x 1 , x 2 , · · · , x n } are analyzed and processed, they are assumed as iid (independent and identically distributed) with normal distribution, where the estimation of a statistical parameter µ can be carried out under the Maximum Likelihood Estimator (MLE) technique asμ = arg min where represents the joint density function for the data set X, µ denotes the mean, and σ 2 the variance. For the estimation ofμ, the − ln f (X, µ) is applied, which results in the minimization of the sum of square errors as the data have the same dispersion σ 2 : where e i = x i − µ. However, by using the quadratic loss function in (3), a noticeable amplification of atypical errors (i.e., outliers) is obtained, leading to a bad estimation of µ. The outliers effect can be exemplified with the next case: Assume that {x a , x b } ⊂ X are atypical measurements; thus, (3) can be rewritten aŝ Then, the higher the error values on x a and x b , the larger the bias in the estimation of µ. To mitigate this effect, a technique commonly used is to modify the minus log Gaussian likelihood with variances c i depending on each particular regression point as follows: which implies the following quadratic loss: this means that taking c a y c b large enough, then 2 << e 2 a + e 2 b ; consequently, the outliers at the point a and b will have less effect in (6) than in (4) in the estimation of µ.

The Range-Based Localization Problem
It is considered hardware-homogeneity among all N + M deployed sensor nodes with limited radio range R and M N. Under this scenario, a sensor node could require more than one hop to reach neighboring sensors for communications. Then, the set of one-hop neighboring sensors of an unknown sensor s i can be stated as where · denotes the Euclidean norm. This research assumes that all unknown sensors have n-hops connectivity to anchor nodes in the network, where the distance estimates, r ik (for k = 1, · · · , M), between an unknown sensor s i and any anchor a k can be easily calculated by the DV-Hop scheme [13]. Thus, the set of anchor indexes is denoted as The set of noisy distances between s i and its neighboring sensors is described as where d ij = u i − u j , r ij represents the noisy distance between sensors s i and s j , d ij is the true distance between them, and the term e ij provides the biasing of the estimated distance introduced by environmental conditions and the measurement technique [26]. Distance estimates among sensor nodes can be carried out by techniques like RSS, TDoA, ToA, AoA, or a combination of them [27][28][29]. The localization problem can be formulated as follows: which stands for an unconstrained and nonlinear equation where the function f (·) plays a fundamental role to find position estimates that minimize (9).

A Robust and Distributed Localization Algorithm Based on the Newton Method
Due to the high cost in processing data, energy consumption in wireless transmissions, and security of collected data, Equation (9) tends to be programmed in a distributed way instead of being solved in a central node [30]. The robust-weighted Newton method (RWNM) algorithm, proposed here, breaks down (9) into subproblems that can be implemented in unknown sensors of a distributed manner [25]. Thus, each sensor s i can minimize its distance error with one-hop neighboring sensors and n-hops anchors by solving the following optimization problem: with F(p i ) defined as Here, each distance error sensor-sensor is multiplied by a weighted value w j , which represents the inverse of the average of the minimum number of hops between the sensor s j and each anchor, stated as where hops(j, k) represents the minimum number of hops between the sensor s i and the anchor a k . It is easy to define the set of weights corresponding to the neighbors of the sensor s i as On the other hand, for sensor-anchor distance errors, the weighted value w k is set to one.
To minimize (11) in a distributed way, a sensor s i employs the Newton method using the 2 norm as where e = e ih · w h , ∀ h ∈ Ω i ∪ B stands for either the distance error between sensor-sensor or sensor-anchor, c is a scaling factor which controls the broadness of the function shape around the origin and mitigates the effect of large errors as explained in Section 2.
On the other hand, any sensor s i that minimizes position estimates with neighboring sensors must first calculate the scaling parameter c i as described next.
First, using distance errors with neighboring sensors, the median is calculated as where the set of errors E Ω i is defined as then, a new set of neighboring sensor of s i that presents less error in distance estimates than e i is obtained as Next, using (13) with the new set of neighbors of (17), W i = {w j : j ∈ Ω i }, the maximum weight value is obtained in Equation (18): Finally, the scaling parameter vector for neighboring sensors of s i and anchor nodes is computed according to Equation (19): It is remarkable to mention that c j = ∞, which implies that the sensor s j will be discarded in the minimization process.
The Hessian and the gradient for the Newton method process are described as follows. For clarity, consider that the position p r can be used indistinctly for both anchor and unknown sensor positions. The gradient of (11), ∇F( where The Hessian of (11) is described as where Assuming that rough initial estimates for all unknown sensor nodes are obtained by standard methods such as Least-Squares and Min-Max, among others [11], the distributed localization process for a sensor s i follows the process shown in Algorithm 1.
Algorithm 1 Sensor s i refining its position estimates. (20) and (21) 7: Compute: H(p i ) from (23) 8: Solve: H(p i ) + µI ∆ = −∇F(p i ) 10: p i =p i + α∆ 11: n = n + 1 12: until n ≤ Niter or p i −p i ≤ τ As is well known, the optimal step length α in line 10 of Algorithm 1 can be found using both the Armijo and Wolfe conditions at expenses of more computational cost [31,32]. For practical purposes, α was set to one. The updated position p i of s i is broadcast to its neighboring sensors starting a new refining position process.

Computational Complexity
The Algorithm 1 is run for each sensor s i and requires as input the set W i = {w j : j ∈ Ω i } and the set of weights C i = {c j : j ∈ Ω i ∪ B} computed in Equation (19). First, the computational cost incurred in the computation of the W i and C i will be determined.
As each w j ∈ W i is computed as the average of the number of hops hops(j, k) between the sensor s j and each anchor k, then computing w j takes O(|B|) operations. On the other hand, the set W i consists of |Ω i | elements, therefore the cost to determine the set W i is Each weight c j ∈ C i is calculated by Equation (19) which depends on (17) corresponding to the median of a set E Ω i of size at most |Ω i |. It is well known [33] that the median of a set of size n can be computed in linear time O(n). Therefore, the computational cost to determine C i is assuming that |B| ≤ |Ω i |.
In the following, the computational cost of one iteration of the repeat/until block (from line 5 to 11) will be addressed. The most expensive steps are the calculus of the gradient ∇F(p i ) and the Hessian H(p i ), where each of them are computed in at most O(|Ω i | + |B|) = O(|Ω i |). This is due to both the first and second partial derivatives (equations from (20) to (27)) are expressed as summation over the set Ω i ∪ B. Note that line 9 corresponds to solving a 2 × 2 linear system with a positive definite matrix with cost O(1). Summarizing, the cost of this loop block is where n i is the number of iterations that the algorithm needed to convergence. Therefore, the total cost of the Algorithm 1 per sensor s i is calculate as Because Algorithm 1 is executed once for each sensor, it is obtained that Based on the experimental analysis, |B| = 5 and the body of the repeat until block is executed in 6 iterations (n i = 6) on average. Consequently, Equation (33) can be simplified to As ∑ i : s i ∈S |Ω i | = 2|E|, with |E| denoting the number of wireless connections, the final cost is a big-O of the number of connections in the network, implying that the algorithm scales linearly with respect to the total number of connections.

Range-Based Multi-Hop Network Performance
In large deployment scenarios with constrained radio range on sensor nodes, forming multi-hop networks, and unknown sensors far outnumber anchor nodes, the DV-Hop scheme represents a good approach to estimate distances among sensor nodes in a distributed manner [11,13]. As is well known, a distance estimation between an anchor node and unknown sensor, at some hops of each other, normally could suffer from several error sources: the environmental itself, the ranging technique, and the localization algorithm, to name a few. Furthermore, the network topology, integrated to the other aforementioned factors, can generate abnormal errors (i.e., outliers) on distance estimates; the latter can bring with them large errors on distance estimates where most localization algorithms do not behave well.
To evaluate the accuracy iterations performance of algorithms, two kind of topologies are recreated as shown Figure 1. As can be observed, both networks are connected (i.e., non-isolated sensor nodes), and anchor nodes are distributed around a circle shape Figure 1a (anisotropic network) or inside of a square area Figure 1b (isotropic network). It must be remarked that anchor nodes are located in a non-collinear pattern distribution. The system test has 10 setup networks for each topology with fixed positions of sensor and anchor nodes, and the degree of network connectivity is given by the radio range in sensor and anchor nodes, assumed homogeneous. There are two levels of degree connectivity given by different radio ranges (R = 35 m and R = 45 m). Therefore, for each radio range, 10 networks are created for each topology.
As proposed in [34], the noisy distances between a sensor s i and its neighbors are computed as where χ ∼ N (0, 1) represents a normal distributed random variable and n f e ∈ [0, 1] is the standard deviation of the distance error. This is equivalent to that can be rewritten as which is similar to the additive noise model in (8).
In order to obtain noisy distances contaminated with outliers, a parameter Θ (percentage of outliers) is used to randomly select a subset of distances. Each distance in the subset is modified by a scalar parameter ρ as follows: where the parameter ρ is defined as For each sensor s i an initial estimated position is calculated as the average of the M anchor positions plus a random perturbation as follows: where υ i,k , i = 1, . . . , N, k = 1, . . . , M is a N × M sample of a random variable with Gaussian distribution N (0, 1). The root mean square error (RMSE) metric is employed to evaluate errors on position estimates of the unknown sensors for the network t, where t = 1, . . . , 10, and finally the average RMSE (RMSEavg) is calculated as follows: In Equation (41), · is the two-norm, p t i and u t i represent the position estimate of sensor s i and its true position for the network t, respectively, and N is the number of unknown sensors. Figure 2 shows the methodology used for the algorithms to evaluate accuracy and number of iterations. There are two ranges of connectivity for testing (R = 35 m and R = 45 m), two levels of noise (n f e = 0.1 and n f e = 0.3), and six scales of outliers (Θ ∈ {0%, 10%, 20%, 30%, 40%, 50%}). The box on the left side, in Figure 2, has four possible combinations between R and n f e values. For each one of the four combinations, 30 evaluation processes are generated as shown the box on the right side. For instance, the remarked arrows, left side, imply that the combination R = 35 m with n f e = 0.1 will be applied to all distance measurements on an entire network. Using this combination (R = 35 m and n f e = 0.1), without outliers (Θ = 0%), all iterative algorithms are tested using the 10 independent networks. For each one of the 10 networks, the algorithm is run until one of the stopping criteria is satisfied (i.e., 100 iterations or p i −p i ≤ τ). Then, the number of iterations in which the algorithm stopped is registered. Finally, Equation (41) is used to calculate the average RMSE (RMSEavg) of the 10 networks and also the average of the numbers of iterations (Iter_avg) is obtained. The next step consists of testing the same combination (R = 35 m and n f e = 0.1), but now adding 10% of outliers to noisy distances with (38). This process is repeated until reaching 50% of outliers in noisy distances. Therefore, for each outlier step there will be two parameters (i.e., RMSEavg and Iter_avg) for each evaluated algorithm. The last process is repeated for R = 35 m with n f e = 0.3, R = 45 m with n f e = 0.1 and finally for R = 45 m with n f e = 0.3. Table 1 Figure 2. Methodology followed to test RMSEavg and Iter_avg spent by algorithms using a setup of 10 networks for both circular and uniform node distributions.

Range-Based Multi-Hop Localization over Randomly and Uniformly Distributed Sensor Networks
In this section, we test the proposed RWNM algorithm under isotropic WSN topologies. Here, sensor nodes are uniformly and randomly distributed over an area of 200 × 200 m 2 . Ten multi-hop networks similar to that one presented in Figure 1b are created. The ratio between the number of unknown sensors and anchors is 0.95. Each network has 100 sensor nodes. First, it is assumed that each sensor node has a partial set of neighboring sensors according to Equation (7). Furthermore, anchors and unknown sensors are assumed with the same circular radio range R. Each pairwise distance is affected with a noise factor of n f e = 0.1 using Equation (35). This benchmark network, with n f e = 0.1 and Θ = 0, is used as a basis to create other five networks, affected with different levels of outliers Θ = 10%, Θ = 20%, Θ = 30%, Θ = 40%, and Θ = 50%. Finally, each one of the six networks is run in every iterative algorithm to evaluate its accuracy and rate of convergence (or iterations) at different levels of outliers. It must be remarked that DV-hop [13] and RELM [35] algorithms modify distances between anchors and unknown sensors, where such distances are unaffected by noise or by outliers as they depend on hop counts between them. Initial estimates average of the 10 networks is around 86.33 m.
It is known that there is at least one path between any pair of sensor nodes in each network. Initial position estimates for the iterative algorithms are simply calculated as the average positions of anchor nodes. The refinement stage is run in a distributed way as second localization process in each unknown sensor to improve position estimates. Figure 3 shows the accuracy iteration behavior of the evaluated algorithms considering n f e = 0.1 and R = 35 m at different levels of outliers.
Clearly, the accuracy performance of the combination algorithms RELM [35] +LM [36] and DV-Hop+LM are linearly affected with the increase of outliers on the range measurements among sensor nodes. However, without presence of outliers, the best accuracy on position estimates is obtained by the DV-Hop+LM algorithm with a RMSEavg = 21.83 m. The worst RMSEavg-Iter_avg performance is carried out by the combination RELM [35] +SOCP [34,37] algorithms. This is because the SOCP algorithm is highly dependent on the number and location of the anchors. On average, the DV-Hop+DWDSCL [38] obtains the best accuracy performance with 23.36 m followed by the combination DV-Hop-RWNM with 24.04 m. Moreover, this last combination outperforms others in rate of convergence with only 4.25 iterations, in average, which implies more saving energy for the entire network as shown Table 2.   Now, keeping both the position set of unknown sensors and anchors positions for each one of the 10 benchmark networks and also taking the same set of range connections (i.e., R = 35 m), the distance errors among neighboring sensors are now affected with n f e = 0.3, and the results are depicted in Figure 4.  The results show a RMSEavg-Iter_avg behavior very similar to the previous one. The DV-HOP+RWNM scheme still manages to be lower in iterations with 4.06, in average. The average results are shown in Table 3. On the other hand, increasing the radio range from R = 35 m to R = 45 m, in each sensor node, produces more gathered information of neighboring sensors, and it also presents a reduction in the number of hops between anchors and unknown sensors. Both last effects tend to reduce error on position estimates. Figure 5 shows results with n f e = 0.1 and R = 45 m.
It is clear that algorithms reduce the error on position estimates, on average, as shown in Table 4. Figure 5 demonstrates how errors on position estimates tend to increase when the quantity of outliers also increase, as expected. Without outliers (i.e., Θ = 0%) on distance estimates, the DV-Hop+LM has the best accuracy performance with RMSEavg = 9.72 m, but it increases its error as outliers do. On the other hand, due to the weighted function in the their minimization process, the DV-HOP+DWDSCL and DV-HOP+RWNM schemes are less affected in the RMSEavg, and the RWNM approach requires around 5.05 iterations, on average, to obtain the best RMSEavg result of 14.78 m.  When the range distance errors among neighboring sensor are increased from n f e = 0.1 to n f e = 0.3, errors on position estimates are also slightly increased as shown Figure 6 and Table 5. It must remarked that the combination DV-Hop-RWNM still hold the best performance in accuracy and iterations with 15.22 m and 5.45, respectively.

Range-Based Multi-Hop Localization over Irregular Topologies of Sensor Networks
This section analyzes the accuracy and iterations performance of the proposed RWNM scheme under anisotropic networks. A benchmark of 10 independent multi-hop networks like that presented in Figure 1a is considered for testing. In all networks, it is known that there is at least one path between every pair of nodes around the circle shape.
The analysis and tests for this section run also in the same way as that analyzed in Section 6.1. The first test consists of evaluating the error on position estimates and the number of iterations spent by the distributed algorithms. The stopping criterion is assumed equal in all algorithms (i.e., τ = 10 −2 ). Initial estimates average of the 10 networks is around 102.1 m. Using the combination n f e and R, 10 independent networks are created, and each one is run in the distributed algorithms to finally averaging the results (i.e., RMSEavg and Iter_avg).  The next step is to increase the noise level on distance estimates from n f e = 0.1 to n f e = 0.3 in each one of the 10 benchmark networks and carry out the test like in the previous step. Figure 9 shows that all combinations almost have the same behavior. The RMSEavg of the combination DV-Hop+RWNM slightly increases as the quantity of outliers also does. It starts with a RMSEavg = 16.47 m at Θ = 0% and finishes with RMSEavg = 17.19 m at Θ = 50%. Furthermore, this combination gets the best trade-off between RMSEavg and Iter_avg as summarized in Table 7.  Another interesting test to analyze consists of increasing the radio range in sensor nodes; so the radio range is set to R = 45 m with n f e = 0.1 in all sensor nodes in the 10 independent benchmark networks. Figure 10a shows the accuracy of the estimated positions for this case. As expected, increasing the radio range improves the accuracy of most algorithms at Θ = 0%. However, as an outlier could be present in a range measurement, it will affect more neighboring sensors in the estimation process, and most algorithms tend to increase their errors as outliers do. The proposed scheme RWNM starts with a RMSEavg = 16.29 m at Θ = 0% and finishes with a RMSEavg = 16.39 m at Θ = 50%. Table 8 shows that the combination DV-Hop+RWNM continues with the best results for accuracy and iterations with a RMSEavg = 16.24 m and 5.33 iterations on average. The final step uses the 10 benchmark networks with R = 45 m and n f e = 0.3. Even though the noise level has increased in distance measurements, the final results in both analyzed parameters (i.e., RMSEavg and Iter_avg) remain close similar to the last step as depicted Figure 11. The combinations DV-Hop+RWNM continue with the best accuracy performance with the minimum number of iterations as depicted in Table 9.   Figure 12 depicts the relation between the RMSEavg and number of iterations considering two radio ranges for anisotropic networks. It can be observed that the proposed scheme provides the best accuracy and iterations performance. It can be appreciate that the DV-Hop+RWNM algorithms spends only three iterations to reach a RMSEavg of 17.01 m and 16.2 m for R = 35 m and R = 45 m, respectively.

Conclusions
This research has investigated a range-based and distributed algorithm suitable for multi-hop network localization. The proposed scheme employs a weighted Newton method approach that minimizes errors in position estimates under anomalous pairwise range measurements between sensor nodes. Unknown sensors categorize neighboring nodes with specific weights based on the closeness to an anchor node and error distances. The algorithm has been tested at different radio ranges and noise levels in distance estimates, demonstrating robustness in presence of outliers with a small number of iterations to reach good results in accuracy. In fact, in isotropic networks, the proposed method practically matches the localization performance of the DV-HOP+DWDSCL method using far fewer iterations to converge. The best performance is carried out under anisotropic networks where the proposed scheme outperforms others providing the best accuracy in position estimates with the minimum number of iterations.

Data Availability Statement:
The data presented in this work are available on request from the corresponding author.

Acknowledgments:
The authors wish to express the acknowledge to PRODEP that supported this research.

Conflicts of Interest:
The authors declare no conflict of interest.