## 3 System Model
### PSO Model Review
#### 3.4.1 Particle Initialization and Particle Generation  
In WiFi indoor positioning, each particle's personal best position (pbest) is determined by evaluating the distance between the particle and the target. Then, the global best position (gbest) is calculated. Particle positions are updated using the PSO update equation, which incorporates the current position, velocity, and differences between the current position, pbest, and gbest. The following Formula (4) is the definition of pbest.  
\[p_{i}^{(t+1)}=\left\{\begin{array}{cc}p_{i}^{(t)}&,\ \ if\ F\left(x_{i} ^{(t)},y_{i}^{(t)}\right)\geq F\left(p_{i}^{(t)}\right)\\ \left(x_{i}^{(t)},y_{i}^{(t)}\right),\ \ otherwise\end{array}\right. \tag{4}\]  
where \(p_{i}^{(t+1)}\) denotes personal best position of the \(i\)-th particle after the \((t+1)\)-th iteration, \(p_{i}^{(t)}\) refers to the personal best position of the \(i\)-th particle at the t-th iteration, \(F\left(x_{i}^{(t)},y_{i}^{(t)}\right)\) refers to the fitness value of the \(i\)-th particle at its position \((x_{i}^{(t)},y_{i}^{(t)})\) during the t-th iteration, \(F\left(p_{i}^{(t)}\right)\) denotes the fitness value of the personal best position of the \(i\)-th particle at the t-th iteration, and \(\left(x_{i}^{(t)},y_{i}^{(t)}\right)\) denotes the coordinates of the \(i\)-th particle at the  
Figure 3: Interpolation position of IDW.  
\(t\)-th iteration. This formula implies that if the current position of the \(i\)-th particle is better (i.e., has a lower fitness value) than its previous personal best, then its pbest is to be updated to this current position; otherwise, the pbest is kept unchanged. The gbest is calculated with Equation (5) below.  
\[g^{(t+1)}=min\Big{\{}p_{1}{}^{(t+1)},p_{2}{}^{(t+1)},\ldots,\ p_{n}{}^{(t+1)} \Big{\}} \tag{5}\]  
where \(g^{(t+1)}\) denotes the global best position identified after the \((t+1)\)-th iteration, min denotes selecting the smallest item from a set of candidates within the brackets, \(p_{1}{}^{(t+1)}\), \(p_{2}{}^{(t+1)}\),..., \(p_{n}{}^{(t+1)}\) are the personal best positions found by each particle for itself after the \((t+1)\)-th iteration. In the WiFi positioning area, the PSO equation is illustrated as Formula (6).  
\[\begin{bmatrix}x_{new}\\ y_{new}\end{bmatrix}=\begin{bmatrix}x\\ y\end{bmatrix}+\omega\cdot v+c1\cdot r1\cdot\left(p-\begin{bmatrix}x\\ y\end{bmatrix}\right)+c2\cdot r2\cdot\left(g-\begin{bmatrix}x\\ y\end{bmatrix}\right), \tag{6}\]  
where \(\begin{bmatrix}x_{new}&y_{new}\end{bmatrix}^{T}\) denotes the new position of the particle which is the updated position aimed at getting closer to the optimal solution of the problem, \(\begin{bmatrix}x&y\end{bmatrix}^{T}\) denotes the current position of the particle, \(\omega\) denotes the inertia coefficient that helps to maintain momentum, v denotes a 2 \(\times\) 1 array containing uniformly distributed random numbers between 0 and 1, \(c1\) and \(c2\) indicate coefficients for the cognitive (personal best) and social (global best) components, \(r1\) and \(r2\) indicate random numbers for each dimension, p denotes the personal best position, and g denotes the global best position.