# CATSWoTS: Context Aware Trustworthy Social Web of Things System
## 3 Context Aware QoS Trust Management
### Trust Management
#### 3.2.3 QoS Manager  
Two categories of QoS constraints (positive and negative) are found in the state of the art as described in [37]. Examples of positive constraints are availability, reliability, performance, and throughput. The high value of a positive constraint means high quality of service, whereas the high value of a negative constraint means the low quality of service. Latency and cost are the two examples of negative constraints. There can be different positive and negative constraints that can help with evaluating the quality services. Reputation is also another criterion that is found in the literature, which helps in evaluating trust. The QoS constraints that are considered in the CATSWoTS are shown in Table 1.  
QoS managers are also part of both user level and central level. The algorithm for QoS based identification is shown in Algorithm 2  
The QoS managers perform two major tasks:  
1. Evaluation of services based on QoS criteria,
2. Feedback calculation and updating the record.  
As per SS requirements, services are identified from the shortlisted services fulfilling QoS constraints. The services that are found in the database of an SS means that the SS has already directly experienced the quality of such services and the trust level of such services is already maintained.  
If the required service is not found in the database of an SS, then a broadcast request is sent to a social circle for the recommendations. If the services are found in different social relations, then lists of recommendations are returned to the SS from its social network. These lists are sent in sorted form displaying the services fulfilling the required criteria of Context-Aware QoS. After receiving the list, the local QoS manager at SS end considers this recommendation by applying a mathematical model shown in Equation (4).  
\begin{table}
\begin{tabular}{c c} \hline \hline
**QoS Constraints** & **Definition** \\ \hline Reliability & Reliability degree for service \\ Availability & Existence and availability of the service. \\ Latency & The interval between stimulation and response \\ Reputation & Feedback score is given by service consumers to a web service \\ \hline \hline \end{tabular}
\end{table}
Table 1: Quality of service constraints definitions.  
\[R=(\sum_{i=1}^{N}q_{1}+\sum_{i=1}^{N}q_{2}+\sum_{i=1}^{N}q_{n})/N. \tag{4}\]  
The combined list of recommended services is then shown to SS. The list is sorted in descending order in which services with minimum distance is shown on the top.  
After consuming a service, the SS that is now an SC gives feedback about the quality of the service. A profile is maintained for the consumed service in the local database of SC and the feedback is also sent to the central server, hence it can be presented as an indirect trust to another SS.  
Trust is calculated through the feedback given against each QoS criterion and then Fij, the aggregated value for each QoS constraint, is updated with Equation (5):  
\[F_{ij}=((\omega_{i}X_{ij})+F_{ij})/t_{ij}, \tag{5}\]  
where the weight of each criterion allocated by the service seeker is denoted by '\(\omega\)' whereas the feedback assigned by the service seeker, for constraint '\(i\)' satisfied by the device '\(j\)', is denoted by \(X_{ij}\) is and for how many times the device '\(j\)' has been evaluated for the constraint '\(i\)' is symbolized by \(t_{ij}\). The total value of trust '\(T_{j}\)' is calculated for service provider \(j\) with Equation (6):  
\[T_{j}=\sum F_{ij}. \tag{6}\]  
The whole process of identifying potential services, then getting feedback and updating it is summarized in the form of flowchart shown in Figure 5.