Range-Based Positioning with Self-Adapting Fireworks Algorithm for Wireless Sensor Networks

Positioning is the basic function of wireless sensor networks (WSN). At present, range-based positioning is a common method to obtain the position of a node, but its accuracy has encountered a bottleneck. ,e fundamental reason is that it ignores the ranging information between blind nodes.,erefore, based on the design of the positioning optimization factor to adjust the weight of the ranging information between the blind nodes, the positioning model of minimizing the error is established. On the basis of designing the blind node positioning matrix, the multiblind node localization problem is transformed into a single-objective optimization task, and the model also supports two-dimensional and three-dimensional positioning. In order to solve the model efficiently, we added a self-adaptive function that matches the positioning requirements for the explosion searchmechanism of the fireworks algorithm (FWA) and then proposed a self-adaptive FWA (SA-FWA). ,e experimental results on the real ranging dataset show that the model has higher accuracy than other methods and achieves the current optimal positioning error, which is 1.88m for received signal strength data and 1.02m for time of arrival information, respectively.


Introduction
With the rapid development of the Internet of ings (IoT), wireless sensor networks (WSN) have been widely deployed, such as traffic flow sensing, target tracking and positioning, forest fire warning, and mine gas and drinking water monitoring [1][2][3][4]. In turn, these applications have also become important drivers of WSN's growth.
Positioning is the basic function of WSN [5]. Location services in WSN usually include node and target positioning [6]. e former means that the node obtains its own location through a certain method, while the latter refers to acquiring the position of the target outside the network. is paper focuses on the node positioning. Sensor information usually needs to be associated with location; otherwise, it may significantly reduce its actual value, such as forest fire alarm locations and water pollution pipelines [7].
According to the reference information, the localization can be divided into range-free and range-based positioning [8]. However, the above two still have some similarities in the positioning process. First, the anchor node (known in position) publishes its own location (obtained by means of GPS or presets). en, the blind node (the location is unknown) acquires the distance representation relationship with the anchor node. Note that the relationship can be either ranging information such as RSSI or nonranging information such as hops. Finally, the blind node calculates its own location according to certain conversion rules.
Range-free positioning is an indirect type of estimated positioning [9]. Typical algorithms include DV-hop [10] and APIT [11]. e advantage of range-free positioning is that there is no need to deploy auxiliary hardware, so it has a lower cost. However, the drawback is that the positioning accuracy is usually lower. is also makes it impossible to apply to scenes that require a high-precision location. e advantages and disadvantages of range-based positioning are exactly the opposite of range-free positioning [12]. According to ranging information, classical rangebased positioning algorithms include RSSI [13], time of arrival (TOA) [14], time difference of arrival (TDOA) [15], and angle of arrival (AOA) [16]. e distance conversion in TOA and TDOA algorithms is based on signal propagation time, so it requires specialized high-precision (nanosecond) time measurement hardware. In the AOA algorithms, the multiantenna array could measure the angle of arrival. Because RSSI could be directly measured without additional hardware, it becomes the most common range-based positioning method. However, the challenge is that its representation of distance is susceptible to signal propagation environments such as scattering and diffraction [17]. erefore, improving the accuracy of range-based positioning is crucial for WSN with high-precision location requirements. In the early research, based on the triangulation, the maximum-likelihood localization [18] improved the positioning accuracy from the spatial point of view by increasing the number of anchor nodes. From the perspective of time, the idea of cyclic positioning [19] could also effectively reduce the error by obtaining the ranging information multiple times, but it increases the energy consumption of the node. By measuring the internode RSSI and TOA data in the office environment (published as a public dataset), [20] derives the node location based on the Cramér-Rao bound and the maximum-likelihood estimators.
In recent years, scholars have tended to improve the positioning accuracy by perfecting the position estimation methods. On the basis of centralized positioning, [21] uses the particle swarm optimization (PSO) to design a target positioning scheme suitable for high mobile environments in MANETs. Although it is assisted by mobile robots, the joint swarm intelligence algorithm and centralized positioning idea could achieve a perfect balance between energy consumption and precision improvement.
rough the comprehensive application of RSSI and link quality indicator (LQI), [22] designed an artificial neural network (ANN) model based on Bayesian regularization and gradient descent, which is used to solve the problem of indoor mobile node location. For outdoor moving targets, [23] proposed a hybrid PSO-ANN algorithm, which proved that, compared with the traditional methods, the swarm intelligence algorithm has significant advantages in optimizing position estimation. Under the assumption that the measurement error distribution is unknown, [24] transforms the positioning problem into a nonconvex optimization problem and designs a distributed iterative method, but the accuracy still needs to be improved.
In terms of swarm intelligence algorithms, the fireworks algorithm (FWA) designs an explosion search mechanism based on the proximity similarity and adjusts its global and local search ability through information exchange and resource allocation between sparks [25]. Positioning satisfies the proximity similarity, and the location optimization process is in line with the explosion search mechanism. And this is our motivation to introduce the FWA into position estimation process.
In summary, although a large number of location optimization algorithms have been proposed, the current positioning accuracy is still unsatisfactory. e fundamental reason is that it ignores the ranging information between blind nodes. erefore, in this paper, a mathematical model is built to minimize the positioning error for WSN by making full use of ranging information between all sensor nodes. To enhance the adaptability of explosion search mechanism, the selfadapting FWA (SA-FWA) is designed and used to solve the above model. In addition, we prove that the proposed algorithm eventually converges to the global optimal solution. e rest of the paper is organized as follows: Section 2 establishes the mathematical model for node localization, and Section 3 solves the model with SA-FWA. e convergence of the algorithm is analyzed in Section 4. Section 5 designs the experiment and analyzes the results. Finally, Section 6 summarizes the paper.

