Indoor Positioning System Using Artificial Neural Network With Swarm Intelligence

The global positioning system is the most popular outdoor positioning system; however, it is inapplicable to indoor environments. In this study, we created a hybrid algorithm, which applies an artificial neural network to resolve the problems of indoor positioning and a swarm-intelligence algorithm to perform the time-consuming task of adjusting parameters. Experiment results demonstrate that the positioning accuracy of the proposed hybrid algorithm is equivalent to the exhaustive method with search times that are far shorter.


I. INTRODUCTION
Internet-of-Things (IoT) has been a technology that is extensively being used in various fields such as safety, transportation, industrial, healthcare and building [1]- [3]. In the world of IoT, location tracking becomes the next frontier. Location tracking for humans is already becoming an integral part of our lives, especially for navigation and safety [2], [4]. The global positioning system is the most popular outdoor positioning system; however, the direct-view transmission requirement precludes its application in indoor environments [5]- [7]. In this study, we used an artificial neural network (ANN) to resolve the problem of indoor positioning. ANNs are used in a wide range of applications, such as those encountered in image and signal processing [8]; however, optimizing the parameters often can be time-consuming. In recent years, swarm intelligence, an integral part in the field of artificial intelligence, is gradually gaining prominence in various researches [9], [10]. Swarm-intelligence algorithms with a combination of ANN model have been considered and developed in many areas with high reliability [11]. We therefore employed a swarm-intelligence algorithm to optimize the parameters in the ANN. A similar approach was adopted in [12], where the Bat algorithm (BA) was used to optimize the number of neurons in the hidden layer of a neural network. It was also used to adjust the The associate editor coordinating the review of this manuscript and approving it for publication was Ilsun You . learning rate and inertia in predicting the output power of grid-connected photovoltaic systems. In [13], particle group optimization was used to optimize the learning rate and the number of neurons in the hidden layer of a neural network.
This paper applied two types of community intelligence algorithm to neural networks, and then conducted experiments applying the proposed hybrid algorithm to indoor regional positioning and indoor coordinate positioning. Finally, we compared the experiment results with those obtained using the conventional exhaustive method.
The remainder of this paper is organized as follows. Section II outlines signal propagation channel models and swarm algorithms. Section III presents the proposed swarm optimization algorithms for localization. Section IV presents our experiment results and discusses the performance of various positioning systems. Conclusions are drawn in Section V.

II. BACKGROUND A. LOGNORMAL SHADOWING MODEL
The lognormal shadowing model can be used in outdoor and indoor environments [14], [15], wherein path loss is calculated as follows: where PL (d) refers to path loss for the distance between the transmitter and the receiver, d 0 is the close in distance, and ''close-in distance'' is a reference point for the measurement of radio field strength (generally close to the transmitter), n is the path loss exponent (generally determined by the channel environment) [14], and X σ is a random variable with a normal distribution. The random variable has an average value of 0 with standard deviation of σ [14]. The power measured at distance d can be expressed as where P r (d) represents the power measured at distance d and P t is the transmitting power. Combining Eqs. (1) and (2), gives us the following: We adopted the scheme outlined in to determine power A and combined it with Eq. (3) to obtain the following: Equation (4) can be used to simulate the received signal strength over various distances in a variety of environments.

B. FINGERPRINTING TECHNIQUE
Fingerprinting involves mapping the relationship between RSSI and a real-world location within the positioning environment [16], [17]. Fingerprinting can generally be divided into an offline phase and an online phase [7], [16], [17]:

1) OFFLINE PHASE
The offline phase involves collecting the features and locations of various points in the positioning environment in order to establish a radio map.

2) ONLINE PHASE
The online phase involves inputting unknown data in order for the algorithm to estimate the position of the target.

