# WiFi Positioning in 3 GPP Indoor Office with Modified Particle Swarm Optimization
## 4 Proposed Indoor Positioning
### PSO Algorithm  
The PSO is an intelligent evolutionary computational algorithm proposed by [PERSON] and [PERSON] in 1995. The PSO is a population-based probabilistic approach used to optimize nonlinear problems. The detailed process of the PSO algorithm is as follows.  
First, all particles undergo an initialization process. After that, the particles are randomly distributed in the search region to estimate the location of the UE. The distributed particles perform an iterative process of finding an optimal location estimated as the actual location of the UE. At each iteration, the particles follow the individual optimal position _pbest_ and the swarm optimal position _gbest_. Particles derive the optimal location of the actual user based on the values of _pbest_ and _gbest_ that are continuously updated during the iteration process. The iterative process is performed using the equation below.  
\[V_{i}(\tau+1)=wV_{i}(\tau)+c\ r\ [pbest_{i}(\tau)-x_{i}(\tau)]+c\ r\ [gbest(\tau)-x_{i}(\tau)] \tag{15}\]  
\[X_{i}(\tau+1)=X_{i}(\tau)+V_{i}(\tau+1) \tag{16}\]  
\[w=w_{max}-\frac{\tau}{\mathrm{T}}(w_{max}-w_{min}) \tag{17}\]  
where \(V_{i}(\tau)\) is the velocity of the \(i\)-th particle in the \(\tau\)-th iteration and \(X_{i}(\tau)\) is the position of the \(i\)-th particle in the \(\tau\)-th iteration. In addition, \(c\) is an acceleration coefficient, \(w\) is an inertia coefficient, and \(r\) is an arbitrary coefficient of contraction. \(\tau\) represents the current number of iterations, and T is the total number of iterations of the PSO algorithm.  
In general, the PSO algorithm is applied to optimization problems. However, in this paper, it is applied and used as one of the positioning schemes. In a practical environment, an error exists in the RSSI the UE receives from each Wi-Fi AP due to propagation loss, which obviously causes an error in the positioning process. Therefore, through the PSO  
Figure 4: Initial particle distribution of PSO: (**a**) non-limited search region, (**b**) limited search region.  
process, the error can be converted to obtain a fitness with a minimum value. At this time, the function to determine the fitness of each particle can be written as (18).  
\[f_{m}\left(\hat{X}\right)=d_{m}-\left|\hat{X}-X_{m}^{T}\right| \tag{18}\]  
where \(d_{m}\) is the distance between AP m and the receiver, and \(X_{m}^{T}\) is the location of AP m. We update swarm with the PSO and optimize the fit of each particle in (19).  
\[F\left(\hat{X}\right)=\sum_{m=1}^{M}f_{m}^{2}\left(\hat{X}\right) \tag{19}\]  
After that, the PSO process ends when the preset accuracy error and number of iterations are reached. After the PSO process ends, the position of the particle with the best fit becomes the final UE's estimated position. The process of the proposed algorithm is detailed in Algorithm 1.  
```
Result: Estimated Positioning Initialization  Distribute the SP at a specific location within the region for m = 1:M  where M is the total number of Wi-Fi APs  Measure Wi-Fi AP m and each SP's RSSI value End  Fingerprinting database \(H^{RSSI}\) construction and Euclidean vector D calculation for m = 1:M  Measure Wi-Fi AP m and UE's RSSI value End  Construction of \(Z_{k}^{RSSI}\) with measured values  WFM with \(H^{RSSI}\) and \(Z_{k}^{RSSI}\) Select the 4 SPs nearest to the UE and obtain a limited region Randomly distribute particles over the limited region For t = 1:T  PSO algorithm implementation End  Obtain the position of the particle with the most optimal fit and use it as the UE's estimated position
```  
**Algorithm 1**Proposed Indoor Positioning Algorithm