Abstract

In this paper, we propose an AHP-WKNN method for indoor localization which combines the Analytic Hierarchy Process (AHP) technique and the Weighted -nearest Neighbor (WKNN) algorithm. AHP serves to assign weights when WKNN is employed to select fingerprints for indoor positioning. The AHP technique can reasonably enlarge the influence that the received signal strength (RSS) gap between reference points has on the weights, achieving better performance in positioning. This paper also modifies the adaptive Kalman filter (AKF) noise reduction method by correcting the output based on the error between the RSS measurement and the expected output. The modified AKF can track the changes of RSS more effectively and achieve better performance of noise reduction. The simulation result shows that the proposed AHP-WKNN method and the modified AKF can improve positioning accuracy effectively.

1. Introduction

The demand for high-precision positioning and navigation in the indoor scenario is increasing along with the popularization of the Internet of things. The WLAN-based indoor positioning can fully make use of the widely deployed Access Points (AP) to achieve high positioning performance [1, 2]. So far, the localization based on WLAN has two main methods—the triangulation method and fingerprinting localization. The triangulation method uses the distances between the test point and three known APs to estimate the location of the test point. The distance here is estimated by measuring the received signal strength (RSS) of the APs. This method relies heavily on the accurate signal path loss model. There are a lot of factors that may affect the signal path. The signal path loss model varies under different environments, and building an accurate and suitable model can be very difficult. Therefore, it is very hard to apply the triangulation method based on indoor localization in reality. Recently, the indoor positioning system based on WLAN, which uses fingerprint (formed by the coordinates of the reference points (RPs) and the APs’ signal strength received at RPs) as the recognition method, has become a research hotspot [3, 4]. It involves two phases named the offline phase and the online phase. In the offline phase, the main task is to build a fingerprint database, which preserves the mapping between the RSS space and the location space. The location space is made up of all RPs’ position coordinates, and the RSS space is made up of the AP’s signal strength measured at RPs. The location of each RP corresponds to a group of RSS measured from APs. In the online phase, the user terminal senses the RSS and further matches it with the RSS space in the database; then, a suitable fingerprint matching method is applied to compute the user’s position. The suitable fingerprint matching method is the Weighted -nearest Neighbor (WKNN) algorithm, a machine learning-based algorithm. The localization process of the extant WKNN is to first measure the Euclidean distances between the RSS measured at the test points and the RSS of each RP in the fingerprint database. Then, the process sorts those Euclidean distances in ascending order. The first coordinates of the RPs with the smallest Euclidean distances are chosen. Different weights are then assigned to those coordinates. The weights are inversely proportional to the Euclidean distance of the RPs. Finally, the position of the test point is the weighted mean of the coordinates of RPs.

However, the WKNN mentioned above is not optimal. In most precise positioning scenarios, the RPs are deployed with high density. The differences between the assorted Euclidean distances are not big enough. The weights assigned to the RPs in the existing papers [59] are thereby almost the same, and the weighted sum of the location coordinates is almost equal to the average of the location coordinates. Our simulation results show that this method leads to inaccurate location results. As a result, it is necessary to properly enlarge the effect that the differences between these selected Euclidean distances have on the localization process. Therefore, this paper proposes an AHP-WKNN method which adopts the Analytic Hierarchy Process (AHP) technique [1014] to assign weights to the RPs. In this method, we choose the optimal position estimation of the test point as the target layer, the RSS value measured at all APs as the criterion layer, and the first RPs’ coordinates as the scheme layer. We then set the relative importance of elements in the positioning subjectively and determine whether this setting is consistent with mathematical logic by the consistency check. The weights of the RPs’ coordinates in the scheme layer can then be calculated through solving the judgment matrix. It is obvious that the AHP technique adds the subjective components in the objective mathematics framework; thus, it properly enhances the effect that RSS difference of RPs has on weights and achieves a better effect on localization compared to the existing methods.

