## 4 SD-EAR in Detail
### Optimum Route Selection
#### 4.2.2 Inter-Zone Route Discovery with Example  
If destination \(n_{j}\) doesn't belong to the same zone \(Z_{p}\) as source \(n_{i}\), then the SDN controller \(S_{p}\) finds all of the routes from \(n_{i}\) to all of the peripheral nodes of \(Z_{p}\) through the depth-first traversal of the graph, starting from \(n_{i}\). The situation can be seen in Figure 9a, while Figure 9b shows the steps of optimum route selection in case of inter-zone route discovery. In this case, opt-route-select has to be propagated to neighbors \(Z_{p}\), too. In that case, the SDN controller finds the routes from \(n_{i}\) to all of the nodes \(n_{q}\)\(\in\) extr(NODE-STAT\({}_{p}\),1) s.t. extr(NODE-STAT\({}_{p}\),9) = 1. \(n_{q}\) forwards the opt-route-select to all of the neighbors that do not belong to \(Z_{p}\). The neighbors of \(n_{q}\) ask the SDN controllers of their respective zones to find out routes to all of the nodes in its neighbor list. Communication in neighbor zones may be again intra-zone or inter-zone. Please note that SDN controllers belonging to multiple zones do not directly communicate with each other. Rather, the peripheral nodes of various zones communicate with each other. Inter-zone communication is actually a collection of multiple intra-zone communications. In inter-zone communication, if a SDN controller Sq of a zone Zq receives opt-route-select from more than one of its nodes corresponding to the same destination, then it sends opt-route-reply to the one with the highest residual energy (nb), while the others (say nc) are instructed to remain silent. The attributes of this silence message are as follows:  
1. message-type-id (5)
2. source-id (ni)
3. destination-id (nj)
4. router-id (nc)  
Figure 9: (**a**) Source ni and destination nj are not in same zone; (**b**) optimum route selection for inter-zone situation. Inter-zone communication is loop-free  
The traversed-zone-list field contains the sequence of zones that one particular opt-route-select message has traversed. Therefore, one opt-route-select message cannot be propagated within a zone more than once. This avoids loops. Moreover, intra-zone communication from a node to the peripheral nodes of the zone are definitely loop-free, because they are determined by the SDN controller of that zone by dint of the depth-first traversal of the zonal topological graph. This technique is loop-free, as already mentioned, in case of intra-zone communication. INPUT PARAMETERS OF FUZZ-OPT-ROUTE  
reft(R) or residual energy effect of route R  
This parameter indicates how the residual energy of nodes belonging to R influence the performance of the route. It is mathematically modeled in Equation (23):  
\[\text{reft}(\text{R})\ =\ \left\{ \begin{array}{ll}\sqrt{(\text{f-}\text{en}_{1}( \text{R})\ \times\ \text{f-en}_{2}(\text{R}))}&\text{if min}\ \ \ \ \text{r-en}_{k}>1\\ &\text{n}_{k}\in\text{R}\\ \min\ \ \ \text{r-en}_{k}&\text{Otherwise}\\ n_{k}\in\text{R}\end{array} \right. \tag{23}\]  
\[\text{f-en}_{1}(\text{R})=1-\{1/(\text{min}\ \text{r-en}_{k}+2)\} \tag{24}\]  
\[\text{n}_{k}\in\text{R}\]  
such that  
\[\text{k}\
eq\text{start}(\text{R})\ \text{and}\]  
\[\text{k}\
eq\text{end}(\text{R})\]  
start(R) and end(R) specify the source and destination nodes, respectively, in route R. If, for one particular route, no router nodes are there, then (minr-en\({}_{k}\)) among all of the routers n\({}_{k}\)\(\in\)R, will be 0. \[\text{f-en}_{2}(\text{R})=1-\{\alpha(\text{R})/(\sum\text{r-en}_{k}+2)\} \tag{25}\]  
\[\text{n}_{k}\in\text{R}\]  
From the formulation in Equation (23), it is evident that reft(R) ranges between 0 and 1. It is close to 1 if the minimum and average residual energies of R are high. The high values of this parameter are beneficial for the performance of the route. In Equation (24), 2 is added to the denominator to avoid a zero value when the min r-en\({}_{k}\) among all of the routers n\({}_{k}\in\) R is 0. Similarly, in Equation (25), 2 is added to the denominator to avoid a zero value when r-en\({}_{k}\) of all of then k\({}\in\) R is 0.