C. PARTICLE SWARM OPTIMIZATION
The particle swarm optimization (PSO) algorithm is a swarm-intelligence algorithm proposed by Yang et al. [18], Kennedy and Eberhart [19], del Valle et al. [20], and Tsujimoto et al. [21] inspired by the foraging behavior of birds. PSO is based on the sharing of experiences and information between individuals in order for the group to gradually move toward an ill-defined but beneficial goal [21]. The updating formulas for velocity and position used in PSO are respectively presented as follows: where t is the iteration index and i is the individual index. The particle position for the i-th individual of the t-th iteration is represented as X t i , whereas the current speed of the i-th individual of the t-th iteration is recorded as V t i . Note that c 1 and c 2 are acceleration coefficients, w is the inertia weight coefficient, rand is a random number between [0,1], pbest i refers to the best position experienced by the i-th particle, gbest refers to the best position experienced by all particles, and V max is the maximum speed of individuals [20], [21]. V max determines the resolution (or precision) of the area between the current position and the best position. If V max is too high, the particles may fly through the solution, and if V max is too small, the particles cannot be explored enough, which leads to a local figure of merit. This restriction has three purposes: to prevent computational overflow; to implement artificial learning and attitude changes; to determine the granularity of the search for problem space. The inertia weight w keeps the particles inertia, which makes them have a tendency to expand the search space and has the ability to explore new areas. The acceleration constants c 1 and c 2 represent the weights of the statistical acceleration terms that push each particle toward the pbest i and gbest positions.

D. GRAY WOLF OPTIMIZER
The grey wolf optimization (GWO) algorithm is a swarmintelligence algorithm developed by Mirjalili et al. [22] and Das et al. [23], in which individuals are assigned different social status levels from top to bottom as follows: leader (α), deputy (β), and subordinates (δ and ω). In assessing search outcomes, α, β, and δ represent the first, second, and third best solutions, whereas all of the other inferior solutions are designated ω. During the search process, each individual is guided by α, β, and δ in the process of updating their position, as shown in Fig. 1. During the hunt, the prey is surrounded by the wolves, the process of which can be modeled mathematically as follows: where − → D is the distance between the individual and the prey, t is the iteration index, − → X p is the position of the prey, − → X is the position of the individual, and − → A and − → C are coefficients respectively defined as follows [24]: where − → r 1 and − → r 2 are random number between [0, 1] and − → a decreases linearly from 2 to 0 through each iteration. The position of an individual is updated based on the positions of α, β, and δ as follows: After calculation of (11), − → D α , − → D β and − → D δ can be obtained, and then substituted into (12), then − → X 1 , − → X 2 and − → X 3 can be obtained, and then − → X 1 , − → X 2 and − → X 3 are substituted into (14), − → X (t + 1) can be obtained.
− → X (t + 1) is the position to which the individual will move during the (t + 1)th iteration.

E. ARTIFICIAL NEURAL NETWORK
Artificial neural networks (ANNs) are one approach to artificial intelligence (AI) [25], [26] which simulate the behavior of biological brains based on a system of interconnected neurons used to compute values from inputs. They represent a form of machine learning, which have proven particularly effective in pattern recognition. Back-propagation neural networks employ the fine-tuning of weights within a neural net based on the error rate obtained in the previous epoch [27] (i.e., iteration). The weights are tuned with the aim of reducing error rates in order to make the model more reliable. The ultimate objective is to identify the weights that would allow the neural network to map arbitrary inputs to outputs. The first step involves determining the number neurons in the input layer, hidden layer, and output layer. Assume that the hidden layer is a single layer with j neurons, the neurons in the output layer indicate the training position, and the number of neurons in the output layer is indicated by k. Figure 2 presents the architecture of a typical back-propagation neural network.
The Back Propagation Neural Network first calculates the output of each hidden neuron, as follows: (14) where the function of f is the hyperbolic activation function defined as where net I i is the i-th neuron of the input layer and the data of the neuron in the input layer is the actual input of the network as well as the output of the neuron; net H i refers to the j-th neuron of the hidden layer; w ij refers to the weighting between the i-th neuron of the input layer and the j-th neuron of the hidden layer; I max is the total number of neurons in the input layer; and H max is the total number of neurons in the hidden layer. The output of each neuron in the output layer is then calculated as follows: where net O k is the k-th neuron of the output layer, and w jk is the weighting between j-th neuron of the hidden layer and k-th neuron of the output layer. This output is the actual output of the network. The BPNN adjusts the weighting of the network according to the error between the expected output and the actual output of the network.

