# Fuzzy-Based Multi-Modal Query-Forwarding in Mini-Datacenters
## 4 Modeling the Query Flow Within the Mini-Datacenter
### Fuzzy Modeling of Granular Selection in Query Forwarding
#### 4.3.1 Modeling Fuzzy Input Parameters  
We have modeled the two input parameters (i) gateway availability ratio and (ii) proportion of overloaded gateways, by defining fuzzy sets and membership functions. A combination of triangular (to model a smooth increase or decrease) and trapezoidal membership functions (to represent conditions of saturation) is utilized to define the input membership functions. The gateway availability ratio ranges from 0 to 1, where a value of 0 represents no available gateways, while a value of 1 indicates that all deployed gateways are available. We have categorized this input parameter into three fuzzy sets: low, where less than 30% of the gateways are available, indicating more inclination towards coarse granularity, medium, where between 30% and 70% of the gateways are available, indicating moderate redundancy with possible fine granularity, and high, where more than 70% of the gateways are available, providing fine granularity with significant redundancy. We have selected a triangular membership function for low with peaks at 0.2, whereas a trapezoidal function for medium and high with flat peaks from 0.4 to 0.6 and 0.7 to 1, respectively, as demonstrated in Equations (7)-(9). The degree of membership variation is shown in Figure 3.  
\[\mu_{low}(x)=\left\{\begin{array}{cc}0&x\leq 0\;or\;x>0.3\\ x*5&0<x\leq 0.2\\ -10*(x-0.3)&0.2<x\leq 0.3\end{array}\right. \tag{7}\]  
\[\mu_{Med}(x)=\left\{\begin{array}{cc}0&x\leq 0.3\;or\;x\geq 0.7\\ (x-0.3)*10&0.3<x\leq 0.4\\ 1&0.4<x\leq 0.6\\ 1-((x-0.6)*10)&0.6<x\leq 0.7\end{array}\right. \tag{8}\]  
\[\mu_{Hi}(x)=\left\{\begin{array}{cc}0&x\leq 0.6\;or\;x>1\\ (x-0.6)*10&0.6\leq x\leq 0.7\\ 1&0.7<x\leq 1\end{array}\right. \tag{9}\]  
The proportion of overloaded gateways ranges from 0 to 1, where a value of 0 represents low overloaded gateways, while a value of 1 indicates that gateways are highly overloaded. We have categorized this input parameter into three fuzzy sets: low, where less than 30% of the gateways are overloaded, reflecting minimal overloading, medium, where between 30 and 60% of the gateways are overloaded, indicating moderate overloading, and high, where greater than 60% of the gateways are overloaded, providing significant congestion. We have selected a triangular membership function for low with peaks at 0.2, whereas a trapezoidal function for medium and high with a flat peak from 0.4 to 0.6 and 0.7 to 1, as demonstrated in Equations (10)-(12), and the degree of membership variation is shown in Figure 4.  
\[\mu_{low}(x)=\left\{\begin{array}{cc}0&x\leq 0\;or\;x>0.3\\ x*\left(\frac{10}{2}\right)&0<x\leq 0.2\\ -10*(x-0.3)&0.2<x\leq 0.3\end{array}\right. \tag{10}\]\[\mu_{Med}(x)=\begin{cases}\begin{array}{cc}0&x\leq 0.3\ or\ x>0.7\\ 10*(x-0.3)&0.3<x\leq 0.4\\ 1&0.4<x\leq 0.6\\ 1-(10*(x-0.6))&0.6<x\leq 7\end{array}\\ \mu_{Hi}(x)=\begin{cases}\begin{array}{cc}0&x\leq 0.6\ or\ x>1\\ 10*(x-0.6)&0.6\leq x\leq 0.7\\ 1&0.7<x\leq 1\end{array}\\ \end{cases}\end{cases} \tag{11}\]  
Figure 4: Input membership function—overloaded gateways.  
Figure 3: Input membership function—gateway availability.