## 4 The Principle of the Balanced Cross-Layer Fuzzy Logic Routing Algorithm
### The Calculation of the Utility of Each Node  
The utility is used to decide the order of the neighbor nodes to be the next hop relay node. When we get the weights from the fuzzy logic inference system, we can use Equation (5) to calculate the utility of each node. \begin{table}
\begin{tabular}{l l l l l l l} \hline \hline
**Input ( \(D_{n}\) )** & Very small & Medium small & Small & Medium & Large & Medium large & Very large \\ \hline
**Output (\(\alpha_{n}\) )** & Very large & Medium large & Large & Medium & Small & Medium small & Very small \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The fuzzy if-then rules of BCFL. Figure 3: The principle of the fuzzy inference system. As defined in Section 2, the utility of node \(i\) can be expressed as:  
\[U^{i}=\alpha_{i}\beta_{i}^{i}+\alpha_{2}\beta_{2}^{i}+\alpha_{3}\beta_{3}^{i}+ \cdots+\alpha_{n}\beta_{n}^{i} \tag{6}\]  
where \(\beta_{n}^{i}\) represents the cross-layer parameters (such as the distance to the base station, the number of link breaks, the interface queue length, the remaining battery power, the number of hops to the destination node, _etc._) of node \(i\); \(\alpha_{n}\) is the different parameter weight, which can be obtained from Section 4.2. The process of BCFL is shown as follows:  
```
Input: \(\beta_{n}^{i}\): The cross-layer parameters from node \(i\); \(\beta_{n}\): The threshold of the cross-layer parameters; Output: \(NR\): The rank of the neighbor node to be the next hop relay node; Function:  Dispersion(\(\beta_{n}^{i}\)): The function to calculate the dispersion of the cross-layer parameters; \(\beta_{n}\): The fuzzy logic inference function to calculate the weight of each cross-layer parameters; \(\beta_{n}^{i}\): The function to calculate the utility of each node; \(\beta_{n}^{i}\): The function to decide the rank of the neighbor node to be the next hop relay node; Initialization:  Routediscovery=0;  Nodestatus==false; Main:  While Routediscovery=1 do  Broad hello message to neighbor nodes;  For cross-layer parameters received from other nodes, store these parameters;  if (\(\beta_{n}^{i}\geq\beta_{n}\) )  Nodesatus \(\leftarrow\) true;  else if (\(\beta_{n}^{i}<\beta_{n}\) )  Nodesatus \(\leftarrow\) false;  end if  while Nodestatus==true do \(D_{n}\leftarrow\) Dispersion(\(\beta_{n}^{i}\)); \(\alpha_{n}\leftarrow\)Fuzzylogic(\(D_{n}\)); \(U_{n}\leftarrow\)Utility(\(\beta_{n}^{i},\alpha_{n}\)); \(NR\leftarrow\)Probability(\(U_{n}\));  end while end while
```  
**Algorithm 1** The proposed fuzzy logic based routing algorithm (BCFL)  
``` Input: \(\beta_{n}^{i}\): The cross-layer parameters from node \(i\); \(\beta_{n}^{i}\): The threshold of the cross-layer parameters; Output: \(NR\): The rank of the neighbor node to be the next hop relay node; \(\beta_{n}^{i}\): The function to calculate the utility of each node; \(\beta_{n}^{i}\): The function to decide the rank of the neighbor node to be the next hop relay node; \(\beta_{n}^{i}\): The function to decide the rank



## 5 Performance Evaluation

In this section, we will discuss the properties and the performance of the BCFL in detail. During the simulation in Sections 5.1 and 5.2, generally, we do not specify the cross-layer parameters (\(\beta_{1},\beta_{2},\beta_{3},\)\(\cdots,\)\(\beta_{n}\)) to the specific factors (such as the distance to the base station, the number of link breaks, the interface queue length, the remaining battery power, the number of hops to the destination node, _etc._); we use the random number sequence (from 0 to 1) to represent the value of the cross-layer factors (which has been proven in Section 4.1 that this method is appropriate and effective). In Section 5.1, we will compare the performance of the BCFL with the traditional fuzzy logic-based routing algorithm and the optimization-based routing algorithm; in Section 5.2, we will show the performance of the BCFL under multiple constraints.