# Trust-Aware Fog-Based IoT Environments: Artificial Reasoning Approach
## 4 Subjective Logic Trust Model
### Subjective Logic  
Subjective logic is emerging as a reasoning method to express trust relationships as a subjective opinion with a degree of uncertainty. Subjective logic, a type of belief theory, is based on the idea that trust is subjective and that everyone experiences it dif  
Figure 2: Trust and reputation operational cycle. ferently [10, 17, 35]. Subjective logic is suggested to be the most appropriate for modeling trust in the Fog computing environment [10, 47] as each node computes another node's trust value it encounters subjectively. It is impractical for nodes to include all relevant trust metrics when determining node's trust rating. This means that trust is calculated based on a lack of proof, and that each node calculates its subjective trust levels for each node it meets [10, 35]. Opinions are used as input and output variables in the subjective logic method. An opinion \(\omega_{x}\)[48] is defined as:  
\[\omega_{x}=(b_{x},d_{x},u_{x},a_{x}) \tag{4}\]  
where \(b_{x}\) denotes the degree of belief that \(x\) is trustworthy, \(d_{x}\) denotes disbelief, \(u_{x}\) denotes uncertainty of trust relation, and base rate \(a_{x}\), atomicity, indicates the prior probability of \(x\) in the absence of evidences. The summation of variables \(b_{x}\), \(d_{x}\) and \(u_{x}\) equals 1. The node computes the aforementioned subjective trust tuple values using the acquired observations and reported experiences from other nodes, as shown in the equations below (5)-(7). \[b_{x}= \frac{pos}{pos+neg+k} \tag{5}\] \[d_{x}= \frac{neg}{pos+neg+k}\] (6) \[u_{x}= \frac{k}{pos+neg+k} \tag{7}\]  
where the \(pos\) and \(neg\) denote positive and negative acquired observations, respectively, and \(k=1\). The discount operator \(\otimes\) is used to weigh the node's recommendations with the past opinion about the recommender. For example, the discount operator is used when node \(i\) intends to compute the reputation values for node \(j\) based on a recommendation from the intermediate node \(k\) as shown in Figure 2(a). In this situation, high trust values are a direct effect of the weight of trusted recommenders and vice versa. Two opinions are averaged using the consensus operator \(\oplus\), which is shown in Figure 2(b). For more details about \(\otimes\) and \(\oplus\) refer to [4]. Reputation can be acquired by carrying out both operators, \(\otimes\) and \(\oplus\), on the collected recommendations as a subjective trust. This scenario has been illustrated in Figure 2(c). Suppose node \(i\) has a list of recommenders with the following trust levels at time \(t\) as \(T^{t}_{i,r1},T^{t}_{i,r2},\dots,T^{t}_{i,rn}\) and these recommenders have trust levels about \(j\) at the time \(t\) as \(T^{t}_{r1,j},T^{t}_{r2,j},\dots,T^{t}_{rn,j}\), then once the discounting and consensus operators have been applied, the reputation of \(j\) is calculated as:  
\[R^{t}_{i,j}= (T^{t}_{i,r1}\otimes T^{t}_{r1,j})\oplus(T^{t}_{i,r2}\otimes T^{t }_{r2,j})\quad\oplus\dots\oplus(T^{t}_{i,rn}\otimes T^{t}_{rn,j}) \tag{8}\]  
Figure 3: (a) Discounting operator, (b) Consensus operator, (c) Computation of reputation. In order to calculate the direct trust of the \(j\), the aforementioned trust attributes are utilized. The direct trust of \(j\) as evaluated by \(i\) at time \(t\) is computed utilizing the following Formula (9):  
\[T_{i,j}^{t}=\beta A_{i,j}^{t}+\gamma R_{i,j}^{t}+\delta E_{i,j}^{t}+\eta O_{i,j} \tag{9}\]  
where \(0\leqslant(\beta,\gamma,\delta,\eta)\leqslant 1\) and \((\beta+\gamma+\delta+\eta)=1\). The weighting factors of availability and reliability should be set to high values to encourage nodes to provide a reliable service whenever needed. The detailed steps of the trust computation and updating trust-related tables are described in Algorithm 1. The trust level \(\Psi_{i}^{j}\) is in range of \([0\,1]\), where \(1\) indicates complete trust and \(0\) is complete distrust.