Abstract
Received Signal Strength Indication (RSSI) fluctuates with the change of indoor noise, resulting in a large positioning error of the trained Back Propagation Neural Network (BPNN). An adaptive indoor positioning model based on Cauchy particle swarm optimization (Cauchy-PSO) BPNN is proposed to solve the problem. In the off-line training phase, the signal with less noise intensity acquired in a good environment is selected as the original training set in the localization phase. The variance of the received set of signals is used as a measure of the noise intensity of the current environment. In the localization phase, the variance of each set of signals received is calculated at equal intervals. If the variance of adjacent intervals differs significantly, the system adjusts the original training set data according to the current noise intensity and re-trains the BP model online. Meanwhile, the particle swarm optimization algorithm using Cauchy variance to optimize the BP network tends to fall into the disadvantage of local optimum. Considering that the collected fingerprint database may generate “high-dimensional disasters”, Principal Component Analysis (PCA) is used to select and downscale the features of the wireless Access Point (AP). The proposed adaptive localization model can be trained online. The improved Cauchy-PSO algorithm and data dimensionality reduction can further improve the localization accuracy and training speed of the BP model. The experimental results show that the adaptive indoor localization model has strong adaptive capability in a noise-varying environment.
Introduction
With the increasing demand for indoor positioning services, a variety of positioning techniques have been applied in the fifield of indoor positioning. Among them, location fifingerprint-based matching techniques such as cellular signals and Wi-Fi signals have become the focus of research on indoor positioning due to their advantages of high positioning accuracy, high feasibility, low cost, and no additional hardware investment [1–6]. In recent years, a variety of positioning algorithms have been proposed [7–10]. There are also many examples of combining neural networks with RSSI [11–15], among which, the BPNN-based RSSI localization approach is widely used [16–18]. However, the traditional BPNN-based localization algorithm has limited adaptability. Due to the complexity of the indoor environment and the randomness of people, the RSSI will be affected by noise, resulting in a large positioning error of the trained BPNN [19–21]. Besides, the BPNN localization model has some shortcomings, such as slow convergence speed and easy falling into local optimum, for which several scholars have proposed improvements to the relevant localization algorithms.
A method combining the annealing algorithm with the genetic algorithm is proposed in [22] to optimize the neural network and apply it to an indoor location. Compared with the traditional model based on the BPNN, the positioning accuracy of RSSI is improved by about 60%. In [23], the PSO-BP algorithm is proposed, which is used to optimize the shortcomings of BPNN and improve the indoor positioning accuracy. A new ranging model is proposed in [24], using a genetic algorithm to optimize the initial values of weights and deviations of the BPNN, which improves the positioning accuracy of this model. In [25], the advantages of genetic algorithm and particle swarm optimization algorithm are expounded and combined to make up for the shortcomings of the traditional BPNN algorithm. These studies have made innovations in BPNN and RSSI positioning, and provided many improvement directions, but they did not consider the changing factors of indoor environment.
In this paper, an adaptive indoor positioning structure based on Cauchy-PSO improved BPNN is proposed. This algorithm can make up for the influence of environmental changes in indoor positioning. First, we use PCA to reduce the dimensionality of the collected fingerprint database to improve the training speed of the BPNN. Then an adaptive BP model is constructed. The BPNN under this model can be changed according to the change of environment, which ensures that the current BPNN can adapt to the current environment. Finally, the shortcomings of BPNN are optimized by Cauchy-PSO algorithm. The overall architecture diagram is shown in Fig. 1.

