UWB Indoor Localization Algorithm Using Firefly of Multistage Optimization on Particle Filter

With the increasing application potential of indoor personnel positioning, ultra-wideband (UWB) positioning technology has attracted more and more attentions of scholars. In practice, an indoor positioning process often involves multipath and NonLine-Of-Sight (NLOS) problems, and a particle filtering (PF) algorithm has been widely used in the indoor positioning research field because of its outstanding performance in nonlinear and non-Gaussian estimations. Aiming at mitigating the accuracy decreasing caused by the particle degradation and impoverishment in traditional Sequential Monte Carlo (SMC) positioning, we propose a method to integrate the firefly and particle algorithm for multistage optimization. The proposed algorithm not only enhances the searching ability of particles of initialization but also makes the particles propagate out of the local optimal condition in the sequential estimations. In addition, to prevent particles from falling into the oscillatory situation and find the global optimization faster, a decreasing function is designed to improve the reliability of the particle propagation. Real indoor experiments are carried out, and results demonstrate that the positioning accuracy can be improved up to 36%, and the number of needed particles is significantly reduced.


Introduction
As the public spend a growing number of their time indoors (80-90%) [1], services based on indoor location become an indispensable part of people's life and work. However, the Global Positioning System (GPS) cannot provide fair accuracy in indoor environment tracking due to NLOS issues [2,3]. Hence, the demand for high precision indoor positioning technology becomes increasingly urgent [4].
The Indoor Positioning System (IPS) can display the location information of people or objects in an indoor environment and also grasp the location of target objects in real time [5]. With advances in sensor technologies [6] and wireless communications [7], various indoor localization methods and systems have been developed over the past years [8]. In indoor environments, positioning is mainly achieved through the use of radio and inertial navigation technologies [9]. Among them, ultra-wideband (UWB) is a new technology in the field of communication that uses pulses with a width of nanoseconds as wireless communication signals [10], which has the advantages of strong multipath resolutions, fast transmission rate, low power consumption, and high positioning accuracy [11]. Therefore, UWB is suitable for high-precision indoor positioning services [12,13].
The UWB observation problem is for the most part nonlinearity [14]. It is well known that Extended Kalman Filter (EKF) is a popular method in approaching the nonlinearity problem [15]. Nevertheless, EKF often suffers large errors and deviations in its estimates of states and variances of nonlinear stochastic systems [16]. Compared with EKF, the main advantage of PF is that it is a Monte Carlo method to find the numerical solution of the sampling process, which gets rid of the restrictive condition that the random quantity must meet the Gaussian distribution [17]. However, the resampling adopted by PF will lose particle diversity, leading to particle impoverishment [18].
In recent years, the combination of swarm intelligence optimization (SIO) algorithm and PF algorithm has become one of important research trends [19]. The SIO algorithm regards particles as individuals in a biological population and adjusts the distribution of particles by simulating the movement law of biological clusters [20]. Given that the process does not discard particles with low weights, the phenomenon of particle impoverishment can be fundamentally avoided [21]. Chunming et al. aimed at the particle degradation and sample impoverishment existing in target tracking algorithm in existing wireless sensor network (WSN), introducing artificial fish swarm algorithm (AFSA) to improve the distribution state of particles in the resampling phase [22]. Cai et al. adopted a genetic algorithm to replace the resampling process and combined with the mutation and crossover stages, which improved the accuracy of filter, whereas this method has quite a few parameters and the setting of parameters has strong randomness [23]. Han et al. proposed an improved particle filter algorithm based on pigeon-inspired optimization (PIO). The algorithm combines the solving process of particle filters and guides the particles to move to the high likelihood area by the optimum process that pigeons usually fly from a far position to areas with high-fitness constantly [24]. Zhu et al. proposed an improved particle filter algorithm based on krill herd optimization, in which the induced movement, foraging motion, and physical diffusion processes of krill individuals are introduced into the particle filter to drive the particles to move towards the high likelihood region [25]. However, the improved PF algorithm based on the idea of SIO still has the problem of the blind search strategy and pays too much attention to the ability of particle exploration so that it is very difficult to balance the development ability of particle optimization in the later stage, which significantly affects the efficiency of particles moving to the high likelihood area [26]. At the equal time, there are invalid individuals in the iterative optimization process, which increases the computational redundancy of the algorithm [27].
Aiming at the above problems, this paper came up with an improved firefly particle filter (IF-PF) Algorithm 1. In the early stage of implementing the search strategy of our approach, the particle population is divided into several groups and a local search strategy is executed to solve the problem of target blindness. Then, all particles will carry out a global search strategy to expand the development ability, which ensures the diversity of particles. At the same time, the invalid particles will be replaced in time to reduce computational redundancy. By combining local search strategy with global search strategy, the performance of tracking algorithms can be improved with fewer particles, which raises the tracking accuracy and the tracking speed at the same time. Furthermore, the adaptive function is also added to avoid the problem that the particle oscillates in the vicinity of the optimal individual. Through applying IF-PF to the indoor UWB positioning, the experimental results show that the improved algorithm is superior to the standard particle filter and its popular variants in robustness and positioning accuracy.
The remainder of this paper is organized as follows. A brief introduction of PF is given in Section 2. In Section 3, we describe the algorithm we proposed in detail. The experimental setting and performance evaluation of the proposed algorithm are introduced in Section 4. Finally, Section 5 concludes and introduces the future work.

