# A Bidirectional Trust Model for Service Delegation in Social Internet of Things
## 3 Trust and Service Delegation Model
### Trust Model
#### 3.1.2 Direct Trust  
In this paragraph, we introduce the direct trust which is based on the direct interaction records between objects A and B.  
* **Task Similarity** Due to the different context of each task, the importance of different past interaction comments to the current task is different and should be decided by the task similarity. To this end, we use the Jaccard Similarity Index to estimate the similarity of two task in the different context, which is expressed as follows. \[Sim(\varphi,\varphi^{\prime})=J(p_{\varphi},p_{\varphi^{\prime}})=\frac{|p_{ \varphi}\cap p_{\varphi^{\prime}}|}{|p_{\varphi}\cup p_{\varphi^{\prime}}|}\] (14)  
For a simple example, we assume there are, in total, four properties, such as {\"High Definition\", \"Least Memory\", \"Location Range\", \"Real-Time\", and \"Measurement Accuracy\"}. If the property is required in the task, then the corresponding value of the property vector is set to \"1\" and otherwise \"0\". If the \(\varphi\) is a video monitoring task, then the \(p_{\varphi}\) may be equal to {1, 1, 1, 1, 0}. If the \(\varphi^{\prime}\) is crowdsensing noise monitoring, then the \(p_{\varphi^{\prime}}\) may be equal to {0, 1, 1, 0, 1}. Then the similarity between \(\varphi\) and \(\varphi^{\prime}\) is equal to 2/5.  
* **Time Window** The evidence is time dependent. Recent task performance has a greater effect than the older task on the trust evaluation of the object. The time window is presented for the time-dependent strength of single evidence, which is shown in Figure 3.  
Based on the time window, the strength of single evidence can be expressed as follows:  
\[\hat{\chi}^{t_{\varphi}}_{B\gets A}(\varphi)=\left\{\begin{array}{l} \Upsilon^{t_{\varphi}}_{B\gets A}(\varphi)e^{-\lambda(t_{c}-t_{\varphi})},\quad|t_{c}-t_{\varphi}|\leq\theta_{t}.\\ 0,\quad|t_{c}-t_{\varphi}|>\theta_{t}.\end{array}\right. \tag{15}\]  
where \(t_{c}\) denotes the current time and \(\lambda\) denotes the decay factor, which affects the rate of decay of the evidence strength.  
* **Evidence Strength** By aggregating the valid direct interaction records, that is, a batch of valid single evidence, we can calculate the total strength of direct evidences as follows: \[\gamma^{d}_{B\gets A}(\varphi)=\sum_{\hat{\chi}^{t_{\varphi}}_{B\gets A }(\varphi^{\prime})>0}\hat{\Upsilon}^{t_{\varphi}}_{B\gets A}(\varphi^{ \prime})Sim(\varphi,\varphi^{\prime}),\] (16) \[\overline{\gamma}^{d}_{B\gets A}(\varphi)=-\sum_{\hat{\chi}^{t_{\varphi}}_{B \gets A}(\varphi^{\prime})<0}\hat{\Upsilon}^{t_{\varphi}}_{B\gets A}( \varphi^{\prime})Sim(\varphi,\varphi^{\prime}).\] (17)
* **Direct Trust Calculation** By combining the methods of task similarity, time window, and evidence strength, we can calculate the direct trust vector \(\overline{T}^{d}_{B\gets A}(\varphi)\) of the object B from the viewpoint of A for the task \(\varphi\) by substituting Equations (16) and (17) into (12). Therefore, the _problem 1_ is addressed through the above design and analysis.  
Figure 3: The design of time window for trust evaluation.