F. STANDARDIZATION
Before training the neural network, the input data undergoes preprocessing to obtain an average value of roughly 0 and reduce the standard deviation in order to reduce the likelihood of weight divergence during training [28]. Preprocessing also reduces the likelihood of producing infinity or negative infinity cases. The preprocessing method used in this paper is standardization, the mathematical formula of which is as follows: where µ is the average of the original data set, σ is the standard deviation of the original data set, x is the original data, and x is the result after standardization [28], [29].

III. METHODOLOGY A. CHANNEL MODEL
In this study, the lognormal shadowing model was used to simulate the channel model in the experimental environment. The signal strength measured by the receiver at distance d 0 was obtained from real-world measurements. The transmitter was a D-Link DIR-600M Wireless N150, and the RSSI receiver was the D1 mini Wi-Fi module. The parameter settings are detailed in Table 1.
Our positioning system was implemented in two experimental environments: and an open environment (Scenario A)   . The open environment is on the top floor of the building, so it is a light of sight (LOS) environment. Scenario A can be attributed to less interference, since the obstacles are less. The complex environment is inside the classroom. The main interference is come from the more obstacles in the classroom. We defined various indoor environments by adjusting the standard deviation of the parameters. A smaller standard deviation (representative of an indoor environment without obstacles) produces a stable model, whereas a larger standard deviation (representative of a complex indoor environment) produces an unstable model.
In the experiment, the environments were simulated as follows: Scenario A (Gaussian random variables with standard deviation of 3dB) and Scenario B (Gaussian random variables with standard deviation of 9dB) These are shown in Table 2 and Figs. 3-4. From the Figs 3-4, the curve in the channel model indicates that an increase in distance reduces the slope of the  curve, particularly at distances exceeding 3 m. This leads to a drop in resolution, which reduces positioning accuracy. Thus, we sought to keep the range of the indoor channel model to within 3 m.

B. EXPERIMENT ENVIRONMENT
According to the channel model in the previous sub-section III.A, the anchor nodes in the experimental map were placed in each of the four corners as well as in the center to reduce uncertainty in regional positioning [30]. The map used in the experiments is shown in Fig. 5.
The experiment was conducted indoors in a square area (length = 3m and width = 3m). In the experiment on regional positioning, the overall map was divided into nine regions (length = 1m and width = 1m).
All training points were generated randomly. Both in the regional and coordinate positioning experiments, we used 1800 data points for training and 900 data points for testing. In regional positioning, the output was the area in which the target was located; in coordinate positioning, the outputs were the x coordinate and y coordinate pertaining to the target.
The sharing of Wi-Fi radio channels by different systems or devices using the same frequency band (e.g., Bluetooth devices and microwave ovens) often results in co-channel interference when multiple devices are operating in the same area. RSSI can be profoundly affected by this interference as well as fading and shadowing. We sought to reduce environmental shadowing effects by performing arithmetic mean filtering during the collection of RSSI values. This involved sampling RSSI values 100 times in the same location and then averaging the results to reduce the impact of signal variation on the positioning algorithm. VOLUME 8, 2020

C. EXHAUSTIVE LOCALIZATION METHOD
We adopted the exhaustive method to determine the best learning rate and optimal number of neurons in the hidden layer, with the aim of maximizing accuracy in regional positioning and minimizing the average distance error, which are respectively defined using Eqs. (18) and (19). Neurons in the hidden layer had a search range of 1 to 100 with a search interval of 1. The learning rate was given a search range of 0.01 to 1 with a search interval of 0.01. In the regional positioning experiment, positioning accuracy was used to evaluate the model. In the accurate positioning experiment, the average distance error between the output coordinates and the target coordinates was used to evaluate the model, as defined in the following two equations: where Accuracy refers to positioning accuracy, Correct_num indicates the number of correct positions in the test sample, and Total_num is the total number of test samples in the test.
where d is the average distance error, n is the total number of test samples, i is the sample index, x is the output of the x coordinate, x is the target output for the x coordinate, y is the output of the y coordinate, and y is the target output for the y coordinate.