Model Building
For ease of explanation, the positioning area is denoted as D.
By characterizing the node position as a vector, the sensor node set is defined as is the k-th sensor node, m c is the number of sensor nodes, and v is the coordinate dimension. In practical applications, v is usually taken as 2 or 3, corresponding to a two-dimensional plane and a three-dimensional space. Similarly, the anchor node set is denoted as is the i-th anchor node and m a is the number of anchor nodes; the blind node set is defined as is the j-th blind node and m b is the number of blind nodes. In the positioning system, the sensor node is either an anchor node or a blind node, so C � A ∪ B and A ∩ B � ∅.
Based on the above definitions, the ranging matrix is given as shown in Definition 1.

Definition 1.
e matrix of the measuring distance between all sensor nodes is called ranging matrix and is defined as M, as shown in where d r is the measuring distance between nodes c → k 1 and � 0, and if k 1 and k 2 are not adjacent, then It is necessary to note that the ranging matrix only collects the measuring distance between the sensor nodes and does not limit the distance indication, such as signal path loss and signal propagation time. In extreme cases, neighbor relationships between nodes could also be roughly regarded as distance indications.
In the distance conversion, we give the treatment methods for common ranging information. For the RSSI, the log-distance path loss model is used, as shown in equation (2). For the TOA or TDOA, it is calculated as equation (3). One has In equation (2), denotes RSSI at reference distance d 0 (usually 1 m); q is the path loss exponent, indicating the rate at which the signal propagation loss increases along the path with the distance, and the value is related to the environment in which the network is located; X σ ∼ N(0, 1) characterizes environmental Gaussian noise.
In equation (3), is the signal transmission speed between nodes.
Improving the positioning accuracy means reducing the positioning error, and the concept of positioning error in this paper is shown in Definition 2.