Particle Filter
The idea of the PF is based on Monte Carlo methods, which use particle sets to represent probabilities and can be used in any form of the state space model. The core idea is to express a distribution by extracting random state particles from the posterior probability. It is a sequential importance sampling method. The main steps of PF are summarized as follows: (1) Initializing particles and weights According to the empirical information of the state quantity [28], choose a proposal distribution p ðx 0 Þ , and Assign the particle a weight, w i k , according to Equation (3) 3. end for 4. for t =1: M-1 5.
Update x i , Update w i 7.
end for 8.
optimization based on Local search strategy 9.
Sort by weight and form groups in order 10.
the position of the X w for each group is adjusted such as Equation (11) 11.
optimization based on Global search strategy 14.
Light intensity I i at X i is determined by (9) 16.
Cluster particles and find the current best one 17.
Move particle according to Equation (13)   Journal of Sensors randomly generate a set of samples [29], namely particles: (2) Importance sampling One-step prediction based on the equation of state is shown asX The one-step forecast of the observed value is estimated asẐ (3) Particle weight update and normalization (i) Weight update: (ii) Normalization: (4) Resampling Sort the particles by weight, and replace the small-weight particles with the large-weight ones.

(5) State estimation
Finally, use the updated particle set and its weight to approximate the posterior probability density of the state quantity [30]

Proposed Algorithm
The Firefly Algorithm (FA) was first proposed by Yang in the year 2009 at Cambridge University [31], which is derived from simulating the flashing patterns and behavior of fireflies.
The brightness I of fireflies is defined as follows: where I 0 represent the initial brightness intensity and initial attraction, γ represents a fixed optical absorption coefficient, and r is the distance between two fireflies. The variation of attractiveness β with the distance γ is defined by where β 0 is the attractiveness at γ = 0. The movement of low brightness firefly i is attracted to another more attractive firefly j, which is determined by where X t i and X t j are the position of fireflies i and j at t time, α t ∈ ½0, 1 is the step size factor, and δ refers to the random factor obeying a uniform distribution in [0, 1].

Local Search Strategy.
Considering the inherent similarity between the PF and FA, the two algorithms are combined. We regard the particles in PF as individuals in firefly population and then implement optimization iterative strategies. Since the weight of particles is easily affected by the latest observation value in UWB positioning systems, the brightness of firefly is modified according to where z i is the latest observation value, hðx i Þ is the predictive observation value of particle i, and R is the variance of the observed noise. Each particle's brightness is only related to the latest observation as shown in Equation (9), and the brightness does not rely on the relative location of all the other particles. From Equation (9), the brightness is proportional to weight, which can better reflect the quality of particle position through the weight.
In the traditional FA, all of the individuals will move toward the brightest individual. Nevertheless, in the initial stage, the ability of low-brightness individuals to move toward the brightest individual is weak, resulting in poor optimization effect. To solve this problem, a local search strategy is adopted. First of all, the particle fitness is sorted in a descending order, and the particle with the best fitness value in the particle group is recorded as l. Next, the particle population is divided into m groups, each group contains n particles, satisfying the relationship m * n = N.
During this progress, the first particle enters the first group, the second particle enters the second group, particle m goes to the mth group, particle m + 1 goes to the first group, and so on until all particles are assigned. Each group has the particle with the best fitness value as l and the particle with the worst fitness value as w. Accordingly, the position of the particle X w is adjusted as follows: where r represents a random number that takes a value between 0 and 1 (2) The position of particle X w moves from the past position to the new position as determined by the following equation: where α ∈ ½0, 1 is the step size factor and ε is a random number that the Gaussian distribution X w′ represents the new position of the updated particle. When the number of iterations is relatively small, the distance Δ is relatively large. As the number of iterations increases, the weight difference between the particle w and particle l in the group is relatively reduced. To avoid the concentration of particles around the particle l, a decreasing function is added to reduce the moving distance with a cosine characteristic. After all the groups have completed the local research, calculate the corresponding fitness value. Then, remix all particles of the group, reorder and divide the groups, and perform the local search again. Repeat the update process until the preset number of iterations is completed.