The overall architecture diagram.
The structure of this paper is as follows: Section 2 introduces the PCA dimension reduction algorithm. Section 3 introduces the adaptive BP model. Section 4 introduces the Cauchy-PSO algorithm and the Cauchy-PSO-BP positioning model. Section 5 describes the experiment and discusses the results obtained, and section 6 summarizes the paper.
PCA is a data dimensionality reduction algorithm, which can reduce the dimensionality of high-dimensional data to a lower dimension on the premise of retaining the original data features [26–28]. The PCA algorithm can maintain the uniformity of data dimensionality. Although the data contains less information after dimensionality reduction, the dimensionality reduction is more beneficial to the system and speeds up the processing of data. PCA is used to reduce the dimension of (x (1) , x (1) , …, x (m)) with m n-dimensional data sets.
Step 1: Use (1) to center each sample feature.
Step 2: Calculating the covariance matrix of the sample and decompose the eigenvalue.
Step 3: Extracting the eigenvectors corresponding to the largest eigenvalues, then all the feature vectors are standardized to form the feature vector.
Step 4: Calculate the new sample after dimension reduction and obtain the dimensionality reduction result.
BP neural network (BPNN) model
BPNN is a multi-layer feedforward neural network. The basic idea of its algorithm consists of forward propagation of signal and backward propagation of error. The error is minimized by constantly changing the weight and threshold of BPNN. Forward propagation is the propagation process of signals from the input layer through the hidden layer and finally to the output layer, while reverse propagation is the opposite. In this propagation process, the initial weights and thresholds of each layer of the neural network are constantly adjusted, so as to achieve the purpose of training the neural network [29]. Figure 2 shows the schematic diagram of the double hidden layer BP. In order to express the process of back propagation conveniently, a cost function (2) is defined.

Adaptive positioning model.
The acquired signal is reduced in dimension by PCA and stored in the memory. If the signal value is not collected for 10 times, the BPNN is used for positioning. After collecting the signal values for 10 times, the memory starts to calculate the variance of the current signal. The larger the variance, the more serious the noise in the current environment. This process is called environmental noise intensity detection. If the variance of the current signal is quite different from that of the BP training set signal, it means that the BP model after the last training is no longer suitable for the current environment. Therefore, it is necessary to readjust the BP training set data to make it fit the current environment, then retrain the BP model. Weighted K-Nearest Neighbor (WKNN) is used for positioning temporarily in the process of BPNN training and the positioning of BPNN is resumed after the training of the model. At this time, the trained BPNN is more suitable for the current environment. Figure 3 shows the adaptive positioning model based on BPNN.

BP double hidden layer feedforward network.
Off-line training stage: Each positioning point repeatedly collects multiple sets of data when the environmental (e.g., at night) noise is low. The average value is calculated and used as the original training set of BP model. Figure 4 is the flow chart of offline training stage.

Off-line training phase.
On-line training stage: After noise detection, the original training set data will be added with corresponding Gaussian noise if the BPNN needs to be retrained. The purpose of this step is to make the noise intensity of the training set match that of the current signal, and then the training data set will be used to train the BPNN. In the training stage, WKNN is used for positioning. Figure 5 is the flow chart of online training stage.

On-line training phase.
If the BP model does not need to be retrained after noise detection, or the RSSI values are not collected for 10 times in the memory, then the BPNN is directly used for positioning; if the BPNN needs to be retrained, the WKNN is used for positioning. Figure 6 is the flow chart of online positioning stage.