Definition 2.
e difference of the measuring distance in M and the real geographic distance between neighboring nodes is called positioning error, denoted as d, and the calculation is shown as follows: Node c → k is located in the neighbor domain of node b → j . d g is the geographic distance between nodes and is characterized by Euclidean distance, as shown in On this basis, considering the ranging information between blind nodes, the positioning mathematical model is established with the aim of minimizing the positioning error, shown as follows: e model objective function is designed to minimize the sum of the positioning errors of all nodes. In the constraints, R is the node communication radius, so → j and c → k as neighbor nodes. β is the optimization factor, which characterizes the sensitivity of the positioning error in the model to the ranging information between the sensor nodes, and its value has a great influence on the positioning accuracy. Generally, the larger the value of β, the greater the contribution of the ranging information between blind nodes to the positioning result, or the one between the blind node and the anchor node is more obvious. Note that β � 0 means that the ranging information between blind nodes is ignored. erefore, by properly adjusting β, the model can be adapted to a variety of application environments.

Range-Based Positioning with SA-FWA
e fitness function and operations are the foundation of FWA. In this section, on the basis of FWA, the SA-FWA is designed. First, the fitness function is first designed in combination with the location characteristics. Second, the operators are improved to enhance the adaptive search performance of FWA. Finally, the positioning process of applying SA-FWA to solve the model is given.

Fitness Function.
Multinode positioning is essentially a multiobjective optimization problem. erefore, we turn it into a single-objective optimization by constructing a blind node positioning matrix. Based on the matrix, the evolutionary elements in the SA-FWA are constructed, as shown in Definition 3.
Definition 3. Fireworks, explosion, and mutation sparks are collectively referred to as evolutionary elements, denoted as E, and characterized by the blind node positioning matrix; Obviously, E is a m b × v matrix, the row vector is the blind node, and its element is the node coordinate dimension (generally 2 or 3 dimensions).
Combined with the positioning model, the design of the fitness function for single-objective optimization can be expressed by Mathematical Problems in Engineering

Operators.
e operators include self-adapting explosion (SE) operator, self-adapting mutation (SM) operator, and selection strategy, which together affect the search performance of SA-FWA.

SE Operator.
e SE operator is a concrete implementation of the explosion search mechanism. Highquality fireworks (small fitness values) could get more resources, and explosions in a small area generate a lot of sparks, which is convenient for local search. Conversely, low-quality fireworks (large fitness values) produce a small number of sparks (with less resources) in a large area, which facilitates the global search.

Definition 4.
e operation of the fireworks adaptively generating explosion sparks is called SE operator and is defined as e SE operator is shifted by a polar coordinate system, and θ → and λ → A E are polar angle matrix and polar radius matrix, respectively. θ . . , sin θ v−1 j cos θ v j }, and θ l j � rand(0, 2π). e random matrix λ → � (λ) v×m b ; λ � rand(0, 1). A E r is the explosion radius and is calculated by the fitness function, as shown in } is the fireworks swarm, n is the size of E → , ε is the machine precision, to avoid the operation of zero division, and ω is the self-adapting search factor that improves the search performance of the algorithm and can be obtained by In order to improve the adaptive search performance of the algorithm, the designed c represents the evolution efficiency of SA-FWA, and c ≥ 1. At the same time, ω max and ω min are the maximum and minimum values of ω, respectively. Obviously, ω ∈ [ω min , ω max ], ω ∝ c −1 . erefore, when the algorithm evolves faster, ω could effectively speed up the global search and vice versa quickly improve the local search accuracy.
According to the SE operator, fireworks could produce a specified number of sparks within the explosion radius, and the number of explosion sparks generated by the r-th fireworks E r can be expressed by It is necessary to explain that f max � max(f( E → )). Since S E r is supposed to be an integer and the fireworks with a large (small) fitness value should be prevented from generating too little (much) sparks, S E r is corrected to S ⌢ E r , as shown in 3.2.2. SM Operator. As a supplement to the SE operator, the SM operator could enhance the diversity of the fireworks swarm and prevent the algorithm from falling into local optimum. erefore, the principle of mutation is that the smaller the fitness value of fireworks, the larger the mutation radius and the more the mutation sparks.
Definition 5. e operation of the fireworks adaptively generating mutation sparks is called SM operator and is defined as Γ: → . e SM operator is shifted by a rectangular coordinate system. e Gaussian mutation matrix e → � (e × round (rand(0, 1))) m b ×v , e ∼ N(1, 1); A E ′ is the mutation radius and is derived from the fitness function, as shown in According to SM operator, the fireworks could generate a specified number of sparks within the mutation radius. e number of mutation sparks S E r ′ generated by E r can be expressed by δ ∈ [0, 1] is the mutation coefficient, which is used in conjunction with ω for the adjustment of S E r ′ . Similarly, it is corrected as S ⌢ E r ′ . Note that, to prevent SA-FWA from falling into local optimum when enhancing the adaptive search performance, ω only acts on the number of mutation sparks without affecting the mutation radius.
It should be noted that the sparks produced by the above operators may exceed the feasible domain D.
erefore, when the l-th coordinate dimension b l j is out of bounds, b l j is remapped into D by where b l max and b l min are the maximum and minimum values of the l-th dimension in domain D and "%" is the modulo operator.

