# Underwater Sensor Network Redeployment Algorithm Based on Wolf Search
## 4 RAWS Algorithm
### RAWS Algorithm Description and Process  
In combination with the basic theory of the RAWS algorithm, the underwater sensor node redeployment scheme was implemented in a distributed manner. As shown in Section 4.2, \(N_{\text{event}}(s_{i})\) is the target monitoring points of node B. The formulation is as follows:  
\[N_{\text{event}}\left(s_{i}\right)=\sum\limits_{1}^{n}f\left(p_{j},s_{i} \right)\
eq 0. \tag{11}\]  
The set of neighbor nodes is \(Z(s_{i})\), and the number of neighbor nodes is \(N_{\text{nei}}(s_{i})\):  
\[Z\left(s_{i}\right)=\left\{s_{z}|d\left(s_{i},s_{z}\right)\leq Rc,z=1,2,3, \ \ldots\ldots,\ n\right\}, \tag{12}\]  
\[N_{\text{nei}}\left(s_{i}\right)=\text{card}\left(K\left(s_{i}\right)\right). \tag{13}\]  
Initially, \(n\) sensor nodes were randomly deployed in the 3D underwater monitoring space. The initial random coverage was calculated, and then nodes were redeployed according to the RAWS algorithm. Step 1: Target monitoring points exist around node \(s_{i}\), and the nodes are not too crowded (node concentration D is reasonable). That is, when \(N_{\text{event}}(s_{i})\
eq 0\), the node covers the target monitoring point and does not move. Step 2: When no target monitoring point exists around node \(s_{i}\), that is, \(N_{\text{event}}(s_{i})=0\), two situations exist. Figure 2: Basic principle diagram of RAWS (redeployment algorithm based on wolf search). Step 2.1: If one hop neighbor node exists around node A, that is, \(N_{\text{event}}(s_{i})=0\),the nodes will be randomly moved to the new location of \(P(i)_{1}\) in any direction to maintain the diversity of the objective function value in the optimization process (shown in Equation (14)). Assuming that \(s_{i}\) perceives the obstacles in the process of moving, the node will avoid the obstacles and jump to \(P(i)_{2}\) with the greater distance than the node sensing radius. This escape mechanism can not only make the node move safely but also prevent the algorithm from falling into a local optimum of the considered objective function solution:  
\[P\left(i\right)_{1}=P\left(i\right)+\partial\cdot r\cdot\text{rand}()\cdot L, \tag{14}\]  
where \(P(i)\) is the initial location of the node, \(P(i)_{1}\) is the new position after the node has moved, \(V\) represents any unit vector, and \(\partial\) is the speed rate. With the increase in distance, the movement speed decreases, as shown in Equation (15). \(Rs\) is the node sensing radius. rand()\(\cdot L\) represents the direction of random movement of nodes, as shown in Equation (16):  
\[\partial\left(r\right)=\partial_{0}e^{-r^{2}} \tag{15}\]  
\[L=\frac{\left(P\left(i\right)-V\right)}{\left|P\left(i\right)-V\right|} \tag{16}\]  
where \(s\) represents the moving step size that is less than node sensing radius \(Rs\). escape()\(\cdot L\) is the location for random escape. It is greater than the node sensing radius and less than half of the monitoring area. If a node moves beyond the monitoring area, the node will move in the reverse direction of the escape formula, as shown in Equation (17). \[P\left(i\right)_{2}=P\left(i\right)_{1}\pm\partial\cdot s\cdot\text{escape}( )\cdot L \tag{17}\]  
Step 2.2: If other neighbor nodes exist around node \(s_{i}\), that is, \(N_{\text{event}}(s_{i})\
eq 0\), and node \(s_{i}\) will find the neighbor node with the most coverage monitoring points. This neighbor node is denoted as the best neighbor node \(s_{p}\) (Equation (18)). Then, node \(s_{i}\) moves to the optimal neighbor node in one step, as shown in Equation (19).