The second problem of indoor localization is that the noise in the measurement of the RSS will lower the accuracy of WKNN. The existing works [15, 16] use the adaptive Kalman filter (AKF) to reduce the noise. AKF includes three phases: prediction, correction, and noise covariance estimation. In the prediction phase, AKF utilizes the estimation of the real RSS vector at the previous moment to calculate the prior RSS vector estimation at the current moment. During the correction phase, based on the current measurement of RSS , expectation of (the expected output of AKF at the current moment), and the Kalman gain matrix, AKF gives the current estimation of real RSS (the output of AKF); after that, AKF updates the covariance matrix of the noise and uses the result for the next iteration.

However, the estimation errors that exist during the iteration process are transitive, and the transition of these errors will affect the number of iterations that AKF needs to achieve the convergence state and the accuracy of the output result. Therefore, the AKF method in works [15, 16] is not effective enough. From the iteration process of AKF, we can see that is determined by the output at moment . If (the error between and ) at moment is too large, then is inaccurate. should be corrected to prevent errors from passing to the next iterations. Based on the analysis above, an amendatory AKF method is proposed in this paper. We set a judgment rule for . If (the covariance of ) exceeds the judgment rule, is inaccurate. We will adjust and recalculate [17]. Compared to the AKF in works [15, 16], one comparison and one amendment are added to each iteration in the proposed algorithm, and the noise reduction effect of the amendatory AKF is higher than that of the AKF in [15, 16], which leads to better performance of WKNN-based localization.

The main contributions of this paper are as follows. (i) This paper proposes an AHP-WKNN algorithm. The AHP technique is used to enhance the effect that the RSS difference between the test points and RPs has on the positioning process by assigning weights for different RP coordinates and thus improves the localization accuracy for the current WKNN algorithms. (ii) By setting a judgment rule to the error between the expected outputs and measurements, this paper conducts an amendment to the prior estimation of real RSS vectors. Thus, it improves the accuracy of the output of the AKF method and thereby improves the accuracy of the WKNN algorithm.

2. System Model

The fingerprint-based indoor localization system includes the offline phase and the online phase. During the offline phase, the RSS from AP is collected at the known RPs to form the fingerprint database. One fingerprint includes the coordinate of one RP and a series of RSS from APs measured at this RP. Therefore, there are two spaces in the fingerprint database mapping to each other, and these two spaces are the location space and the RSS space, respectively. Assuming there are APs and RPs, then the fingerprint database is expressed as follows: where the location space is made by position coordinate vectors of RPs. is the RSS space, including RSS vectors. records the observed RSS values from the th AP as where represents the RSS from the th AP measured at the th RP (, ). represents the matrix transpose.

In the online phase, the user terminal compares the RSS measured at the test point with the RSS in the fingerprint database built in the offline phase and then chooses RPs by considering the minimum Euclidean distance between the RSSs of these RPs and the RSS of the test point. Based on those chosen RPs’ coordinates and their weights, the optimal position of the test point could be expressed as where is the optimal position estimation of the test point, is the coordinates of the th RP, is the number of the chosen RPs, and is the weight assigned by the algorithm for the th RP.

3. AHP-WKNN

3.1. Localization Procedure of Extant WKNN

Assume that the RSS of the th AP measured at the test point is , , and is the number of the APs. Then, the Euclidean distance between the RSS of the test point and the RSS of the th RP in the fingerprint database is where , is the number of RPs. Those Euclidean distances are sorted in ascending order, and the first coordinates of the RPs with the smallest Euclidean distances are chosen to estimate the position of the test point. Apparently, the coordinate with a smaller Euclidean distance has a larger weight, and the coordinate with a larger Euclidean distance has a smaller weight. In [5], the weight is equal to the normalized Euclidean distance and can be expressed as the following equation: Assuming that the coordinate of the th RP is , , the position estimated by WKNN is where is the coordinate of the test point’s estimated position.

3.2. Problem Statement