Selection Strategy.
After the sparks are generated, some excellent elements will be evolved into the next generation of fireworks swarm. According to the elite strategy, the elite corresponding to f min in the evolutionary elements set K will evolve. en, the remaining n − 1 elements are generated using a roulette strategy. In order to enhance the evolutionary effect, the probability of being selected in roulette is determined by the degree of element crowding, and the probability p(E r ) can be expressed by equation (15). Obviously, the denser the elements, the smaller the probability. One has Figure 1 shows the process of range-based positioning with SA-FWA, including three phases of parameter acquisition, model solution, and result output. e parameter acquisition phase includes the anchor node coordinates collection and the internode ranging information acquisition. e evolutionary efficiency of SA-FWA is closely related to swarm initialization. erefore, we design three initialization strategies in the model solution phase, namely, random, dock, and trilateration strategy.

Positioning Process.
(1) Random strategy: the position of the initial population is randomly generated in the feasible region. (2) Dock strategy: this strategy randomly selects the location of the neighbor anchor node as the initial coordinates for the blind node. If there is no neighbor anchor node, the blind node randomly stops at a neighbor blind node that completes initialization. (3) Trilateration strategy: the blind node selects the three anchor nodes closest to itself and performs the traditional triangulation method to obtain an accurate initialization position. It is necessary to clarify that the closest requirement is to increase the reference value of the anchor node, while limiting the three anchor nodes is to minimize the computational overhead.
Obviously, the complexity of the three strategies increases in turn, but the convergence speed of the algorithm decreases successively. e specific choice of strategy is related to the actual needs of positioning.
Considering the energy efficiency and timeliness, the algorithm termination condition is set to the maximum number of iterations w or the fitness value of elite evolutionary individual satisfies the same number of consecutive g times.
In the result output phase, the positioning matrix of elite evolutionary individual generated by SA-FWA is parsed into the coordinates of each blind node, and the positioning optimization is completed.

Algorithm Convergence Analysis
According to the evolutionary algorithm theory [26], when SA-FWA satisfies the following two conditions, it will eventually converge to the global optimal solution and has nothing to do with the initial fireworks swarm.

Condition 1.
e reachable probability between any two elements in the fireworks swarm is greater than 0.

Condition 2.
e iterative evolution of the fireworks swarm is monotonous.
According to the positioning characteristics and fitness function, the global optimal solution of SA-FWA means that the positioning result is consistent with the ranging information as much as possible, rather than the true position of the node (RSSI and TOA may have acquisition errors).