Global Search Strategy.
After the optimization within the group is completed, we regard the particle object as a cluster and merge the cluster afterward according to the similarity in the particle weights. The process is repeated to find the cluster with the best particle weight and find the center position X g of the cluster.
Then, compute the attractiveness β between the current particle i and the center particle g according to the equation: where r ig is the distance between the ith particle and the optimal the gth particle. As we can see from Equation (12), the attractiveness of the ith particle depends on the distance between the ith and gth particles. When the distance between the ith and gth particles is comparatively long, the attractiveness between them will increase. Otherwise, the attractiveness will decrease. This strategy can dynamically adjust the visible range of particles and further the search accuracy. Subsequently, position estimations can be updated according to the equation: where X t i and X t j are the position of the firefly i and j at t time, α t ∈ ½0, 1 is the step size factor, and δ refers to the random factor obeying a uniform distribution in [0, 1].
According to the two optimal strategies, the particle can satisfy the right distribution stage and prevent the particle from falling into the local optimum.

Experiment Setting and Evaluation
4.1. Experiment Setting. The UWB hardware we use to test our approach is compliant with IEEE 802.15.4-2011 UWB standard and consists of multiple anchor node (UK100) and one mobile (tag) node (UM208). Its performance indicators are shown in Table 1. The positioning experiment adopts a 2D model. The channel frequency and data rate of the UWB communication are configured to 3.8 GHz and 110 kbps, respectively, to maximize the covered area of UWB nodes. Under the configuration, the UWB anchors report ranging measurements between the anchor nodes and the mobile node at 3.5 Hz. In this paper, the experiments have been conducted in the laboratory of Southeast University with a hall that occupies an area of approximately 10 × 15 m 2 . Four anchor nodes and one mobile anchor are used in this experiment. The distance between the anchor node and mobile node is measured by two-way ranging time-of-flight (TOF). All ranging measurements and timestamps are transmitted to the laptop via WIFI.
We arrange the experimental environment according to Figure 1. Among them, A1-A4 are anchors. We measure and record the 2d coordinate of the anchor as shown in Table 2. When four positioning base stations are installed, the UWB positioning area can cover a relatively large area, generally up to about 8 to 20 meters. In the deployment of the base station, to minimize the influence of pedestrians or other objects on the signal, the positioning system installs the positioning base stations on a chair at a certain distance from the ground and ensures that they are at the equivalent height. The IF-PF algorithm is mainly used to boost the performance of dynamic tracking; for that reason, the experimental scheme is designed as a curved path. The curved path is relatively simple, along which the experimenter walks around the whole experimental field with a moving trajectory similar to a rectangle. P1-P6 are trajectory points in the path. Table 3 shows the coordinates of each point. The experimenter holds a UWB tag, walks at a normal walking speed, and starts from P1, then passes through P2, P3, P4, P5, and P6 in turn, which is shown by the red arrows in Figure 1. Throughout the calculation process, all of the initial values for the algorithms are given by the reference trajectory.