D. PROPOSED HYBRID ALGORITHM
In this paper, we formulated a hybrid algorithm to facilitate the search for optimal parameters for the neural network (number of neurons in hidden layer and learning rate). The evaluation of parameters requires a clearly-defined fitness function. For regional positioning, we used the error rate as a fitness function, the mathematical definition of which is presented in Eq. (20). For accurate positioning, we used the average distance error between the calculated and target coordinates as a fitness value, the mathematical definition of which is presented in Eq. (19).
where Errorrate refers to the positioning error rate, Error_num indicates the number of times the localization region is wrong during a given test, and Total_num is the total number of test samples in the overall test process. Hybrid algorithm:

Particle Swarm Optimization in conjunction with ANN
(PSO-ANN) [12], [13] In the proposed scheme, the PSO algorithm is used mainly to determine the best learning rate and optimal number of neurons in the hidden layer of the neural network.
The flow of the proposed PSO-ANN algorithm can roughly be divided as follows: 1. Initialize all individual locations. 2. Grey Wolf Optimization in conjunction with ANN (GWO-ANN) [12], [13] The GWO algorithm is used mainly to identify the best combination of neural network learning rate and number of neurons in the hidden layer.
The flow of the proposed GWO-ANN algorithm can roughly be divided as follows: 1.

IV. EXPERIMENT RESULTS
The process of the main experiment is divided into the following steps: 1. As described in Section III, we first obtained the RSSI values within a square interior space 3m × 3m. Training data (1800 data points) and test data (900 data points) were generated randomly.
2. We saved the training and test data. 3. We executed the training process using the exhaustive method, GWO-ANN, and PSO-ANN for comparison.
A. RESULTS FOR REGIONAL POSITIONING In regional positioning, there were 5 neurons in the input layer of the neural network; there were 9 neurons in the output layer, representing 9 regions; and RSSI values were received from 5 anchor nodes. The activation function of the hidden layer used ReLU, and the activation function of the output layer used Softmax. In regional positioning, we implemented the exhaustive method, PSO-ANN, and GWO-ANN. Table 3 and Table 4 respectively shows the details of the 84252 VOLUME 8, 2020  parameter settings of PSO-ANN and GWO-ANN for regional positioning.
The exhaustive method was implemented using sample data collected in Scenario A and B. The objective was to identify the optimal combination of learning rate and the number of neurons in the hidden layer. The learning rate was given a search range of 0.01 to 1. The search interval for the learning rate was 0.01, whereas the search interval for the number of neurons was 1. Following the experiment, the learning rate, the number of hidden layer neurons, and their relationship with positioning accuracy were assembled as a three-dimensional graph, for use in identifying the optimal combination of parameters, as shown in Fig. 6 (Scenario A) and Fig. 7 (Scenario B).
Under Scenario A, the exhaustive method achieved maximum positioning accuracy of 94.22% within a search time of 40,764 seconds. Under Scenario B, maximum positioning accuracy dropped to 88.11% within a search time of 40,845 seconds.
The experiments using the PSO-ANN algorithm included 5 or 10 individuals. The number of iterations of the batch-size and neural network were set to 500, and the number of iterations of the hybrid algorithm was set to 50. In setting the parameters for PSO, we referred to the suggestions in [20], where c 1 and c 2 were respectively set at 2, the maximum   inertia weight was set at 0.9, and the minimum inertia weight was set at 0.4. Throughout this iterative procedure, the inertia weight was reduced linearly from the maximum value to the minimum. VOLUME 8, 2020   The PSO-ANN algorithm was run ten times (Models 1-10) and the average error rate values were recorded. Figures 8 and 9 respectively present the results for 5 and 10 individuals in Scenario A. Figures 10 and 11 respectively present the results for 5 and 10 individuals in Scenario B. We observed a decrease in the error rate with an increase in the number of iterations, thereby demonstrating the effectiveness of hybrid algorithm. The superior performance achieved under Scenario A can be attributed to less interference.
Similarly, the experiments using the GWO-ANN algorithm were also conducted using 5 or 10 individuals. Figures 12 and  13 respectively present the results for 5 and 10 individuals in Scenario A. Figures 14 and 15 respectively present the results for 5 and 10 individuals in Scenario B.
From the results summary in Table 5, we can see that under Scenario A, positioning accuracy of the hybrid algorithms    the baseline differed by less than 1%. The average search duration using the PSO-ANN was 97.39% less than the exhaustive method when using 5 individuals and 94.94% less when using 10 individuals. The average search duration using the GWO-ANN was 97.47% less than the exhaustive method when using 5 individuals and 94.86% less when using 10 individuals.   As shown in Table 6, under Scenario B the positioning accuracy of the hybrid algorithms and the baseline differed by less than 1%. The average search duration using the PSO-ANN was 97.48% less than the exhaustive method when using 5 individuals and 95.11% less when using 10 individuals. The average search duration using the GWO-ANN was 97.53 less than the exhaustive method when using 5 individuals and 94.97% less when using 10 individuals.

