## 4 Terrain Matching Search Strategy Based on the F-WAPSO
### Search Strategy  
The selection of the fitness value function directly affects the solution quality of F-WAPSO. The MHD has a strong anti-interference ability and reduces the influence of noise. Using the MHD as the fitness function can improve terrain matching [25].  
The true value of the bathymetric measurement sequence is \(C\) = \(\{c_{1},\,c_{2},\,\ldots,\,c_{L}\}\), \(c_{i}\) = (\(cx_{i}\), \(cy_{i}\), \(cz_{i}\)), which is the value of longitude, latitude, and water depth of the measuring point. The \(L\) in \(i\) = 1, 2, \(\ldots,\,L\) is the length of the measurement sequence. Since the horizontal coordinates and water depth of each point on the topographic map can be mapped by digital maps, the corresponding real-time water depth sequence of \(C\) on the chart is:  
\(MC\) = \(\{mc_{1},\,mc_{2},\,\ldots,\,mc_{L}\}\), \(mci\) = \((mc_{i},\,ncy_{i})\) are the horizontal position coordinates.  
Using the position indicated by INS as the center, the bathymetric sequence \(C\) was used as the template to find the matching sequence \(P_{j}\) within the search area. The matching water depth sequence is: \(P_{j}\) = \(\{p_{1j},\,p_{2j},\,\ldots,\,p_{Lj}\}\), \(p_{ij}\) = \((px_{ij},\,py_{ij},\,p_{2 ij})\) (\(i\) = 1, 2, \(\ldots,\,L;j\) = 1, 2, \(\ldots,\,x_{m}\times y_{m}\)), and the corresponding horizontal position coordinate sequence is:  
\(MP_{j}\) = \(\{mp_{1j},\,mp_{2j},\,\ldots,\,mp_{Lj}\}\), \(mp_{jj}\) = \((mpx_{\overline{ij}},\,mpy_{ij})\). As a fitness function, the MHD is defined as:  
\[D_{MHD}(MC,\,\,MP_{j})=\frac{1}{L}\sum_{l=1}^{L}\min_{mp_{j}\in M_{l}}\left\| mc_{i}-mp_{ij}\right\| \tag{21}\]  
where \(\left\|.\right\|\) is a distance norm, and \(D_{MHD}\) represents the directed MHD distance between two point sets. The smaller the distance, the better the degree of matching.  
Figure 2 depicts the flow chart of the terrain matching algorithm based on F-WAPSO.  
The main steps of the terrain matching algorithm based on F-WAPSO could be described as follows:  
1. Initialization. Set F-WAPSO parameters and select a population of particles in search space with random positions and velocities.
2. Calculate each particle's fitness function value. After the optimization target has been established, that is, the matching sequence of the starting point node represented by the current particle, the search range is determined by Equations (19) and (20). The optimal matching sequence is determined by the minimum MHD sequence between the searched and measured terrain elevation sequences according to this range.
3. Update the individual optimal solution and the global optimal solution. First, each particle's current fitness value is compared with the individual optimal solution _pbest_. If the current fitness value is less than _pbest_, _pbest_ is updated as the current fitness value of the particle. Second, the current fitness value of each particle is compared with the global optimal solution _gbest_. If the current fitness value is less than _gbest_, _gbest_ is updated as the current fitness value of the particle.
4. ABC conduces greedy search. During the ABC search, particles in the hybrid algorithm are taken as the employed forager, and onlooker bees make greedy searches around it.  
5. Update the individual optimal solution and global optimal solution. In the ABC search, the MHD is also selected as the fitness function, and the minimum MHD corresponds to the optimal matching sequence.
6. Determine whether the terminal condition has been met. The termination condition is that the maximum number of iterations has been reached or the global optimal sequence and the measured topographic elevation sequence have reached the minimum value.
7. If the termination condition has been met, output the optimal matching sequence and its corresponding position. Otherwise, return to step 2.