# Wi-Fi Fingerprint-Based Indoor Localization Method via Standard Particle Swarm Optimization
## 2 Related Work
### Particle Swarm Optimization  
The particle swarm optimization (PSO) algorithm originated from the study of foraging behavior of birds and other social animals and is a type of biological evolutionary algorithm first proposed by [PERSON] and [PERSON] [38]. It is a random optimization technique in which the potential solution of the problem is represented by the position of the particles in the swarm. Specifically, a particle is an individual in a bird swarm, and the optimal solution is where the bird looks for the target food. According to the best foraging result of individual birds (historical optimal solution of each particle, **pbest**) and the best foraging result of the bird swarm (historical optimal solution of the particle swarm, **gbest**), every bird flies towards the best position and explores the best foraging position. This is calculated using the fitness function value of each particle, and the flight direction is determined to adjust the direction of convergence. Thus, after several iterations, the optimal foraging position (global optimal solution) can be explored by using a bird swarm (particle swarm).  
In the standard particle swarm optimization (SPSO) algorithm [20], let the solution space be \(\mathbf{S}\) with \(D\) dimensions, and the boundary of each dimension be \([x_{d\min},x_{d\max}]\). Suppose that the number of particles is \(N_{ps}\) and the maximum iteration is \(T\). The rules of position updating in the SPSO algorithm are expressed as  
\[\mathbf{S}=\{\mathbf{x}\in\mathbb{R}^{D}|x_{d}\in[x_{d\min},x_{d\max}],d=1,2, \ldots,D\} \tag{1}\]  
\[v_{id}^{t+1}=\omega v_{id}^{t}+c_{1}r_{1}(\textit{pbest}_{id}^{t}-x_{id}^{t}) +c_{2}r_{2}(\textit{gbest}_{d}^{t}-x_{id}^{t}) \tag{2}\]  
\[x_{id}^{t+1}=x_{id}^{t}+v_{id}^{t+1} \tag{3}\]  
where \(i=1,2,\ldots,N_{ps}\) represents the index of each particle, and \(\mathbf{v}_{i}^{t}=[v_{i1}^{t},v_{i2}^{t},\ldots,v_{iD}^{t}]\) and \(\mathbf{x}_{i}^{t}=[x_{i1}^{t},x_{i2}^{t},\ldots,x_{iD}^{t}]\) are the velocity and position variables of the \(i\)th particle in the \(t\)th iteration, respectively. To control the particles in space \(\mathbf{S}\), the velocity \(|v_{id}^{t}|\) is limited to the maximum \(v_{\max}\). Meanwhile, for the \(t\)th iteration, each particle has a historical optimal position: \(\textbf{pbest}_{i}^{t}=[\textit{pbest}_{i1}^{t},\textit{pbest}_{i2}^{t}, \ldots,\textit{pbest}_{iD}^{t}]\), and \(\textbf{gbest}^{t}=[\textit{gbest}_{1}^{t},\textit{gbest}_{2}^{t},\ldots \textit{gbest}_{D}^{t}]\) denotes the historical optimal position of the entire particle swarm. Further, \(c_{1}\) and \(c_{2}\) denote the acceleration factor and \(r_{1}\) and \(r_{2}\) are random numbers in the range [0, 1]. In addition, \(\omega\) is the inertia weight, and its initial and final values are \(\omega_{init}\) and \(\omega_{end}\) for \(T_{\max}\) iterations, respectively, which can be defined as follows:  
\[\omega^{t}=\omega_{init}+(\omega_{end}-\omega_{init})\bigg{(}\frac{T_{\max}-t }{T_{\max}}\bigg{)} \tag{4}\]  
PSO has been applied in various fields of practical engineering owing to its advantages of fast convergence and nonlinearity. The essence of indoor localization involves determining the optimal location estimation; therefore, the SPSO algorithm is feasible for Wi-Fi indoor localization. However, few scholars have discussed the application of the PSOalgorithm in Wi-Fi localization technology, such as combining the AP selection strategy [39], the wireless-signal-propagation model [40], and triangulation localization [41]. In addition, [PERSON] et al. [42] represented the fingerprint of each particle using the inverse distance weighted algorithm to find the optimal location estimation using PSO. [PERSON] et al. [43] combined PSO and an artificial neural network (ANN) to reduce the localization error and shorten the prediction time. However, at present, the PSO algorithm has yet to be sufficiently developed and explored in the design of indoor-localization models based on Wi-Fi-fingerprint.