On-line positioning stage.
Cauchy-PSO algorithm
In the traditional particle swarm optimization algorithm, some particles are initially generated. X
i
= (xi1, xi2, ⋯ , x
iD
) is the position vector of particle i, V
i
= (vi1, vi2, ⋯ , v
iD
) represents the velocity vector of particle i, where D represents the dimension of particle space. The algorithm gets the optimal solution through repeated iterations, and each iteration updates the values of Pbest and Gbest [30, 31]. Pbest is the historical optimal position of particle i, Gbest is the optimal position of the whole group. The particle position matrix and velocity matrix are updated by the following formula:
In this paper, Cauchy mutation probability is set to 0.5. When δ < 0.5, Cauchy mutation is introduced to disturb the position of particle swarm. Equation (8) is the calculation method of Cauchy operator.
Equation (9) is the way Cauchy variation disturbs the particle position.
Step 1: Initializing particle swarm parameters to generate particle swarm.
Step 2: Calculate the particle fitness, and determine the individual optimal P best and the global optimal G best .
Step 3: Update the position matrix and speed matrix.
Step 4: Calculate the aggregation degree of particle swarm and judge whether Cauchy variation exists.
Step 5: Judging whether the algorithm meets the loop end condition, if so, executing step 6, otherwise, returning to step 2 and continuing to execute step 2 to step 5.
Step 6: Outputting the global optimal G best and particle position vector, and ending the algorithm.
Firstly, the initial weights and thresholds of BPNN are normalized. Then the Cauchy-PSO algorithm is applied to iteratively optimize the position of the optimal particle. The optimal particle position is used as the initial weight and bias of the training BPNN. Finally, the training model is output and applied to RSSI positioning. Figure 7 is the flowchart of Cauchy-PSO-BPNN algorithm.

Flow chart of Cauchy-PSO-BP network model.
The whole algorithm flow includes generating dataset, training the BPNN model, and testing the positioning output.
Generating dataset: Generating a set of original data sets when noise intensity is low, and removing “high-dimensional redundancy” through PCA dimension reduction.
Training BPNN model: Use RSSI value after PCA dimension reduction as training set to train BPNN model.
Test positioning output: Calculate the current noise intensity. If it does not match the noise intensity in the training stage, retrain the BPNN model and use WKNN for temporary localization.
Experiment results and analysis
In this paper, the performance of the positioning algorithm is tested and verified by virtual simulation. The data set is generated according to the logarithmic path loss model (10). In (10), P r (d) and P r (d0) respectively represent the received power at the distance between the test point and the wireless access point of d and d0. n is the path attenuation factor, which is related to the specific environment. X is a Gaussian random variable with an average value of 0.
Usually, d0 is 1m, P r (d0)is the received signal strength value of the receiving node 1m away from the transmitting node. The propagation model can be simplified as (11) [34]:
In this experiment, A = -41.3dB, n = 1.58, according to the above loss model, firstly, a 10 m × 10 m virtual environment is generated by MATLAB. The distance between adjacent receiving points is 1 m, the layout of beacon nodes is arc triangle layout model [35], and the distance between adjacent beacon nodes is 5 m. The area surrounded by three arcs is arc triangle. The layout of beacon nodes is shown in Fig. 8. A total of 149 location points are selected by removing the beacon nodes on the location points.

Schematic diagram of AP location.
In Fig. 8, AP5 and AP8 are adjacent to each other, so they contain similar features. The power of the signal to the receiving point is very weak because AP9 and AP10 is far from the positioning point. The existence of AP5, AP9 and AP10 causes the redundancy of fingerprint database. Therefore, PCA is used to reduce the dimension of fingerprint database.
PCA experiment preparation
Firstly, in a virtual model with 10 APs, each location point is sampled 100 times repeatedly. Gaussian random noise is added to the sampled RSSI values, the first 80 times as the training set and the last 20 times as the test set.
Impact of fingerprint database degradation on localization
The influences include: the energy ratio of different AP numbers, the training speed of BPNN and the positioning error. The reduced fingerprint database is used as the training set of BPNN. Figure 9 shows the positioning error based on BPNN under different numbers of access points. It can be seen from Fig. 9 that the positioning accuracy increases slightly when beacon nodes are added. The ratio of energy contained in different AP numbers and the training time required when BPNN training times are 1000 are shown in Table 1. According to the ratio of energy in Table 1, seven APs already contain 99.89% of the total energy, which shows that AP8, AP9 and AP10 hardly play any role in the positioning process and they also cause the redundancy of fingerprint database. In terms of training time, dimensionality reduction of fingerprint database can improve the training speed of BPNN. From the aspect of positioning error, adding AP is equivalent to increasing the characteristic information of fingerprint database, which can reduce the positioning error. However, the experimental results show that the added AP information is mostly redundant information, which has little effect on positioning and increases the training time of BPNN. Considering that the AP signal with extremely long distance is very unstable in the real environment, and at the same time, the intermittent signal will also cause uneven dimension and dimension disaster in the fingerprint database, so the following experiments all use AP1–AP7 as the positioning signal source.