From Section 3.1, it is easy to see that the coordinate of the test point is the weighted mean of selected RP coordinates. The weights are related to the RSS differences between the test point and the RPs. Since the differences of those Euclidean distances are not big enough, the differences of weights given by (5) are almost the same. According to our simulation, it is necessary to properly enhance the effect that the RSS difference has on the weights to improve the accuracy of the WKNN algorithm.

3.3. Hierarchical Model of AHP

We propose to use the AHP technique to realize this goal. Based on their functions on the positioning, factors involved in the indoor localization process are separated into a target layer, criterion layer, and scheme layer [10]. The judgment matrix is formed subjectively based on the relative importance of factors. Then, the consistency check is applied to determine the mathematical rationality of the judgment matrix. The weight of factors in positioning is obtained through matrix calculation. This method can subjectively enhance the influence that RSS differences have on their weights within an objective mathematical framework. The main steps are shown as follows: (1)Constructing the hierarchical structure model: calculating the optimal position of the test point is the target layer. Here, we set 4 APs and select 3 nearest RPs to participate in the localization process. Then, the 4 RSS measured at the four APs (RSS1, RSS2, RSS3, and RSS4) constitute the criterion layer, and the coordinates of three RPs are the scheme layer. The system structure model is shown in Figure 1(2)Constructing the judgment matrix: here, we denote as the th judgment matrix in the scheme layer. When the scheme layer is making decisions based on the RSS received from the th AP, the element (, ) in represents the degree of relative importance between the coordinate of and the coordinate of . We then denote as the judgment matrix for the criterion layer. When and are used to make decisions by the target layer, the element () in represents the degree of relative importance between and . The degree of relative importance is represented by integers from 1 to 9, and their reciprocal values are represented by one over 1 to 9. The possible values of the elements in the judgment matrix are shown in Table 1

Based on Table 1, since the four APs have the same contribution, all elements in of the criterion layer are set subjectively to 1. The judgment matrix of the criterion layer is shown in Table 2.

Since the four APs have the same contribution, is the same for different , which means . The weights of RP’s coordinates in the positioning process are inversely proportional to the Euclidean distance between the RP and the test point. Hence, coordinate 1 is more important than coordinate 2 (with the middle Euclidean distance), and coordinate 2 is more important than coordinate 3 (with the largest Euclidean distance). Based on the analysis above, the effect that the RSS difference has on weights should be enhanced. Therefore, the judgment matrix for of the scheme layer is set subjectively in Table 3. (3)Determining whether the elements in the judgment matrix are mathematically reasonable through the consistency check: assuming the weight of element to element is and the weight of element to element is , then the weight of element to element should be . If that is the case, we say the matrix is mathematically consistent. Mathematically, for the matrix that satisfies , is the necessary requirement for . Here, is the largest eigenvalue for the judgment matrix and is the dimension of the judgment matrix [1012]. However, since the elements in the judgment matrix are set subjectively, it is likely that . We thus use to measure how close is to , which means we are examining the consistency degree of the matrix. The degree can vary with . Table 4 gives the average degree of consistency of for different . We use the ratio to check the consistency of the judgment matrix. reflects the range of the matrix’s consistency. If , the judgment matrix can be adopted; if , the judgment matrix is not reasonable, and it needs to be kept adjusted until .(4)Since the final goal is to get the weight of each RP’s coordinate (the bottom layer) for the target layer (the top layer), we then compute the weight of each element for the upper layer. Because the values of the judgment matrix in this layer reflect the relative importance of the elements in the current layer when making decisions against the upper layer, we can use the normalized vector of the eigenvector , which corresponds to the largest eigenvalue of the judgment matrix in the current layer to represent the weight vector for the judgment matrix. The th value of represents the th attribute’s weight in the current layer for the th attribute in the upper layer. For example, the weight vector of the judgment matrix is calculated as follows:(i)Calculating ’s largest eigenvalue ’s corresponding eigenvector , where and satisfy the following:(ii)Normalizing the th value of to get ’s th value:

