# SCoPE: Service Composition and Personalization Environment
## 5 ECE Environment
### Step: 3--Service Composition and Ranking  
Considering Mr. [PERSON]'s scenario, the relevance level indicated for _bloodPressure_ and _homeSafety_ are _high_ and _very high_, respectively. The first process excludes services that do not cover the needs with the desired relevance. Considering the mapping of Table 11 and the _high_ relevance indicated for _bloodPressure_ care need, we only consider services with _high_ or _very high_ adherence level, thus the \(s_{2}\) (\(sp_{21}\) and \(sp_{22}\) fragments) and \(s_{3}\) (\(sp_{33}\) fragment) services are eliminated. Similarly, for the _homeSafety_ care need, services \(s_{1}(sp_{11}\) fragment), \(s_{3}\), and \(s_{4}\) (\(sp_{41}\) fragment) are discarded. Therefore, Table 11 shows the remaining {service, provider} pairs for Mr. [PERSON]'s care needs, with the corresponding _pa_ values. An example of cost values is also included, to illustrate the next steps. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Fragment**} & \multicolumn{2}{c}{\(pa_{1}\)} & \multicolumn{2}{c}{\(pa_{2}\)} & \multirow{2}{*}{_ad_} & \multirow{2}{*}{**Cost**} & \multirow{2}{*}{**Cost**} & \multirow{2}{*}{**Cost-Benefit Ratio (\%)**} \\  & _(\(ca_{1}\) = Blood Pressure)_ & & & & & \\ \hline \(sp_{11}\) & 0.885 & 0.622 & 0.75 & 100 \(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\)\(\,\,\)The service composition process can then proceed using this group of \(sp_{ij}\) fragments, which have a reasonable adherence level. Various alternative composition methods are considered. For instance, a method based on the greedy constructive strategy [66], which composes services based on maximization of values. The greedy strategy builds the solution \"care need by care need\", i.e., for each care need, a choice is made regarding the \(sp_{ij}\) that looks best for that care need (better \(pa\)). In situations that two services have the same \(pa\) value for the same care need, both are considered as greedy options, and more than one integrated solution can be found. Considering the number of care needs is \(m\), then the services set will have at most \(m\) services. Another possible method seeks to minimize the number of service providers. This can be attempted by minimizing the number of included services, which will probably reduce the number of service providers, and increase the chances of better integration for service delivery. Since having several service providers may decrease delivery disruption risks, a third method can be adopted to consider this goal. Other methods can be considered depending on the ECE current goals or plans [29]. Table 12 summarizes some composition strategies and their corresponding benefits. In the above discussion, service _adherence_ is the leading criterion for service ranking. However, other constraints and parameters can be used. For instance, the relation between service cost and adherence, services number, the number of involved providers, ECE management strategies or decisions (personalized choice), historical information about service performance, service reputation, etc. The customer interaction is primordial at this stage of negotiation and solution selection. Algorithm 4 shows a partial service composition and ranking algorithm in a simplified pseudo code formalism. Table 13 shows some example solutions for Mr. [PERSON]'s scenario. The first solution has an _ad_ value of 0.906, the highest adherence to the needs. A single fragment (\(sp_{64}\)) can satisfactorily attend all Mr. [PERSON]'s care needs (_solution_ 2) with _ad_ of 0.715. Next solutions are based on service provider minimization and have a _ad_ of 0.755 and 0.774.