## 4 Parameter Optimization
### Parameter Optimization Using the PSO Algorithm  
There are nine parameters that should be optimized, as listed in Table 1, and we defined them as a checking vector \(\mathbf{p}=(r,s,t,\Psi,\Phi,\Omega,u,v,w)\). It is obvious that the reconstruction of STIL is a nonlinear process whose inverse problem cannot be solved using the least square method (LSM) based on the matrix form. Furthermore, it is a global optimization process, where the nonlinear LSM falls into the local optimal solution through the direction of the gradient descent. One of the best ways to avoid local optimums is to introduce randomness, and most intelligent heuristic algorithms work with it. If we set a random step size for the nonlinear LSM, the program evolves into an intelligent algorithm. The PSO not only uses random steps but also introduces a competition mechanism, a population-based stochastic optimization algorithm inspired by the social behavior of birds flocking or fish schooling. The PSO is commonly used to solve optimization problems where the objective is to find the optimal solution in a search space. During the optimization of placement parameters, the checking vector \(\mathbf{p}\) is abstracted into a particle. Since the PSO starts running, 50 checking vectors are generated randomly and comprise the particle swarm. Three types of checking points are reconstructed with every particle, and the weighted average is determined to obtain a matching error shown as  
\[e=w_{b}\overline{e_{b}}+w_{f}\overline{e_{f}}+w_{a}\overline{e_{a}}. \tag{18}\]  
The average value \(\overline{e_{i}}\) is the distance between two groups of check points in point set \(P_{i}\), and \(w_{i}\) is its weight. The particle \(p^{i}\) records its own minimum matching error as \(p_{h}^{i}\), and there is a best particle \(q_{j}\) in the \(j\)th iteration. Every particle has a \(\mathbf{v}\) in every iteration and moves along a straight line without a matching error. However, it exists in a swarm and is burdened with  
Figure 8: (**a**) Marked positions across strips; (**b**) diagram of the strip overlap. the task of finding an optimal solution, so it has to move to the historical optimal solution \(\mathbf{p}_{h}^{i}\) or the ethnic optimal solution \(\mathbf{q}_{j}\). Thus, the particle \(p_{j}^{i}\), which is the \(i\)th particle in the swarm, in its \(j\)th iteration, would have the new speed \(\mathbf{v}_{j+1}^{i}\). \[\mathbf{v}_{j+1}^{i}=\mathbf{v}_{j}^{i}+c_{0}\tau_{1}\Big{(}\mathbf{q}_{j}-\mathbf{p}_{j}^{i} \Big{)}+c_{1}r_{1}\Big{(}\mathbf{p}_{h}^{i}-\mathbf{p}_{j}^{i}\Big{)} \tag{19}\]  
The vectors \(\mathbf{p}_{j}^{i},\mathbf{p}_{h}^{i}\), and \(\mathbf{q}_{j}\) are the positions of their corresponding particles; \(c_{0}\) and \(c_{1}\) are the global and local constants; and \(r_{1},r_{2}\) are randoms. The pseudocode is shown in Algorithm 1. ```
Input: 45 pairs of marking points Output: 8 parameters
1. function pso(points, max_iter, target_precision)
2. Initialize particles \(\mathbf{p}_{0}=\text{radom}(\ref{eq:pso},\ref{eq:pso})\)
3. Initialize speed \(\mathbf{v}_{1}=\text{zeros}(\ref{eq:pso},\ref{eq:pso})\)
4. Initialize personal best particles \(\mathbf{p}_{g}=\text{zeros}(\ref{eq:pso},\ref{eq:pso})\). 5. \(\mathbf{e}=\text{zeros}(\ref{eq:pso})\)
6. for j = 1 to max_iter
7. for i = 1:50
8. \(\mathbf{e}^{i}=\text{test\_one\_parameter}(\text{points},\mathbf{p}_{j}^{i})\)
9. if test_one_parameter(points, \(\mathbf{p}_{h}^{i}\)) \(\mathbf{e}^{i}\)
10. \(\mathbf{p}_{h}^{i}=\mathbf{p}_{j}^{i}\)
11. end if
12. end for
13. \(\mathbf{g}=\underset{i}{\text{argmin}}\ \mathbf{e}^{i}\)
14. \(\mathbf{q}_{j}=\mathbf{p}_{g}^{i}\)
15. if \(\mathbf{e}^{\text{s}}<\text{target\_precision}\)
16. return \(\mathbf{q}_{j}\)
17. \(\mathbf{v}_{j+1}=\mathbf{v}_{j}+\alpha\mathbf{v}_{j}\Big{(}\mathbf{q}_{j}-\mathbf{p}_{j}\Big{)}+c _{1}\mathbf{r}_{1}\Big{(}\mathbf{p}_{g}-\mathbf{p}_{j}\Big{)}\)
18. \(\mathbf{p}_{j+1}+=\mathbf{v}_{j+1}\)
19. end for
20. return \(\mathbf{q}_{j}\)
21. end function
22.