represents the weight of the th RP’s coordinate in the scheme layer for the RSS from the th AP in the criterion layer, where , . The judgment matrices of the scheme layer are the same for , so the corresponding weight vectors are the same. Since there is only one attribute in the target layer, the judgment matrix of the criterion layer only has one weight vector , and its th value represents the weight of the RSS of the th AP in the criterion layer for the target layer. (5)Based on and , we calculate the weights of three RPs’ coordinates in the scheme layer to realize localization. Each weight of the 3 RPs’ coordinates for the target layer could be expressed aswhere and . Those three weights then can be used in (6) to estimate the optimal position of the test point.

4. Amendatory AKF Method to Reduce Noise

We apply the amendatory AKF method to remove the noise in RSS. Generally, the estimation errors in the AKF iterations are transitive, and the accumulation of these errors will affect the number of iterations that AKF needs to achieve the convergence state as well as the accuracy of the output result. Therefore, we set judgment rules to reduce accumulation of these errors and make the output of AKF closer to the real value.

The AKF method utilizes the output obtained from the previous moment to adjust the current filtering parameters and adapts the statistical characteristics of the signals and noise. The AKF method has two basic assumptions. (1) The RSS vector at moment can be expressed by the RSS vector at moment , and the measured RSS vector at moment can be expressed by the real RSS vector. (2) These expressions and measurements can be described by the linear algorithm.

We denote the real RSS vector and the measured RSS vector received from APs at moment as and , respectively. They can be expressed as where is the real RSS vector at moment . is the state transition matrix. is the measurement matrix, mapping the real vector to the observation space, which means it expresses the unmeasurable real value as the measurable value. Since there is only noise between the real value and the measured value and the only difference between measurements at different moments is the different random value of noise, an -order identity matrix is used to represent and . The vector is the process noise vector distributed with zero mean and the process covariance matrix . The vector is the observation noise vector distributed with zero mean and the measurement covariance matrix .

The AKF method includes three phases: prediction, correction, and noise covariance estimation. In the prediction phase, AKF calculates the prior RSS vector estimation at moment based on the real RSS vector estimation at moment and the prior estimation error covariance matrix at the same time. where . is the posterior estimation error’s covariance matrix at moment . It reflects the accuracy of the output at moment . Since the real RSS vector at any moment is not available, the initial value of is difficult to obtain. Generally, when is not a zero matrix, it will not affect the convergence of AKF [18]. Therefore, an -order identity matrix is used to represent . The initial value of will be the measured value at the first time.

During the update phase, we first calculate the expected measured RSS vector at moment , and then, we calculate the Kalman gain matrix . Finally, we calculate the posterior RSS vector estimation at moment , which is the system output at moment , and we update the posterior estimation error’s covariance matrix at the same time:

Finally, we update and for the next iteration: where is the error between and . reflects the degree of the error between the expected output and measurement value. is the forgetting factor in . is used to lower the influence that the output at the prior moment (old data) has on the input data (new data) which is needed for new iteration at moment . As the number of iterations increases, the estimation error’s covariance matrix will become smaller and closer to the zero matrix. From Equations (15) and (16), we could see that when , and will no longer work in the noise reduction process [19]. In another word, the old data will saturate AKF. Data saturation will cause new data to be ineffective in the iteration process. Therefore, in order to reduce the impact of old data, we introduce the forgetting factor to fasten the convergence of AKF. The range for is from 0.95 to 0.995, and we set it to be 0.975.

reflects the degree that , the expected output at moment , is away from the measurement value . When the model parameters are not accurate or fluctuates greatly (due to the existence of noise or the fluctuation of APs’ signals), will be large, and the output accuracy obtained by Equation (16) will be low. In order to improve the output accuracy, we should make a judgment rule based on . If (the covariance of ) is greater than a threshold, should be amended, and should be recalculated based on amendatory . The process is shown in Figure 2.

