# 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 Component
However, because belonging and not belonging are fuzzy and indeterminate, the fuzzy power set \(F(U_{f})\) is the general form of the ordinary power set \(P(U_{f})\), which can be represented as \(F(U_{f})\supset P(U_{f})\). Consequently, the fuzzy relationship between two-factor fuzzy input and the data transmission process can be evaluated by a classical Mamdani fuzzy inference system. After establishing the fuzzy mapping from factor subset to evaluation subset in the domain \((0,1]\), CMFI needs to define a valid membership function for each fuzzy input. Referring to the membership function of the traditional trapezoidal distribution and the variation trend of node information in the simulation experiment, we set the low, medium, and high membership functions in the proposed curve trapezoid Mamdani fuzzy inference system [21] for the two-factor fuzzy input from the node \(node_{i}\) as the following Equations (A5)-(A7), respectively. \[\mu_{\widetilde{A}_{low}}=\left\{ \begin{array}{c}1\ \ x_{j}^{node_{i}} \leq p_{1}\\ \\ \left(\frac{p_{2}-x_{j}^{node_{i}}}{p_{2}-p_{1}}\right)^{k}p_{1}\leq x_{j}^{node _{i}}\leq p_{2}\\ \\ 0\ \ x_{j}^{node_{i}}>p_{2}\end{array} \right.\] (A5)  
\[\mu_{\widetilde{A}_{high}}=\left\{ \begin{array}{c}0\ \ x_{j}^{node_{i}} \leq p_{1}\\ \\ \left(\frac{x_{j}^{node_{i}}-p_{1}}{p_{2}-p_{1}}\right)^{k}p_{1}\leq x_{j}^{ node_{i}}\leq p_{2}\\ \\ 1\ \ x_{j}^{node_{i}}>p_{2}\end{array} \right.\] (A6)  
\[\mu_{\widetilde{A}_{medium}}=\left\{ \begin{array}{c}0\ \ x_{j}^{node_{i}} <p_{1}\\ \\ (\frac{x_{j}^{node_{i}}-p_{1}}{p_{2}-p_{1}})\ \\ 1\ \ p_{2}\leq x_{j}^{node_{i}}<p_{3}\\ \\ (\frac{p_{4}-x_{j}^{node_{i}}}{p_{4}-p_{3}})\ \\ 0\ \ p_{4}\leq x_{j}^{node_{i}}\end{array} \right.\] (A7)  
For the low membership functions, when the energy and cache level are between 0 and \(p_{1}\), the node can effectively process data information. On the other hand, when the remaining energy or cache level is higher than the highest level of the network \(p_{2}\), the node will be assigned more heavy tasks from the network and consume a lot of network resources. For the medium membership function, when a node's energy or cache level is higher than the network's highest level \(p_{3}\) or lower than the network's lowest level \(p_{2}\), the node's membership level continues to decline due to heavier network tasks and fewer network resources. For the high membership function, when the energy and cache level is lower than \(p_{1}\), the node will die. Moreover, when it is higher than the maximum energy level of the network \(p_{2}\), the membership level of this node is 1 all the time. For each of two-factor fuzzy input, three levels of membership degree can be generated from the three levels of membership function. With Zadeh representation notation, the three levels of membership subsets for the two-factor fuzzy input from the node \(node_{i}\) can be represented by:  
\[\left\{ \begin{array}{c}\widetilde{A}_{low}=\frac{\mu_{\widetilde{A}_{high}} \left(x_{1}^{node_{i}}\right)}{x_{1}^{node_{i}}}+\frac{\mu_{\widetilde{A}_{high }}\left(x_{2}^{node_{i}}\right)}{x_{2}^{node_{i}}}\\ \\ \widetilde{A}_{medium}=\frac{\mu_{\widetilde{A}_{medium}}\left(x_{1}^{node_{ i}}\right)}{x_{1}^{node_{i}}}+\frac{\mu_{\widetilde{A}_{medium}}\left(x_{2}^{node_{ i}}\right)}{x_{2}^{node_{i}}}\\ \\ \widetilde{A}_{high}=\frac{\mu_{\widetilde{A}_{high}}\left(x_{1}^{node_{i}} \right)}{x_{1}^{node_{i}}}+\frac{\mu_{\widetilde{A}_{high}}\left(x_{2}^{node _{i}}\right)}{x_{2}^{node_{i}}}\end{array} \right.\] (A8)  
Meanwhile, the coordinate graphs of the three levels of membership functions (low, medium, and high curve trapezoid membership functions) are demonstrated in Figure 11, where (a), (b), and (c) represent the low, medium, and high curve trapezoid membership functions, respectively. As shown in the subfigures (a), (b), and (c) and the above Equations (A5)-(A7), \(p_{1},p_{2},p_{3},p_{4}\) represent four different syncopation points and \(k\) is the exponent of different levels of trapezoid function.