Mathematical Problems in Engineering
Proof.
e key to the evolution of SA-FWA lies in the operator design, namely, SE operator, SM operator, and selection strategy. erefore, the proposition is equivalent to proving that the above operators satisfy Conditions 1 and 2.
For Condition 1, in the evolution of each round, the feasible solution space of each element (blind node) is a circular area C with the node as the center and the communication radius R as the radius, as shown in Figure 2.
Based on the value of self-adapting search factor ω , C could be divided into two parts: a circular area (R/ω) with a radius C 1 and an annular area C 2 with an inner diameter and an outer diameter of (R/ω) and R, respectively. According to the explosion radius A E r and the mutation radius A E r ′ , there are both explosion and mutation sparks in C 1 , and only mutation sparks may occur in C 2 . erefore, in combination with the number of explosion and mutation sparks, the element reachable probability in C 1 and C 2 is shown in equation (16) and equation (17), respectively: Combining the above two formulas, we can see that P C 1 > P C 2 > 0, so Condition 1 is satisfied.
For Condition 2, the elite strategy in the selection strategy operation ensures that the optimal individual is evolved to the next generation. e rest of the individuals are based on the roulette strategy, and the probability of being selected is related to the degree of element crowding. erefore, after each iteration of the algorithm, the next generation of optimal individuals either is the best one in the previous generation or has a smaller fitness value than it. As a result, the evolutionary results of the fireworks swarm are monotonic; that is, Condition 2 is satisfied.
In summary, SA-FWA satisfies the above two conditions and converges to the global optimal solution. Q.E.D.

Experiment and Result Analysis
To validate the performance of the proposed model and algorithm, this experiment is based on the open real dataset [20] and stimulated by MATLAB 2012a platform. e dataset collects RSSI and TOA data between 44 sensor nodes that are interconnected in the office environment. erefore, the RSSI and TOA data are used, respectively, to conduct the experiment, and the influence of the value of positioning optimization factor β on the accuracy is analyzed. At the same time, by setting the node communication radius to limit the neighbor relationship, the model performance is further tested from the perspective of the intensity of ranging information.