Based on the analysis above, we set the judgment rules and amendment criterion to reduce , making the output of AKF closer to the real value. The amendment condition is based on the condition that the error between the expected value and the measurement is greater than a threshold. Define where is the element of the first row and first column of and is the threshold at moment . The range of coefficient is 0.5~0.9, and it is used to balance the influence that the measurement value and expected output have on the AKF output. It is also used to increase trust in the measurement value. Since the AKF model is a simulation of the real environment, the coefficient cannot be exact; thus, the output relies on the measurement value. Therefore, increasing trust in the measurement value will make the output closer to the real value. In this paper, .

If , it indicates that is inaccurate and should be adjusted as where is the covariance of . is used for the next iteration.

We use Equations (12), (13), (14), (15), (16), (17), (18), (19), (20), (21), (22), (23), and (24) to reduce the noise in RSS at the test point. The noise-reduced RSS will then be applied in AHP-WKNN.

5. The Complete Algorithm

The module of the proposed algorithm is shown in Figure 3. First, the amendatory AKF is used to reduce the noise of the RSS in the test point. AHP is then applied to assign weights for the chosen RPs’ coordinates, and WKNN is used to estimate the optimal position.

Input: measured RSS matrix at test point and fingerprint database
Output: the optimal position estimation
1. Initializing the amendatory AKF and AHP, and setting the first column of as the initial value for the in amendatory AKF;
2. ;
3. the number of iterations of the amendatory AKF;
4. whiledo:
 5. setting the threshold based on Equations (21) and (22)
 6. reducing noises of in the tth column of based on Equations (12), (14) and (16) and getting the output ;
 7. calculating the covariance of Equation (18);
 8. comparing with . If , fix to get based on Equations (23) and (24), and use for the next iteration. Otherwise, use instead;
 9. updating Equation (13), (17), (19) and (20);
;
11. end while
12. Calculating the Euclidean distances between and each fingerprint in the database. Sorting these distances and choose nearest fingerprints’ coordinates;
13. Based on and fingerprints, using AHP to build hierarchical model and judgment matrices;
14. Examining the consistency of each judgment matrix and determining the weight vector of each judgment matrix based on Equation (7) and (8);
15. Getting the weights of fingerprints’ coordinates that are needed to realize localization based on Equation (9);
16. Based on the coordinates and their corresponding weights, using Equation (6) to estimate the optimal position ;
17. return.

6. Simulation Result Analysis

We simulate a room with 4 APs in its corners. 957 RPs are set in the room with a one-meter interval between them unless otherwise stated. The static propagation model [20] and the RSS measured at each RP are shown as follows: where represents the path loss from the th AP to the th RP and represents the distance between the th AP and the th RP (, ). is the received power with distance , where is 2 meters. and are the gain of the transmitting antenna and receiving antenna, respectively. in the paper. is the wavelength, and , where is the velocity of light in vacuum and is the 2.4 GHz of the carrier. is the channel fading factor with range 2 to 5, and in this paper. represents the RSS from the th AP measured at the th RP. represents the transmit power of AP. without specific indication in this paper. is the white Gaussian noise with a mean of 0 and a variance of 0.1. A stationary test point is randomly set in the simulated room, and the signal strength received at the test point also follows the static propagation model [20] described by Equations (25), (26), and (27).

We employ two methods to evaluate the accuracy of the localization: (1) the root-mean-square error (RMSE) expressed in Equation (28) between the estimated position and the actual position of the test point: where and are the coordinates of the test point’s actual position and estimated position, respectively, and (2) the probability of positioning error to assess the accuracy.

The comparison of the noise reduction performance achieved by the standard KF, the existing AKF, and the amendatory AKF is shown in Figure 4.

