## 4 Node Deployment Scheme for UASNs Based on the DHFOA
### Description of the DHFSOA  
The preceding section describes the process of the sensor nodes simulating the preying and following behaviors of artificial fish. The following analogous behavior can help the sensor node move to an improved state, thus accelerating the convergence of the algorithm. Preying behavior is characterized by the searching activity of the sensor node within the radius of communication \(r^{c}\), which ensures that the sensor node continues moving towards the optimal state. In addition, in the early stages of algorithm implementation, a larger step size should be adopted. This allows the sensor node to perform a coarse search within a larger range and helps to enhance the global search ability and convergence speed of the algorithm. As the search progresses, the step size is gradually reduced, and the algorithm slowly evolves into a local search. The sensor node eventually locates the area near the optimal position for a precise search, thereby improving the local search capability of the algorithm and the accuracy of the optimization result. Therefore, the step size \(l\) of the node is adjusted as follows:  
\[l_{Iter}=l_{Iter-1}\times a+l_{\min}, \tag{17}\]  
\[a=\exp\left(-g\times\left(\frac{Iter}{IterNum}\right)^{g}\right), \tag{18}\]  
where \(l\) is the maximum value of the moving step, \(l_{min}\) is the minimum value of the moving step, \(Iter\) is the current number of iterations, and \(IterNum\) is the maximum number of iterations. It is known from Equation (17) that the moving step depends on the value of \(a\), and the value of \(a\) is determined by \(k\) and \(g\). Figure 5a depicts the relationship between parameter \(k\), \(g\) and \(a\) when \(Iter\) is 20 and \(IterNum\) is 50. It is easy to see that the value of \(a\) increases as \(g\) increases, but decreases as \(k\) increases. When \(k\) and \(g\) are fixed, it is apparent that function \(a=f(Iter)\) in Equation (18) is a subtraction function in the interval \([1,IterNum]\). Therefore, the choice of \(k\) should be as large as possible, while the choice of \(g\) should be as small as possible. \(k\) = 20 and \(g\) = 5 are based on our practical experience and repeated experiments. Figure 5b shows the relationship between \(a\) and \(Iter\) when \(k\) = 20 and \(g\) = 5. The DHFSOA algorithm uses the maximum value at the beginning of the search, then gradually reduces it, eventually reaching and maintaining the minimum, which is in line with the original intention of the design. Based on the above description, a complete underwater sensor node placement algorithm inspired by fish swarms is presented in Algorithm 2. ```
1:Input:\(B_{i}=\left(r_{i}^{s},r_{i}^{c},l_{i},P_{i}\right)\), \(IterNum\);
2:Output:\(P_{i}^{k+1}\);
3:\(S=\left\{s_{1},s_{2},\cdots,s_{n}\right\}\leftarrow\) Randomly deploy sensors in UWSNs;
4:for\(k=1,2,\cdots,IterNum\)do
5:\(N_{e}\left(s_{i}\right)\), \(i\in[1,n]\leftarrow\) Detect events covered by node \(s_{i}\);
6:\(N_{CO}^{s}\left(s_{i}\right)\), \(i\in[1,n]\leftarrow\) Number of nodes within the node's perceived range;
7:if\(N_{ne}^{s}(s_{i})>0\)then
8: Use Algorithm 1 to get Set \(C_{sum}\);
9: Sort the nodes in Set \(C_{sum}\) according to the number of events covered, find Set \(\Re\), and satisfy \(N_{e}\left(s_{opt}\right)\geq N_{e}\left(s_{i}\right)\) and \(N_{co}^{s}\left(s_{opt}\right)<\sigma\left(s_{opt}\right)\);
10:\(s_{opt}=\underset{s_{k}\in\Re}{\arg\max}\)\(\left\{N_{e}\left(s_{i}\right)\right\}\);
11: Perform following behavior and move closer to node \(s_{opt}\);
12:else
13:for\(N_{prev}=1,2,\cdots,N_{\max}\)do
14: Perform preying behavior and randomly move;
15:if\(N_{e}\left(s_{i}^{\prime}\right)>N_{e}\left(s_{i}\right)\)do
16:break;
17:endif
18:endfor
19:endif
20:endfor
```  
**Algorithm 2**DHFSOA Description  
Figure 5: Selection of relevant parameters of the moving step in the DSFSOA(distributed hybrid fish swarm optimization algorithm) algorithm.