Experimental Deployment.
With the release of the dataset, the Cramér-Rao bounds of the positioning accuracy (0.76 m for the RSSI and 0.69 m for the TOA) were also given [20]. Based on the relaxation transform, [24] turned the positioning into a convex optimization problem and gave a distributed solution algorithm. erefore, referring to the experimental settings of [20,24], the sensor nodes no. 3, no. 10, no. 35, and no. 44 are selected as anchor nodes from the dataset, and all remaining sensor nodes are blind nodes. So m a � 4 and m b � 40. For ease of explanation, the positioning area D is set to a rectangular area with vertex coordinates of (−5, −2), (−5, 14), (10, −2), and (10, 14), respectively. In addition, the average positioning error is denoted as d and is represented by the value of root mean square (RMS), as shown in equation (18). In addition, c is characterized by the change of the elite fitness value, as shown in equation (19). t is the iteration number and t ≥ 2. e values of other related parameters of the algorithm are shown in Table 1. One has R/ω Explosion spark Mutation spark   Figure 3, where (a) and (b) are the results for RSSI and TOA cases, respectively. For each β, the experiment was performed 10 times independently, and the final result was taken as the one closest to the mean of d.
In Figure 3, for the RSSI and TOA cases, d shows a decreasing trend in all β and finally ends at different values when the fitness value is the same for 10 consecutive times. Note that the occasional rise in the d lies in the measurement error of the ranging information between the nodes.
In Figure 3(a), when the beta is 0.3, 0.5, and 0.7, d converges to 2.06 m, 1.88 m, and 2.01 m, respectively, all of which are significantly better than the average positioning error of 2.18 m obtained in [20]. For the TOA case (Figure 3(b)), d converges to 1.22 m, 1.02 m, and 1.19 m under the same conditions, which are better than the 1.23 m and 1.87 m given in [20,24]. e experimental results are shown in Table 2.
It can be seen from Table 2 that d is optimal when β � 0.5. At this time, the positioning model is sensitive to the ranging parameters among all sensor nodes, which is consistent with the inconsistency of the nodes in the original dataset. To further verify the contribution of the ranging information between blind nodes to the proposed model, the experimental results of β � 0.0 are given in Figure 3. is case is equivalent to the traditional positioning idea that does not consider the ranging parameters between blind nodes at all. At this time, the values of d under the RSSI and TOA data are 3.07 m and 1.79 m, respectively. Moreover, the result is significantly inferior to the case of β > 0.0. When β � 0.0, the algorithm is less efficient. When the iteration reaches 164 times for the RSSI and 31 times for the TOA, the fitness value is no longer reduced. erefore, the introduction of ranging information between blind nodes has a greater improvement in the performance of the positioning model.
In order to visualize the algorithm results and analyze the blind node positioning error, the positioning results with β � 0.5 are shown in Figure 4, in which T (true) and E (estimated) represent the true position (given by the dataset) and the estimated location (given by the SA-FWA) of the node, respectively. e positioning error in Figure 4(a) shows that 90% of nodes d < 3.0m, 70% of nodes d < 2.0m, and 30% of nodes d < 1.0m. e three sensor nodes with the smallest positioning error are no. 34 (d � 0.19m), no. 25 (d � 0.41m), and no. 14 (d � 0.53m), and the three sensor nodes with the largest positioning error are no. 4 (d � 4.08m), no. 1 (d � 3.94m), and no. 37 (d � 3.21m).
From the above analysis, it can be found that TOA is significantly better than RSSI in distance characterization.  However, the positioning error of blind node no. 4 in different ranging information is very prominent, and the result of this node is not ideal in [20]. erefore, we boldly speculate that the collection of RSSI and TOA data associated with this node may be blocked by office walls or other objects, with large data acquisition errors.
Finally, in order to test the dependence of the model on the node's available ranging information, we simulate the variation of the ranging information between nodes by changing the node communication radius R. Let R be 15 m, 20 m, 25 m, and 30 m, respectively, and the results of d with β � 0.5 are given as shown in Table 3.
Obviously, the larger R is, the smaller d is. is shows that the more the ranging information between sensor nodes, the better the performance of the positioning model, which is the reason for introducing the ranging information between blind nodes to improve the positioning accuracy. When R is small, the node has fewer neighbor nodes, so the ranging information between nodes is not dense enough. In addition, R will also affect the explosion and mutation radius of SA-FWA, which has a negative impact on the positioning results.

Conclusions
Range-based positioning still faces major challenges in WSN with high-precision location requirements. In response to this, we established a mathematical model to minimize the positioning error by making full use of the ranging information between all sensor nodes. At the same time, the positioning optimization factor is designed to adjust the sensitivity of the model to the ranging information between blind nodes. Considering the similarity between the positioning optimization process and the explosion search mechanism, we use the FWA to solve the model. By the way, we improved the self-adaptive search performance of FWA, thus achieving a win-win situation between positioning accuracy and operation time. It is necessary to explain that, due to the design of the blind node positioning matrix, the model supports two-dimensional and three-dimensional positioning. At the same time, the convergence of the algorithm is analyzed. Finally, the average positioning errors of 1.88 m for RSSI and 1.02 m for TOA are achieved by experimenting with the real ranging dataset. In addition, the simulation results of the proportional change of the ranging information indicate that considering the ranging information between blind nodes is the key to the performance improvement of the model.
It is necessary to clarify that the above accuracy is the optimal value currently achieved on the dataset but still has not reached the ideal state. e root cause is that the dataset is collected from a real indoor office environment that is greatly blocked by walls and staff, and the ranging data collection error is large. However, this is consistent with the actual application environment of WSN, and the zero error acquisition is unrealistic.

Data Availability
e positioning data used to support the findings of this study have been deposited in the Wireless Sensor Network Localization Measurement Repository (http://web.eecs. umich.edu/∼hero/localize/).

Conflicts of Interest
e authors declare that they have no conflicts of interest.