From Figure 4, it can be seen that the result of the standard KF is not convergent. The existing AKF is better than the standard KF, but its output RSS fluctuates greatly and can be far away from the measured RSS. The amendatory AKF we proposed has outputs with stable fluctuation of RSS during the iteration process. The reasons are as follows: the standard KF is too simple to adapt the statistical characteristics of signals and noise during the noise reduction process. The existing AKF introduces the forgetting factor and noise covariance estimation into the standard KF. Using the output of the previous moment, the standard KF amends the current filtering parameters, and thus, it can adapt the statistical characteristics of signals and noise. However, when the RSS measured at the test point fluctuates, the existing AKF cannot adjust the filtering parameters in time. The amendatory AKF adds one comparison and one amendment process during every iteration. Thus, it can better track the change of RSS and achieve better performance of noise reduction.

Figure 5 reflects the effects that different noise reduction algorithms have on localization. The abscissa is the allowable positioning error (), and its unit is meter; the ordinate is the probability that the error between the estimated position of the test point and the real position is smaller than , i.e., .

From Figure 5, we can see that after using the amendatory AKF method to reduce noise at the test point, the positioning accuracy is better than that of having no noise reduction. When using the existing AKF, however, the positioning result fluctuates. Table 5 shows the comparison result of the RMSE generated by the existing AKF and amendatory AKF and without reducing noise, respectively.

Figure 6 shows the influence that the intervals between RPs have on the positioning results.

It is straightforward that the average RMSEs are inversely proportional to the distance between RPs. From the point of view of machine learning, the smaller the distance is, the more fingerprints and information there are. Thus, when there is more training data for WKNN, the positioning accuracy is higher. We compare the RMSE between different algorithms, including WKNN, KNN (using the average coordinates of the nearest neighbors to locate the test point), and NN (using the coordinate of the nearest neighbors to locate the test point). As can be seen from Figure 6, the average RMSE of the proposed algorithm is generally lower than that of the extant WKNN under different RP distances. The AHP technique reasonably expands the weight of the first RP during the positioning process, so that the difference between the weights of the RPs is more obvious. The AHP technique adds the subjective components in the objective mathematics framework; thus, it properly enhances the effect that RSS difference of RPs has on weights and helps to achieve a better effect on localization.

Figure 7 demonstrates the influence of different on the positioning results of the proposed algorithm.

It can be concluded from Figure 7 that the proposed algorithm has a better positioning performance when is around 0.8. As is used to balance the influence that the measurement value and expected output have on the AKF output, relatively higher value of means that the output of AKF relies more on measurements.

Figure 8 shows the influence of different transmit powers of APs on the localization performance of the proposed algorithm.

From Figure 8, we can see that the transmit powers of different APs have little influence on the positioning performance. This is because the factor that determines the positioning accuracy is the differences of the RSS between fingerprints. The fingerprints and their weights are chosen based on this difference. However, this difference is not affected by the transmit power. Thus, there is no point to adjust transmit power for positioning accuracy.

7. Conclusions

This paper proposes an AHP-WKNN method for indoor localization in which the AHP technique is designed to assign weights for selecting RPs to locate the position of the test point. We can subjectively enhance the effect that the differences between RSS have on the weights during positioning by employing AHP. To deal with the noises that exist in the indoor positioning system, this paper proposes an amendatory AKF method to reduce the noise, which introduces one comparison and one amendment in each iteration. The simulation results suggest that compared to the original AKF, the amendatory AKF can better fulfill the requirements of noise reduction at the test point, and the AHP-WKNN method thus can help achieve a higher positioning accuracy.

Data Availability

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

Conflicts of Interest

The authors declare no conflict of interest.

Acknowledgments

This work was supported in part by the Postgraduate Research and Practice Innovation Program of Jiangsu Province under Grant KYCX18_0883; in part by the Key Technologies R&D Program of Jiangsu Province under Grant BE2018733; in part by the Open Research Fund of the Jiangsu Engineering Research Center of Communication and Network Technology, Nanjing University of Posts and Telecommunications; and in part by the National Natural Science Foundation of China under Grant No. 61806100 and the Natural Science Foundation of Jiangsu Province under Grant No. BK20170914.