B. RESULTS OF POSITIONING ACCURACY
In estimating coordinate positioning accuracy, we used 5 neurons in the input layer of the neural network with the RSSI values of 5 anchor nodes as an input, with 2 neurons in the output layer. The x coordinate was used as an output, and the y coordinate used a hidden layer. The Sigmoid function was the activation function in the hidden layer, whereas the   identity function was used in the output layer. Analysis was performed on the exhaustive method, PSO-ANN, and GWO-ANN. The number of iterations of the batch-size and neural network were set to 500, and the number of iterations of the hybrid algorithm was set to 50. In setting the parameters for PSO, we referred to the suggestions in [20], where c 1 and c 2 were respectively set at 2, the maximum inertia weight was set at 0.9, and the minimum inertia weight was set at 0.4. Throughout this iterative procedure, the inertia weight was reduced linearly from the maximum value to the minimum. Table 7 and Table 8 respectively shows the details of the parameter settings of PSO-ANN and GWO-ANN for coordinate positioning.
The summarized results in Table 9 reveal that under Scenario A, the average positioning error of the hybrid algorithms and the baseline differs by less than 0.01 meters. The VOLUME 8, 2020 average search duration using the PSO-ANN was 97.52% less than the exhaustive method when using 5 individuals and 95.08% less when using 10 individuals. The average search duration using the GWO-ANN was 97.55% less than the exhaustive method when using 5 individuals and 95.08% less when using 10 individuals.
As shown in Table 10, under Scenario B the average positioning error of the hybrid algorithms and the baseline differs by less than 0.01 meters. The average search duration using the PSO-ANN was 97.54% less than the exhaustive method when using 5 individuals and 95.07% less when using 10 individuals. The average search duration using the GWO-ANN was 97.54% less than the exhaustive method when using 5 individuals and 95.09% less when using 10 individuals.
The results in Tables 5, 6, 9, 10 show that the exhaustive method achieved the highest accuracy; however, the time cost was far too high. Furthermore, the accuracy of the exhaustive method was less than 1% higher than the average accuracy obtained using the hybrid algorithm. The performance of the hybrid algorithm with 10 individuals was higher than with 5 individuals; however, the average search time was nearly double, and the performance improvement was less than 1%. In regional positioning, the best overall tradeoff between accuracy and time cost would be the hybrid GWO-ANN algorithm with 5 individuals, which provides higher average accuracy than PSO-ANN with lower time cost.

V. CONCLUSION
In this paper, we augmented a neural network algorithm with two swarm-intelligence algorithms (particle swarm optimization and the gray wolf algorithm) to identify the optimal combination of learning rate and number of hidden neurons. We then assessed their performance in localization accuracy using the exhaustive method as a baseline. Overall, the magnitude of the errors decreased with an increase in the number of iterations. Under identical conditions, the hybrid algorithms achieved the same results as the exhaustive method (difference of less than 1%/0.01 meters); however, the proposed scheme reduced the average search duration by roughly 95%. In future research, we will seek to determine whether the performance of the hybrid algorithm could be improved through the adoption of additional parameters.