# Ocean-Current-Motion-Model-Based Routing Protocol for Void-Avoided UASNs
## 4 OCMR Protocol
### Optimal Speed-Based Relay Node Selection Algorithm  
The traditional WOA updates the position iteratively based on the position vector, and the optimal node is determined by the fitness value according to different fitness functions. In this paper, we use the velocity vector instead of the node coordinate position to select the relay node. As is described in Section 3.2, the seawater movement model is used to fit the movement of nodes to reflect the impact of seawater flow on the nodes. We obtain the velocity \(V_{x}\) perpendicular to the coast, velocity \(V_{y}\) along the coast, and velocity function \(y(v,t)\) of time \(t\) by Equation (9). The traditional WOA is based on the position vector \(\overrightarrow{X}\), and the velocity in the velocity function is also a vector. We can replace \(\overrightarrow{X}\) with \(\overrightarrow{V}\) to determine the optimal relay node with optimal velocity iteratively in a similar way. During the initialization phase of the WOA, assuming the number of whales involved in predation is \(N\), the dimension of the searching space is \(d\). The D-dimensional space is represented by  
\[\overrightarrow{D}=(D^{1},D^{2},\ldots,D^{d}) \tag{20}\]The position of each whale in the \(d\)-dimensional space is given as  
\[\overset{\rightarrow}{X_{i}}=(X_{i}^{1},X_{i}^{2},\ldots,X_{i}^{d}),i=1,2,\ldots,N \tag{21}\]  
where \(\overset{\rightarrow}{X_{i}}\) represents the position of the \(i\)th whale in the d-dimensional space. We substitute velocity \(V\) of the node into the Equation (21), and we obtain  
\[\overset{\rightarrow}{V_{i}}=(V_{i}^{1},V_{i}^{2},\ldots,V_{i}^{d}),i=1,2, \ldots,N \tag{22}\]  
where \(\overset{\rightarrow}{V_{i}}\) denotes the velocity vector of the \(i\)th whale in the d-dimensional space. We assume that the velocity vector \(\overset{\rightarrow}{V^{*}}\) of the prey is the optimal velocity in the current dimension, and the set of \(\overset{\rightarrow}{V^{*}}\) is given as  
\[\overset{\rightarrow}{V^{*}}=(V^{1*},V^{2*},\ldots,V^{d*}) \tag{23}\]  
During the encircling prey phase, the iterative model of the velocity vector is shown as  
\[\overset{\rightarrow}{R^{d}}=\left|\overset{\rightarrow}{C}\cdot\overset{ \rightarrow}{V^{j*}}(t)-V^{j}(t)\right| \tag{24}\]  
\[\overset{\rightarrow}{V}(t+1)=\overset{\rightarrow}{V^{*}}(t)-\overset{ \rightarrow}{A}\cdot\overset{\rightarrow}{R^{d}} \tag{25}\]  
where \(t\), \(\overset{\rightarrow}{A}\), and \(\overset{\rightarrow}{C}\) are described above; \(\overset{\rightarrow}{V^{*}}(t)\) represents the best velocity vector obtained to date; \(\overset{\rightarrow}{V}(t+1)\) is the optimal velocity vector of the next iteration; and \(\overset{\rightarrow}{R^{d}}\) indicates the subtraction of the velocity vectors between two nodes in the d-dimensional space. We also set \(A=2 ar-a\), \(C=2r\), \(a=2-(\frac{2t}{t_{\max}})\), in which \(A\in[-1,1]\), as described in Section 3.1. In the exploitation phase, humpback whales gain on the optimal target using the spiral encircling strategy, which is expressed as  
\[\overset{\rightarrow}{V}(t+1)=\overset{\rightarrow}{V^{*}}(t)+r_{3}\cdot \overset{\rightarrow}{R^{d}}\cdot e^{bl}\cdot\cos(2\pi l)+\sin(V_{i}^{j}(t)) \tag{26}\]  
where \(\overset{\rightarrow}{R^{d}}^{\prime}=\left|\overset{\rightarrow}{V^{*}}(t )-\overset{\rightarrow}{V}(t)\right|\), and \(r_{3}\) is the balance coefficient in [0, 1]. Similarly, we set the probability of 50% in this phase to obtain the optimal velocity. The model is given as  
\[\overset{\rightarrow}{V}(t+1)= \begin{cases}\overset{\rightarrow}{V^{*}}(t )-A\cdot\overset{\rightarrow}{R^{d}}&\text{if Q }<0.5\\ \overset{\rightarrow}{V^{*}}(t)+\overset{\rightarrow}{R^{d}}^{\prime}\cdot e ^{bl}\cdot\cos(2\pi l)+\sin(V_{i}^{j}(t))&\text{if Q }\geq 0.5\end{cases}