# Wi-Fi Fingerprint-Based Indoor Localization Method via Standard Particle Swarm Optimization
## 3 System Overview
### Preliminary  
For a clear description, certain primary notations are defined here and listed in Table 1. \begin{table}
\begin{tabular}{l l} \hline \hline
**Notations** & **Descriptions** \\ \hline
**AP** & Set of Access Points \\ \(M\) & Number of Access Points \\ \(\textbf{RP}_{train}\), \(RP_{traini}\) & Set of Reference Points for Training and its \(i\)th Point \\ \(\textbf{RP}_{test}\), \(RP_{test}\) & Set of Reference Points for Test and its \(i\)th Point \\ \(\textbf{Fin}_{train}\), \(Fil_{traini}\) & Training Fingerprints and the \(i\)th Training Fingerprint \\ \(\textbf{Fin}_{test}\), \(Fil_{test}\) & Test Fingerprints and the \(i\)th Test Fingerprint \\ \(RSS^{APj}_{traini}\) & Received Signal Strength of \(i\)th RP from \(j\)th AP \\ \(N_{tr}\) & Number of Training Fingerprints \\ \(N_{te}\) & Number of Test Fingerprints/Query Fingerprints \\ \(\text{Fin}_{query}\) & The Query Fingerprint in the Online Phase \\ \(dis_{Euc}dis_{\text{cos}}\) & Euclidean and Cosine Distance of Two Vectors \\ \(sim_{Euc}sim_{\text{cos}}\) & The Similarity Characterization of Two Vectors according to Euclidean and Cosine Distance \\ \(\textbf{Fix}_{train}\) & Number of the Most Similar Training Fingerprints to Test Fingerprint \\ \(\omega_{Euc}\cdot\omega_{\text{cos}\ k}\) & The \(k\)th Most Similar Training Fingerprint to Query Fingerprint \\ \(\omega_{\text{Euc}\cdot\omega_{\text{cos}\ k}}\) & The Location Coefficients of Location Estimation according to Euclidean and Cosine Distance \\ \(D\) & Dimension of the Particles \\ \(N_{ps}\) & Size of Particle Swarm/Number of Particles \\ \(c_{1},c_{2}\) & Acceleration Factors in SPSO \\ \(\omega^{I}\) & Inertia weight for the \(th\) Iteration in SPSO \\ \(\textbf{v}^{I}_{t},v^{I}_{td}\) & Velocity vector and its \(th\) Dimension Velocity of the \(i\)th particle in the \(t\)th iteration \\ \(\textbf{x}^{I}_{t},x^{I}_{td}\) & Position vector and its \(d\)th Dimension Position of the \(i\)th particle in the \(t\)th iteration \\ \(\textbf{pbest}^{t}\), \(pbest^{t}_{td}\) & Historical Optimal Solution of Each Particle and its \(d\)th Dimension Value in the \(t\)th iteration \\ \(\textbf{gbest}^{t}\), \(gbest^{t}_{d}\) & Historical Global Optimal Solution of Particle Swarm and its \(d\)th Dimension Value in the \(t\)th iteration \\ \(T_{\text{max}}\) & Maximum Iterations \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The descriptions of each notation. Figure 1: Schematic of the localization system. Given sets of RPs \(\mathbf{RP}_{train}=\{RP_{train1},RP_{train2},\ldots RP_{trainN_{tr}}\}\) and APs \(\mathbf{AP}=\{AP_{1},AP_{2},\ldots AP_{M}\}\), suppose that \(M\) APs are deployed in the indoor environment, and \(N_{tr}\) RPs are selected as signal collection points in the offline phase. Consequently, each RP has a coordinate \(RP_{traini}=(x_{traini},y_{traini})\) and a Wi-Fi fingerprint \(Fin_{traini}\) (as in Equation (5)). The entire Wi-Fi fingerprint in the offline phase is denoted by Equation (6). \[Fin_{traini}=(RSS^{AP1}_{traini},RSS^{AP2}_{traini},\ldots,RSS^{APM}_{ traini}) \tag{5}\]  
\[\mathbf{Fin}_{train}=(Fit_{train1},Fit_{train2},\cdots,Fit_{trainN_{tr}})^{T}\]  
\[= \begin{bmatrix}RSS^{AP1}_{train1}&RSS^{AP2}_{train1}&\cdots&RSS^{APM}_{ train1}\\ RSS^{AP1}_{train2}&RSS^{AP2}_{train2}&\cdots&RSS^{APM}_{train2}\\ \cdots&\cdots&\ddots&\vdots\\ RSS^{AP1}_{trainN_{tr}}&RSS^{AP2}_{trainN_{tr}}&\cdots&RSS^{APM}_{trainN_{tr}} \end{bmatrix}  \tag{6}\]  
where \(RSS^{APj}_{traini}\) is the RSS of \(i\)th RP from \(j\)th AP (\(i=1,2,\ldots,N_{tr};j=1,2,\ldots,M\)). Similarly, in the online phase, a series of (such as \(N_{te}\)) query fingerprints \(\text{Fin}_{query}\) are collected when some users make a location request. In this study, each of these was denoted as a test fingerprint \(Fin_{testi}\):  
\[Fin_{testi}=(RSS^{AP1}_{testi},RSS^{AP2}_{testi},\ldots,RSS^{APM}_{testi}) \tag{7}\]  
\[\mathbf{Fin}_{test}=(Fit_{test1},Fit_{test2},\cdots,Fit_{testN_{te}})^{T}\]  
\[=