# Modified Echo State Network Enabled Dynamic Duty Cycle for Optimal Opportunistic Routing in EH-WSNs
## 3 Proposed Modified Echo State Network (MESN) Model
### Update the Position of the Current Solution  
* Encircling prey Consider the below equations: \[\overrightarrow{U}=|\overrightarrow{G}\cdot\overrightarrow{D^{*}}(t)- \overrightarrow{D}(t)|\] (6) \[\overrightarrow{D}(t+1)=\overrightarrow{D^{*}}(t)- \overrightarrow{B}\cdot\overrightarrow{U}\] (7) where '\(t\)'demonstrates a current iteration, \(\overrightarrow{B}\) and \(\overrightarrow{G}\) represent a coefficient vector, \(\overrightarrow{D^{*}}\) demonstrate best solution, \(\overrightarrow{D}\) refers a current state. Also: \[\overrightarrow{B}=2\overrightarrow{b}\cdot\overrightarrow{o}- \overrightarrow{b}\] (8) \[\overrightarrow{G}=2\cdot\overrightarrow{o}\] (9) where, \(\overrightarrow{b}\) is reducing from 2 to 0, \(\overrightarrow{o}\in(0,1)\). * Exploitation phase Two mechanisms are:
* Shrinking encircling mechanism The Equation (8) shows this act, where the value of \(\overrightarrow{b}\) is reduced. * Spiral updating position. The equation is as follows: \[\overrightarrow{D}(t+1)=\overrightarrow{U}_{dist}.exp^{l_{s}r}\cdot cos\Big{(} 2\prod r\Big{)}+\overrightarrow{D^{*}}(t)\] (10) where \(U_{dist}=|\overrightarrow{D^{*}}(t)-\overrightarrow{D}(t)|\). It means the distance between the \(x\)th whale to the prey (which is the best set of weights attained so far), \(r\) takes value from \([-1,\ 1]\), \(l_{s}\) signifies the logarithmic spiral shape. During optimization, supposing a probability of 50%. Consider the below Equation (11). \[\overrightarrow{D}(t+1)=\left\{ \begin{array}{l}\overrightarrow{D^{*}}(t)- \overrightarrow{B}\cdot\overrightarrow{U},\ if\ O<0.5\\ \overrightarrow{U}_{dist}.exp^{l_{s}r}\cdot cos(2\prod r)+\overrightarrow{D^{* }}(t),if\ O\geq 0.5\end{array} \right.\] (11) where, \(O\in[0,1]\). * Exploration phase The following equation demonstrates the exploration phase: \[\overrightarrow{U}=|\overrightarrow{G}\cdot\overrightarrow{D^{\prime}}|- \overrightarrow{D}|\] (12) \[\overrightarrow{D}(t+1)=\overrightarrow{D^{\prime}}|- \overrightarrow{B}\cdot\overrightarrow{U}\] (13) where the current population random position vector is \(\overrightarrow{D^{\prime}}\). Throughout every solution updating process, the fitness function is evaluated to find the best solution among them. Based on the best solution, a set of novel solutions will be generated, and the fitness is again evaluated to continue the above solution updating steps. * Termination criteriaThe termination criteria of WOA include the best interconnection weights. As a result of finding the optimal interconnection weights, the prediction model is qualified. Since the objective is to become the weights for which the training error is minimum, the prediction model, achieved for the best weights, is well qualified to predict for unknown data. When the training procedure is stable, the proposed modified ESN(MESN) can be used to predict the energy acquisition values of the next time slot, on giving the EATC values of the previous time slot. Figure 2 shows the flow diagram of the WOA algorithm. The Working Structure of the Proposed Modified Echo State Network (MESN) Based Dynamic Duty Cycle (DC) with Optimal Opportunistic Routing (OOR)  
In the OOR scheme, the relay set is initially selected using multiple parameters such as energy consumption, congestion rate, and estimated duty-cycled wakeups (EDW) [23]. Further, appropriate forwarding path is selected from the relay sets of each of the direct neighbor nodes. In Figure 3, a complete working structure of MESN enabled OOR is detailed. Figure 2: Flowchart of whale optimization algorithm for optimally selecting the weight of neurons in the reservoir layer. The formation of the initial relay set \(Set_{initial}\) for all nodes utilizes multiple parameters such as energy consumption [31], congestion rate [32], and the EDW. In the first step, we use multiple parameters for relay selection. Therefore, we have named this approach a hybrid relay selection mechanism.