# SCoPE: Service Composition and Personalization Environment
## 5 ECE Environment
### Step: 2--Adherence Calculation
For the other cases, we calculate the _closeness_ based on the distance of customer's requirements to {service, provider} fragment features. Following the situations (a), (b), and (c) above, the adopted \(CL\) calculation is done by:  
\[\mathbf{CL}=\left\{ \begin{array}{ll}\mathbf{cl_{\textit{{ crisp}}}}&\left|if\text{ {requirements are expressed in crisp value}}\right.\\ \mathbf{cl_{\textit{fuzzy}}}&\left|if\text{requirements are expressed in fuzzy scale}\right.\\ \mathbf{cl_{\textit{flex}}}&\left|if\text{requirements are presuppose flexibility} \right.\end{array} \right\} \tag{14}\]  
Calculation for situation (a)--a crisp comparison:  
\[\mathbf{cl_{\textit{{ crisp}}}}=\frac{\textit{{customer}}^{\prime}\textit{s { requirement}}}{\{\textit{{ service, provider}}\}\,\textit{fragment feature}} \tag{15}\]  
For instance, if the customer wishes a maximum cost of 50 \(\mathbf{\  
Calculation for situation (c)--based on service provider flexibility:  
At an individual level, flexibility is the ability to incorporate variations in the execution of the care service within a process definition by customer request. For instance, modification of service delivery in response to a customer desire. As such, the specific request is represented by parameters characterizing the flexibility level, e.g., delivery conditions, business process, service features, etc. We consider different flexibility zones, for instance, the service provider can be _very flexible_ for delivery resources, but _not very flexible_ to change the business process. Table 7 shows a possible scale of flexibility degrees. If the service provider has a flexibility level _very flexible_, _clfhex_ has value \"1\". For instance, if a customer requests a car with a specific colour for delivering a service (e.g., red car), the request has a _very high_ exigency level (corresponding to a _very flexible_ service provider), and the service provider has a _Moderately flexible_ flexibility level; thus, the corresponding _clfhex_ is \"0.5\". Algorithm 2 shows a partial closeness calculation algorithm in a simplified pseudo code formalism. ```
function Closeness; // ECE is the ecosystem, \(cu\) is the customer, \(ca\)' is a care need, and \(SEW\) = {\(<\alpha\), \(se\), \(w>\)}, where \(ca\) is a care need, \(se\) a service that attends this care, and \(w\) weight of the service associated with the taxonomy (calculated in Algorithm 1) and \(req\) is customers requirements Input: ECE, \(cu\), SEW, RE // The output is a set containing tuples composed of a requirement \(req\), a service \(se\), and the adherence \(ad\in[0,1]\) of the service \(se\) to the requirement \(req\) Output: CL[n] = {\(<\) se, req, ad >} // Variables var n=req; // number of requirements var t; // a vector // Main while SEW.hasTuples do \(t\) \(\leftarrow\) SEW.nextTuple(); \(i\) \(\leftarrow\)1; foreach req in t.ca.getRequirements do foreach feat in t.se.getFeatures do if (req.id = fea.id) then // simplified function switch req.type do case FUZZY do
```  
**Algorithm 2** Closeness Adherence Algorithm \begin{table}
\begin{tabular}{c c c} \hline \hline
**Flexibility Degree** & **Flexibility Level** & **Description** \\ \hline
**1** & _Very flexible_ & Always or almost always adapts to the customer’s request. \\
**0.75** & _Flexible_ & Usually adapts to the customer’s request. \\
**0.5** & _Moderately flexible_ & Sometimes adapts to the customer’s request. \\
**0.25** & _Not very flexible_ & Seldom adapts to the customer’s request. \\
**0** & _Not flexible_ & Never adapts to the customer’s request. \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Provider flexibility scale. At the end, a _closeness_ vector \(\mathbf{CL_{m}}=\{cl_{1},cl_{2},\ldots,cl_{n}\}\) is calculated, where the number of elements (\(n\)) corresponds to the number of requirements. For instance, if we considered the previous scenario examples, \(\mathbf{CL_{1}}=\{0.83,0.89,0.5\}\) is obtained. _Sub-step 2--Weighted PA vector calculation_.