## 5 Intelligent Opportunistic Protocol (IOP)
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & & & **Atributes** & & \\ \hline
**Neighbors of** & **Node\_Id (NID)** & **Location (LOC)** & \begin{tabular}{c} **Packet Reception** \\ **Ratio (PRR)** \\ \end{tabular} & \
\begin{tabular}{c} **Residual Energy (RE)** \\ **In Joules** \\ \end{tabular} &
\begin{tabular}{c} **Distance (D)** \\ **(in meters)** \\ \end{tabular} \\ \hline R1 & S0001 & (20,90) & 0.79 & 49.3 & 14 & 64.09 \\ R2 & S0002 & (25,110) & 0.87 & 48.1 & 15 & 63.97 \\ R3 & S0003 & (60,150) & 0.92 & 50 & 10 & 60.92 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Description of neighbors of source node S along with its features. where,  
\[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]  
\[P(R1_{RE}|S)=\frac{P(S|R1_{RE})*P(R1_{RE})}{P(S)}\]  
\[P(R1_{D}|S)=\frac{P(S|R1_{D})*P(R1_{D})}{P(S)}\]  
Putting the values in the above equations from Table 4, we can compute  
\[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\hskip-2.845276 pt=\frac{ \left(\frac{0.79}{64.09}\right)*\left(\frac{0.79}{2.58}\right)}{\frac{1}{3}} \hskip-2.845276 pt=\frac{\left(0.012\right)*\left(0.30\right)}{0.33}\hskip-2.845276 pt =0.010 \tag{8}\]  
\[P(R1_{RE}|S)=\frac{P(S|R1_{RE})*P(R1_{RE})}{P(S)}\hskip-2.845276 pt=\frac{ \left(\frac{49.3}{64.09}\right)*\left(\frac{49.3}{147.4}\right)}{\frac{1}{3}} \hskip-2.845276 pt=\frac{\left(0.76*0.33\right)}{0.33}\hskip-2.845276 pt=0.76 \tag{9}\]  
\[P(R1_{D}|S)=\frac{P(S|R1_{D})*P(R1_{D})}{P(S)}\hskip-2.845276 pt=\frac{\left( \frac{14}{64.09}\right)*\left(\frac{14}{39}\right)}{\frac{1}{3}}\hskip-2.845276 pt =\frac{0.21*0.35}{0.33}\hskip-2.845276 pt=0.22 \tag{10}\]  
Using the above results, we can compute the probability of \(P(R1\big{|}S)\) by multiplying \(P(R1_{PRR}|S)*P(R1_{RE}|S)*P(R1_{D}|S)\), i.e.,  
\[P(R1_{PRR}|S)*P(R1_{RE}|S)*P(R1_{D}|S)=0.010*0.76*0.22=0.001 \tag{11}\]  
Similarly, we can compute the probability of \(P(R2|S)\) by multiplying \(P(R2_{PRR}|S)*P(R2_{RE}|S)*P(R2_{D}|S)\), i.e.,  
\[P(R2_{PRR}|S)*P(R2_{RE}|S)*P(R2_{DE}|S)\]  
\[P(R2_{PRR}|S)=\frac{P(S|R2_{PRR})*P(R2_{RE})}{P(S)}\]  
\[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]0  
\[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]1  
Again, inputting the values in the above Equations (12)-(14) from the table given below, we can compute:  
\[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]2  
\[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]3  
\[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]4  
Therefore,  
\[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]5```
//when any node S wants to send a packet toward D and it has already constructed a forwarder list, it will follow this algorithm. Notations
``` FL(S): Forwarder List of source node S Ri: ith node in the forwarder list PRR: Packet Reception Ratio) RE: Residual Energy D: Distance P: Probability ArrProb[Ri]: Array to store probability of a given node Pmax: Maximum probability D: Destination/Target Input R: R is set of nodes in the forwarder list (FL) i.e., R = {R1, R2,..., Rn} Process START
1. Let R1, R2,..., Rn are the nodes in the FL of source node S. Each node Rie FL(S) where i = 1, 2,..., n
2. Declare three float variables X\({}_{1}\), X\({}_{2}\), and X\({}_{3}\) to represent the properties of Ri, i.e., PRR (Packet Reception Ratio), RE (Residual Energy), and D (distance), respectively. 3. For each node Rie FL(S) repeat Compute P(RiS)//Probability of selection of Ri given S, i.e., P\({}_{k}\) = P(R\({}_{k}\)|S) for i = 1, 2..., n and Assign k\(\leftarrow\)i
4. Compute the probability of P(R\({}_{k}\)|S) by computing the probability of each parameter separately, given S. \[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]6 where, \[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]7 \[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]8 \[P(R1_{PRR}|S)=\frac{P(S|R1_{PRR})*P(R1_{PRR})}{P(S)}\]9
5. Make an unsorted array of probability values of n nodes, i.e., R1, R2,..., Rn from step 6.