Positioning error of different number of APs.
Effect of different numbers of AP on positioning
BP model initialization
After PCA dimensionality reduction, AP1-AP7 are used as positioning signal sources, so the number of input layer nodes of BPNN is seven. The positioning results are output in the form of coordinates, so the number of output layer nodes of BPNN is 2. The number of hidden layer nodes directly affects the positioning effect of BPNN. Through many positioning tests and analysis, the positioning effect is the best when the number of hidden layer nodes is 13. Based on the above analysis, the number of nodes in the input layer, hidden layer and output layer of BPNN is determined to be 7, 13 and 2, respectively. The training times are 1000 times, the learning rate is set to 0.1, the training target error is 10-5, and the activation functions of the hidden layer and the output layer are tansig and purelin functions respectively.
Localization error of adaptive BP model and other models
Considering personnel activities and other factors, the noise power intensity will be different in different time periods in a day. According to the difference of personnel flow in each time period, a day is divided into four time periods, which are 6:00–8:00, 8:00–18:00, 18:00–22:00, and 22:00–6:00 the next day, respectively. Figure 10 shows the RSSI value of AP1 received by a certain positioning point in a day. As can be seen from Fig. 10, the fluctuation of the received signal power value is the smallest from 22:00 to 6:00 the next day, and the largest from 8:00 to 18:00.

RSSI values at different moments.
According to the above environment, the positioning errors based on BP, PSO-BP and adaptive BP models are compared. In the off-line phase, select the signal with noise intensity in the period of 6:00–8:00 as the training set. In the on-line phase, the signals of different time periods in a day are selected as test sets. After the model training is completed, the three models are predicted and positioned respectively.
Figure 11 shows the positioning errors when 6:00–8:00, 8:00–18:00, 18:00–22:00 and 22:00–6:00 are taken as test sets, where AI-BP is an adaptive positioning model. When the noise intensity changes little, the PSO-BP positioning algorithm has high positioning accuracy. However, after the noise intensity changes, the AI-BP positioning algorithm has higher positioning accuracy than the BP and PSO-BP positioning algorithms. Table 2 shows the positioning errors of the three algorithms over different time periods.When the noise changes, compared with the traditional BP algorithm and PSO-BP algorithm, the adaptive BP algorithm has higher positioning accuracy and is more suitable for the noise changing environment. At the same time, because the BP model itself easily falls into the local optimum, it is necessary to optimize the BP algorithm by PSO.

Localization errors of BP, PSO-BP and AI-BP at different time periods.
Comparison of location average errors under different time periods
Cauchy-PSO algorithm is introduced to optimize BPNN, which mainly solves the problems of slow convergence speed, many iterative steps, and easy to fall into local optimal solution.
Cauchy-PSO algorithm initialization
According to the BPNN topological structure diagram, it is determined that the dimension of particles is 132, the population number of particles is 20, c 1, c2 the learning factors are all 1.494, w is set as the nonlinear inertia weight, and the speed and position of each particle are between -1–1.
Location accuracy of Csuchy-PSO algorithm
At first, 20 real positioning points are randomly generated and the generated positioning points may coincide. Then, signals from 18:00 to 22:00 are taken as prediction inputs. Finally, PSO-BP, SA-GA-BP and Csuchy-PSO-BP algorithms are used to predict. The deviation between the predicted point and the real positioning point is shown in Fig. 12, where the red diamond indicates the real position. Figure 13 is an error comparison of three positioning algorithms. Table 3 shows that compared with PSO-BP and SA-GA-BP, the improved BP model of Csuchy-PSO algorithm has smaller positioning errors.

