# Research on a Wi-Fi RSSI Calibration Algorithm Based on WOA-BPNN for Indoor Positioning
## 2 Methods and Algorithms
### Algorithms  
#### 2.2.1 Calibration Algorithm Based on WOA-BPNN  
As a WOA uses few parameters to achieve quick convergence and does not easily encounter the local optimum problem, we employ it to optimise the BPNN model and model the problem of the parameter selection of the BPNN model as parameter optimisation. We establish an objective function to optimise the combination of parameters and use the WOA to search for the optimal parameters, that is, the optimal initial weights and thresholds of the BPNN model. 1. A New Convergence Factor  
The WOA includes two processes: global searching and local searching. If the algorithm is intended for global searching, then it can keep the diversity of group and avoid falling into local optimum; if it is intended for local searching, then it can search precisely and speed up the search process. The searchability of the WOA depends on the value of \(\mid A\mid\), and the value of \(\mid A\mid\) varies with the change of the convergence factor \(a\), see Equation (3) for the relationship between \(A\) and \(a\). A larger convergence factor will improve the ability of global searching ability and reduce the possibility of premature maturity of the algorithm. By contrast, a small convergence factor will improve the local searching ability and efficiency of the algorithm. The convergence factor of a traditional WOA changes linearly, but in the actual searching process, the WOA changes non-linearly and causes slow convergence. Therefore, to speed up the establishment and optimisation of the calibration algorithm and increase the updating and iterating speed, we propose a nonlinear convergence formula [18] that simulates the shrinking behaviour of the surrounding prey of the whales, as shown in Equation (1), where the convergence factor \(a\) changes dynamically only with the current number of iterations of whale population \(t\), which can effectively prevent the algorithm from falling into the local optimum. \[a=2-2\text{arcsin}(\frac{t}{2t_{\text{max}}}) \tag{1}\]  
where \(t\) is the current number of iterations of the whale population and \(t_{\text{max}}\) is the maximum number of iterations of the whale population. 2. WOA-BPNN Calibration Algorithm Steps  
As one of the most successful neural network learning algorithms, a BPNN demonstrates satisfactory robustness and generalisation ability. However, the improper selection of initial weights and thresholds will cause a BPNN model to fall into a local optimum, thereby resulting in poor calibration results. [PERSON] et al. [19] utilised the global search capability of the mind evolutionary algorithm to determine the initial weights and thresholds of a BPNN model. [PERSON] et al. [20] employed the ant colony algorithm to optimise the initial weights and thresholds of a BPNN model then established a calibration model. Owing to its characteristics of few parameters, ability to jump out of the local optimum and satisfactory convergence ability, we employ the WOA as well as an improved convergence factor \(a\)[21]to optimise the parameters of the BPNN model. The algorithm steps are presented below (refer to Figure 2). * **Step 1:** Randomly select several acquisition points in the room and use a standard mobile terminal and test mobile terminal to collect the RSSI values of all APs at all acquisition points. To reduce the noise impact of personnel disturbance and same frequency interference during the RSSI propagation, process the received multiple RSSI values of the same AP via mean filtering. Take the average RSSI values of each AP collected from all acquisition points by the standard mobile terminal as the initial standard sampling data and take the average RSSI values of all the corresponding APs of the test mobile terminal at the corresponding acquisition points as the test sampling data. In addition, take the test sampling data as the real input value of the WOA-BPNN calibration model and take the initial standard sampling data as the real output value of the WOA-BPNN calibration model.