# SCoPE: Service Composition and Personalization Environment
## 5 ECE Environment
### Step: 2--Adherence Calculation
For each care need \(m\), the \(G(cl_{m})\) coefficient is the average of _closeness_\(CL\) vector elements given by:  
\[G(cl_{m})=\frac{\sum_{x=1}^{n}cl_{x}}{n}. \tag{18}\]  
_PA_ combines the \(G(cl)\) coefficient and compares the service coverage level (\(CO\)) in relation to the customer's care needs relevance (\(RL\)). For each care need \(m\), a corresponding \(pa_{m}\) is calculated. The \(CO\) is defined when the service provider registers a service in the ECE and it is associated with a care need. The \(RL\) is defined by the customer when the care need is requested. \(CO\) and \(RL\) coefficients are expressed in a fuzzy scale. However, they are often checked and adjusted at any time if necessary. The condition presented below gives the _PA_ calculation. \[pa_{m}=\left\{ \begin{array}{ll}G(cl_{m})\cdot[1+distance(CO_{m},RL_{m})]&if \ cov_{m}\geq rl_{m}\\ G(cl_{m})\cdot[1-distance(CO_{m},RL_{m})]&otherwise\end{array} \right\} \tag{19}\]  
where _distance_ represents the distance between \(RL\) and \(CO\) (given by Equation (12)) related to care need \(m\). Our partial adherence calculation method is shown in Algorithm 3 using a simplified pseudo code formalism. At the end, the vector \(PA=\{pa_{1},pa_{2},\ldots,pa_{m}\}\) is calculated, where the number of elements (\(m\)) correspond to the number of customer's care needs. For instance, considering \(sp_{ij}\) fragment associated to two care needs with \(co_{1}=high\) and \(co_{2}=low\), and with a relevance level \(rl_{1}=medium\) and \(rl_{2}=high\) and \(CL=\{0.83,0.89\}\), the corresponding \(pa_{1}\) is 0.92 (for the first care need), and \(pa_{2}\) is 0.69 (for the second care need), thus \(PA_{sp_{ij}}=\{0.92,0.69\}\). _Sub-step 3--Adherence (ad) Calculation. ad_ represents the \"global\" adherence covering all care needs and is given by:  
\[ad=\frac{1}{m}\sum_{x=1}^{m}pa_{x}. \tag{20}\]  
An example is shown in Table 8.  
At the end, a solution's matrix is presented. Table 9 illustrates the matrix structure: the first column identifies the solution fragment (\(sp_{ij}\)), the next columns include the partial adherence \(pa_{m}\) for each care need \(m\), the next column is \"global\" adherence \(ad\) for the current \(sp_{ij}\) solution, and the last columns are the price of solution (\(cost\)) and the relation between the adherence and the corresponding price of solution (\(cost\)-benefit ratio). \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Solution** & \(pa_{1}\) & \(pa_{2}\) & \(ad\) \\ \hline \(sp_{ij}\) & 0.92 & 0.69 & 0.81 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Illustrative example of _Solution_ combining with \(pa\) and \(ad\). \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Solution** & \(pa_{1}\) & \(pa_{2}\) & \(\ldots\) & \(pa_{m}\) & \(ad\) & **Cost** & **Cost-Benefit Ratio** \\ \hline \(sp_{11}\) & \(pa_{ci_{1}}\) & \(pa_{ci_{2}}\)(\(sp_{11}\)) & \(\ldots\) & \(pa_{ci_{m}}\)(\(sp_{11}\)) & \(ad\)(\(sp_{11}\)) & \(cost\)(\(sp_{11}\)) & \(\frac{ad(sp_{11})}{cost(sp_{11})}\) \\ \hline \(sp_{22}\) & \(pa_{ci_{m}}\)(\(sp_{22}\)) & \(pa_{ci_{m}}\)(\(sp_{22}\)) & \(\ldots\) & \(pa_{ci_{m}}\)(\(sp_{22}\)) & \(ad\)(\(sp_{22}\)) & \(cost\)(\(sp_{22}\)) & \(\frac{ad(sp_{22})}{cost(sp_{22})}\) \\ \hline \(sp_{23}\) & \(pa_{ci_{m}}\)(\(sp_{23}\)) & \(pa_{ci_{m}}\)(\(sp_{23}\)) & \(\ldots\) & \(pa_{ci_{m}}\)(\(sp_{23}\)) & \(ad\)(\(sp_{23}\)) & \(cost\)(\(sp_{23}\)) & \(\frac{ad(sp_{23})}{cost(sp_{23})}\) \\ \hline \(\ldots\) & \(\ldots\) & \(\ldots\) & \(\ldots\) & \(\ldots\) & \(\ldots\) & \(\ldots\) & \(\ldots\) \\ \hline \(sp_{ij}\) & \(pa_{ci_{m}}\)(\(sp_{ij}\)) & \(pa_{ci_{m}}\)(\(sp_{ij}\)) & \(\ldots\) & \(pa_{ci_{m}}\)(\(sp_{ij}\)) & \(ad\)(\(sp_{ij}\)) & \(cost\)(\(sp_{ij}\)) & \(\frac{ad(sp_{ij})}{cost(sp_{ij})}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Solution’s matrix structure.