# Wi-Fi Fingerprint-Based Indoor Localization Method via Standard Particle Swarm Optimization
## 3 System Overview
### SPSO Algorithm for Localization
\[\omega_{1k}=\frac{\frac{1}{d_{k}+\varepsilon}}{\sum_{k=1}^{K}\frac{1}{d_{k}+ \varepsilon}},\ \ \omega_{2k}=\frac{e^{-d_{k}}}{\sum_{k=1}^{K}e^{-d_{k}}},\ \ \omega_{3k}=\frac{10^{-d_{k}}}{\sum_{k=1}^{K}10^{-d_{k}}} \tag{26}\]

in which \(d_{k}\) means the distance between \(Fit_{test}\) and \(Fin_{train}^{simk}\), and \(\varepsilon\) is a very small value to avoid the problem of division by zero. \begin{table}
\begin{tabular}{c c c c c c} \hline
**No.** & **Distance Metrics** & **Weight** & **Accuracy (m)** & **RMSE (m)** & **STD (m)** \\ \hline \multirow{3}{*}{1} & \multirow{3}{*}{Euclidean Metric} & 1 & 2.3600 & 2.6768 & 1.2631 \\  & & 2 & 2.2261 & 2.6311 & 1.4026 \\  & & 3 & 2.3555 & 2.7770 & 1.4708 \\ \hline \multirow{3}{*}{2} & \multirow{3}{*}{Mahalanobis Distance} & 1 & 4.0090 & 4.7974 & 2.6350 \\  & & 2 & 3.8229 & 4.5652 & 2.4952 \\  & & 3 & 3.6852 & 4.5175 & 2.6128 \\ \hline \multirow{3}{*}{3} & \multirow{3}{*}{Correlation Metric} & 1 & 2.3250 & 2.6555 & 1.2831 \\  & & 2 & 2.4336 & 2.7733 & 1.3299 \\  & & 3 & 2.4509 & 2.8180 & 1.3909 \\ \hline \multirow{3}{*}{4} & \multirow{3}{*}{Cosine Distance} & 1 & 2.2089 & 2.5444 & 1.2629 \\  & & 2 & 2.3378 & 2.6648 & 1.2789 \\  & & 3 & 2.3857 & 2.7082 & 1.2818 \\ \hline \multirow{3}{*}{5} & \multirow{3}{*}{Euc and Mahal} & 1 & 2.6692 & 3.1911 & 1.7490 \\  & & 2 & 2.4599 & 2.9309 & 1.5934 \\  & & 3 & 2.4903 & 3.0561 & 1.7714 \\ \hline \multirow{3}{*}{6} & \multirow{3}{*}{Euc and Cor} & 1 & 2.2177 & 2.5252 & 1.2077 \\  & & 2 & 2.1432 & 2.5172 & 1.3203 \\  & & 3 & 2.1707 & 2.5491 & 1.3364 \\ \hline \multirow{3}{*}{7} & \multirow{3}{*}{Euc and Cos} & 1 & 2.2584 & 2.5892 & 1.2664 \\  & & 2 & 2.1516 & 2.5497 & 1.3681 \\  & & 3 & 2.1128 & 2.4766 & 1.2922 \\ \hline \multirow{3}{*}{8} & \multirow{3}{*}{Mahal and Cor} & 1 & 2.5656 & 3.0026 & 1.5599 \\  & & 2 & 2.6912 & 3.1527 & 1.6422 \\  & & 3 & 2.6900 & 3.2157 & 1.7621 \\ \hline \multirow{3}{*}{9} & \multirow{3}{*}{Mahal and Cos} & 1 & 2.5490 & 2.9419 & 1.4689 \\  & & 2 & 2.7242 & 3.1993 & 1.6775 \\  & & 3 & 2.6901 & 3.2255 & 1.7797 \\ \hline \multirow{3}{*}{10} & \multirow{3}{*}{Cor and Cos [19]} & 1 & 2.2559 & 2.5988 & 1.2902 \\  & & 2 & 2.2831 & 2.6071 & 1.2587 \\ \cline{1-1}  & & 3 & 2.3244 & 2.6445 & 1.2612 \\ \hline \end{tabular} \({}^{1}\) All results in this table are medians over 20 runs.

\end{table} 
Table 3: The performance comparison \({}^{1}\) of different distance metrics and weight assignments. A Comparison of one panel and two-panelTo further analyze the characteristics of the model, a comparative experiment on one panel and two-panel was carried out. In this study, the two-panel fingerprint-homogeneity model was used to construct the fitness function of the SPSO algorithm. Actually, Equation (18) presents the fact that its geometric meaning is to find the situation where the estimated locations of the two panels are the closest. The situation can be determined by the parameter K, i.e., a specific value of K can uniquely determine the estimated locations of the two panels. For particles, their optimal position is on the line segment where the estimated location of the two panels are the endpoints. Obviously, Equation (18) has multiple solutions. However, if only one of the two panels were used, the particles would always find the optimal position that minimizes the fitness function (to 0), no matter what the value of K is. In the same case of multiple solutions, the solutions of one panel will be more dispersed, meaning that the model is not robust enough. As shown in Table 3, No. 1-4 are the results of one panel, and No. 5-10 are those of two-panel with different distance metrics and weight assignments. Although their results were similar, since \(K\) was limited to \([2,8]\) for better results, the performance of two-panel is better than at least one panel, in general. This means that the results of two panels can constrain each other, especially in combinations involving Mahalanobis distance.