Comparison of location errors of three algorithms.

PSO-BP, SA-GA-BP and Cauchy-PSO-BP location errors.
Comparison of location errors of three algorithms
In this paper, the Cauchy mutation theory is introduced into particle swarm optimization, which reduces the iteration times of particle swarm optimization and improves the convergence speed of BPNN. Figure 14 shows the iteration times and corresponding fitness values of PSO, SA-GA and Cauchy-PSO. Table 4 shows the number of iterations and iteration time required to train the BP model. As can be seen from Fig. 14 and Table 4, compared to the SA-GA algorithm, the Cauchy-PSO algorithm requires more iterations, but the required iteration time is almost the same. And based on the fitness value, the Cauchy-PSO algorithm has a lower fitness value, which further avoids local optimization.
Comparison of iteration times and training time
Comparison of iteration times and training time

Iterative curves of PSO-BP, SA-GA-BP and Cauchy-PSO-BP algorithms.
Since the adaptive positioning structure may train BPNN many times in the positioning process, the speed of training BPNN is the key factor of positioning efficiency. Applying PCA to reduce the dimension of data is an important means to improve the training speed of BPNN. According to PCA test performance experiment, the training speed of BPNN is obviously improved after dimensionality reduction of data. Aiming at the shortcomings of BPNN, using Cauchy mutation particle swarm optimization algorithm to optimize BPNN can effectively reduce the positioning error. However, when the indoor environment changes, it is difficult to reduce the positioning error only by optimizing BPNN with optimization algorithm. Changing BPNN to adapt to the current environment is the most effective way to reduce the positioning error. Figure 15 shows the positioning errors of BP, Cauchy-PSO-BP, AI-BP and AI-Cauchy-PSO-BP in different time periods, where AI-BP is an adaptive BP positioning model and AI-Cauchy-PSO-BP is an adaptive Cauchy particle swarm optimization BP positioning model. Table 5 reveals that the adaptive positioning model can better adapt to the noise changing environment while the BPNN improved by Cauchy-PSO has a smaller positioning error. So the AI-Cauchy-PSO-BP model has both higher positioning accuracy and environmental adaptability.

Localization errors of different algorithms in different time periods.
Comparison of location average errors in different time periods
To make the BPNN localization algorithm have stronger adaptability and higher localization accuracy, this paper improves the traditional BPNN localization algorithm from two aspects and compared with the existing algorithms. Traditional BPNN localization algorithm has limited adaptability in the environment with constantly changing noise. Aiming at the problems, an adaptive BPNN localization structure is proposed. The simulation results show that the adaptive positioning algorithm can effectively compensate for this shortcoming. Compared with the existing positioning algorithms, the adaptive positioning algorithm has higher positioning accuracy in the environment of noise change. Aiming at the problem that BP is easy to fall into the local optimal solution, Cauchy-PSO algorithm is combined with BPNN and applied to personnel positioning. The algorithm optimizes the initial weight and threshold of BPNN, which can further avoid the local optimal problem.
In addition, aiming at the problem that fingerprint database will produce “high-dimensional disaster” and the training speed of BPNN is slow, PCA is used to select and reduce the dimension of AP features. This method can not only make RSSI value in fingerprint database have uniform low-dimensional characteristics, but also meet the demand of adaptive positioning structure for BPNN training speed.Based on the above experiments, this paper analyzes the evaluation indexes such as positioning accuracy, operation efficiency and convergence speed of the improved positioning algorithm. Experimental results show that the algorithm has high positioning accuracy in the environment of changing noise intensity. This paper provides a development idea for the future indoor personnel positioning algorithm.
Footnotes
Acknowledgment
We are grateful to the Project of Young YuYou of North China University of Technology, 2018 and the Research on Key Technologies of accurate positioning of BINGTUAN transportation key vehicles and infrastructure based on Beidou under Grant 2108AB028.