Result
Analysis. This section compares the tracking performances of Taylor, EKF, PF, and IF-PF under an identical path. The positioning error is defined as the distance from the estimated position to the actual position at each test point. The x-axis error is defined in Equation (14) and the y-axis error in Equation (15).
Journal of Sensors where x error and y error represent the x-axis error and y-axis error, respectively,x is the calculated position in X direction, and x is the actual position in X direction. Similarly,ŷ is the calculated position in Y direction and y is the actual position in Y direction. Figure 2 shows the reference trajectory along the path and the different positioning results obtained based on the various algorithms. The trajectory formed by the greentriangle line is the solution consequence of the Taylor, the blue-star is the result of EKF, and the white-circle line is the result of PF. And the red line indicates the reference trajectory along the path, and the red-triangle line represents the result of the IF-PF. Meanwhile, the red solid circles are the positions of the four UWB anchors.
It can be seen from the trajectory in Figure 2 that all four algorithms can realize the positioning and tracking of the experimenter. For the reason that holding the UWB mobile node on the side of the experimenter body will bring about a large NLOS error, the positioning results of the four algorithms all deviate from the same direction. When there is another NLOS disturbance from the outside, the positioning result of Taylor and EKF algorithm will have some jump points while the IF-PF algorithm can smooth the data so that the position jump can be corrected. In comparison with the traditional PF algorithm, the overall effect of the IF-PF algorithm is close to the real motion trajectory. We can believe that the IF-PF is effective to resist the effect of outliers. To prove this effect, a trajectory point at a certain moment in the experiment is analyzed.
The particle distribution in PF, FPF, and IF-PF algorithms at a certain moment is shown in Figure 3. It can be seen that the particle distribution is loose due to the NLOS error. In the FPF algorithm, the particle distribution is tighter than the initial state, which is because the particle being     5 Journal of Sensors far away from the real position can be attracted by the particle with high weight in the firefly particle filter. However, since the distance between the particle with high weight and particle with low weight is too far, the attraction is weak. IF-PF introduces a local search strategy to enhance the movement ability of particles in the initial stage. It can be seen that compared with PF and FPF, IF-PF can better resist NLOS interference and make particles closely surround the real position. Figure 4 shows the time series of position errors in the x -axis and y-axis directions for the four algorithms, and the x -axis represents each sampling point. In the figure, we can see that the positioning error using our proposed algorithm is small. Furthermore, a comparison with other algorithms for range estimation shows that the average error has been significantly reduced. Comparatively speaking, IF-PF is more robust than PF, EKF, and Taylor especially when there is a large error in the observations.
To determine the location efficiency, we have implemented the empirical cumulative distribution function (CDF) of the location error of the four algorithms, as shown in Figure 5. As shown in the figure, there is a high reduction in the percentage x-axis location error of our IF-PF at CDF of 0.3, 0.4, and 0.5 compared with the other algorithms.
To quantitatively evaluate the performance of the improved algorithm, four performance metrics (the average  Journal of Sensors error, minimum error, maximum error, and standard deviation of error) are defined as follows: e min = min e 1 , e 2 , ⋯, e n ½ , ð17Þ e max = max e 1 , e 2 , ⋯, e n ½ ð18Þ where e, e min , e max , and e σ are the average error, minimum error, maximum error, and standard deviation of the error, respectively. As shown in Table 4, it can be seen that the maximum positioning errors in the x-axis and y-axis are 0.3229 m and 0.3333 m, respectively, when the IF-PF is used. As a comparison, the maximum positioning errors in the x 7 Journal of Sensors -axis and y-axis can reach 0.5723 m and 0.4850 m, respectively, when the PF is applied, and the error of 70% in IF-PF is less than 0.2 m; that is, under the given conditions, IF-PF can control the error within 0.17 m, while that of PF is 0.28 m, EKF exceeds 0.32 m, Taylor is 0.33 m. We can find that the average positioning accuracy of the IF-PF algorithm reaches about 0.17 m, which is about 36% higher than PF, about 44% higher than EKF, and about 45% higher than Taylor. The positioning accuracies are different. Furthermore, the IF-PF algorithm is less susceptible to NLOS.
As can be seen from Table 4, the average error can well reflect the positioning accuracy of each algorithm. Consequently, the average error can be selected as precision measure of the corresponding algorithm. Then, the positioning accuracy of the two algorithms under different particle numbers is analyzed, as shown in Table 5.
It can be seen from Table 5 that with the increase of the number of particles, the average error of both algorithms shows a decreasing trend, which is consistent with the theory that the more particles the algorithm has, the higher the estimation accuracy will be. When the number of particles increases from 250 to 450, the accuracy of PF is improved more obviously than that of IF-PF. However, when the particle number is 250, the positioning error of IF-PF is lower than that of PF when the particle number is 450. This is because although the increase in the number of particles improves the positioning accuracy, the resampling adopted by PF will lose particle diversity, leading to particle impoverishment. In contrast, the IF-PF algorithm introduces multistage optimization strategies to improve the particle distribution state, increase the number of effective particles, weaken the sample impoverishment problem, and greatly reduce the number of required particles. In summary, the IF-PF algorithm proposed in this paper has higher comprehensive efficiency.

Conclusions
This paper takes the particle filter algorithm applied in indoor UWB positioning as the research topic. Targeting the problem of significant positioning error caused by particle impoverishment in the conventional Monte Carlo positioning method, the IF-PF algorithm is proposed which is applied in indoor UWB positioning. In this algorithm, the local and global strategies are used to make the particles move to the high likelihood region adaptively before weight updating, avoiding the problem of particle impoverishment caused by a large number of low-weight particles being replaced by high-weight particles, thereby improving the quality of the particles. The problem of particle impoverishment is effectively weakened. Therefore, the IF-PF algorithm has significantly reduced requirements for the number of particles under the same positioning accuracy. Test results show that our method can achieve better and more stable positioning performance by comparison with the original positioning algorithm, and the positioning accuracy reaches about 0.17 m. A future work will concentrate on adding NLOS ranging modeling to improve positioning accuracy across the board.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
The authors declare that there is no conflict of interest regarding the publication of this paper.