# An Adaptive Delay-Tolerant Routing Algorithm for Data Transmission in Opportunistic Social Networks
## Appendix A The Details of Curve-Trapezoid Mamdani Fuzzy Inference System
### The Fuzzy Inference Component  
To be specific, the fuzzy inference component is the mapping from the fuzzy factor subset to fuzzy evaluation subset, where the fuzzy factor subset can be defined as the membership level responding to membership degree and the fuzzy evaluation subset can be regarded as the membership level responding to transmission evaluation value. From the mathematic expression of the control engineering theory, the fuzzy factor subset of the proposed fuzzy inference system can be formalized as:  
\[FI_{node_{i}}(x_{j}^{node_{i}})=\left\{\overline{A}_{i_{low}}^{x_{j}^{node_{i }}},\overline{A}_{j}^{node_{i}},\overline{A}_{high}^{x_{j}^{node_{i}}}\right\} (j=1,2) \tag{10}\]  
In the above Equation (11), \(FI_{node_{i}}(x_{j}^{node_{i}})\) represents the fuzzy factor subset of different levels of membership degree from the \(node_{i}\), and \(\overline{A}_{low}^{x_{j}^{node_{i}}},\overline{A}_{medium^{i}}^{x_{j}^{node_ {i}}}\overline{A}_{high}^{x_{j}^{node_{i}}}\) are low, medium, and high fuzzy subsets responding to low, medium, and high membership degree for the two-factor fuzzy input from the \(node_{i}\), respectively. For each fuzzy input, the proposed fuzzy system constructs three levels of fuzzy factor subsets, so for two different fuzzy inputs, there are six different subsets of fuzzy evaluation, and nine different fuzzy rules and nine different subsets of fuzzy evaluation subset will be generated in the system. Therefore, the mapping relationship \(R\) from factor subsets to evaluation subsets can be represented as:  
\[FR(x_{j}^{node_{i}}):U_{f}\rightarrow\left\{\overline{A}_{i_{low}}^{x_{j}^{node _{i}}},\overline{A}_{medium^{i}}^{x_{j}^{node_{i}}}\right\}(j=1,2) \tag{11}\]  
Based on the computation method of the maximum membership principle from Mamdani fuzzy inference system [13], the final determined fuzzy subset of each fuzzy input \(\mu^{x^{node_{i}}}\) for the two-factor fuzzy input from the node \(node_{i}\) can be represented as the union before intersection of its three levels of fuzzy factor subsets, which can be shown as:  
\[\mu^{x^{node_{i}}}=\sum\limits_{j=1}^{2}\left\{\mu_{\overline{A}_{low}}\left( x_{j}^{node_{i}}\right)\vee\mu_{\overline{A}_{medium}}\left(x_{j}^{node_{i}} \right)\vee\mu_{\overline{A}_{high}}\left(x_{j}^{node_{i}}\right)\right\} \tag{12}\]  
Table 1 demonstrates nine fuzzy rules from the two-factor fuzzy subsets to the evaluation fuzzy subsets based on 'If-Then' fuzzy rules of the curve-trapezoid Mamdani fuzzy inference system. From Table 1, it is evident that the impact of the remaining energy level of nodes on data transmission is deeper than those of the remaining cache level of nodes. This is because nodes will die automatically  
when their energy is exhausted or below the minimum network energy limit; otherwise, when they are not sufficiently cached, nodes simply cannot store the data information from the message carrier but still alive. As shown in Table 1, different combinations of fuzzy subset inputs correspond to different fuzzy subset outputs, each of which indicates the membership degree of the corresponding fuzzy rule on the data transmission process, representing the fuzzy uncertain relationship between the two-factor fuzzy input and data transmission in opportunistic networks [36; 37; 38]. According to two-condition nine-rule fuzzy inference logic from CMFI, Figure 10 illustrates the classification process of neighbor nodes from source node utilizing trichotomy law, in which active, potential, and under-resourced relay nodes correspond to high (levels 1-3), medium (levels 4-6), and low (levels 7-9) membership levels, respectively. Active relay nodes are users who move frequently and have a high information processing capacity with high energy and cache priority. On the contrary, under-resourced nodes can be considered as dead users due to their low remaining energy and cache space. Potential relay nodes may be regarded as reliable next hop users in the future.