## 4 Fuzzy Logic Based Collaborative Task Offloading
### Defuzzification  
Defuzzification maps the output variable derived from the inference engine of the fuzzy logic system to a crisp value, which should be easily understandable by the human user. For defuzzification, different \begin{table}
\begin{tabular}{l l l l l l l} \hline \hline
**Rule** & **Task** & **Delay** & **Local SBS-MEC** & **Network** & **Neighboring** & **Offloading Decision** \\
**Index** & **Size** & **Sensitivity** & **VM Utilization** & **Delay** & **SBS-MEC** & **VM** & \\ \hline R1 & Small & Medium & Light & Large & Light & Local Edge \\ R2 & Medium & Low & Normal & Medium & Heavy & Local Edge \\ R3 & Medium & Low & Heavy & Short & Light & Neighboring Edge \\ R4 & Large & High & Normal & Large & Heavy & Local Edge \\ R5 & Large & Low & Heavy & Short & Light & Neighboring Edge \\ R6 & Small & Medium & Normal & Medium & Normal & Local Edge \\ R7 & Medium & Low & Heavy & Short & Light & Neighboring Edge \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Example of fuzzy inference system rules. methods are used, such as height and modified height, maximum, mean of maximum, and centroid method. Among them, the centroid defuzzifier method is the most widely used, which returns the center of gravity (COG) of the aggregated fuzzy set [55]. In this study, we used COG method for the defuzzification step. For calculating the COG, the formula given below is used to calculate the centroid, where \(\chi^{*}\) is the x-coordinate of the center of gravity, \(\xi\) depicts the bound formed by the output degree of membership, and \(\chi\) is the edge node suitability. Finding the \(\chi^{*}\) point is the basic principle of the COG method and it uses the vertical line which will slice the aggregate into two equal masses:  
\[COG(Execution),\ \ \chi^{*}=\frac{\int\chi\xi(\chi)d\chi}{\int\xi(\chi)d\chi} \tag{18}\]  
Algorithm 1 shows the FCTO algorithm, which basically decides the target computational node among SBS-MEC servers. At this target node, the users will offload their incoming task requests by considering various factors such as the task characteristics, delay sensitivity, local and neighboring SBS-MEC server utilization, and network delay. The algorithm returns the offloading decision for selecting the local or neighboring SBS-MEC. We assumed that tasks are already offloaded to the local SBS-MEC server from the user device. The algorithm runs on edge orchestration. The edge orchestrator receives three parameters, namely, the task size, delay sensitivity, and local SBS-MEC VM utilization from the local SBS-MEC server. The COG value is initialized in line 1. The values for the other two parameters, network delay and neighboring SBS-MEC VM utilization, were obtained in lines 2 to 4, where \(NeighboringEdge_{nodes}\) indicate neighboring edge node. In line 5, all the input parameters are mapped onto fuzzy sets based on their membership functions which are described in Section 4, and the inference rules from Table 5 are applied. The output of the COG evolves into a crisp value which will be within 0 and 100 after implementing the centroid defuzzifier. If the value of the COG is below 50, the task will offload to the local SBS-MEC server; otherwise, it will offload to the neighboring SBS-MEC server. For example, if the d.o.m. of \(\xi_{localedge}\) and \(\xi_{neighboringedge}\) are 0.2 and 0.5, respectively, then the crisp value will be 58, which is shown in Figure 7b. Therefore, according to the crisp value, the incoming task will be offloaded to the neighboring SBS-MEC server. Figure 7: Output membership function for offloading decision: (**a**) output membership function; (**b**) COG calculation. ```
1:Definitions:
2:Size of task: \(\alpha\)
3:Delay sensitivity: \(\beta\)
4:Local SBS-MEC VM utilization: \(\gamma\)
5:Network delay: \(\delta\)
6:Neighboring SBS-MEC VM utilization: \(\theta\). 7:Input:
8:\(\alpha\), \(\beta\), \(\gamma\) = LocalEdge\({}_{nodes}\), \(\alpha\), \(\beta\), \(\gamma\)
8:Output: Target the SBS-MEC server selection to offload the incoming task.