## 3 Framework
Applying an MCDM method results in prioritized sets of SPs, tasks, and resources. The main reason to have separately prioritized SPs and prioritized resources is to enable task execution based on their tendency. \"Task tendency\" means that if the customer's preference shows more of a tendency toward the execution of his/her tasks, the tasks will be assigned to the best available resources among the prioritized resources, regardless of the SPs that the resources belong to. On the other hand, if the customer is more concerned with criteria related to the overall evaluation of SPs, his/her tasks will be assigned to the resources of the best available SPs. To illustrate the task tendency, suppose that the framework has three criteria for evaluating tasks: completion time, availability, and reputation. Suppose that the customer's evaluation shows that reputation is the most important criterion (80%), followed by availability (15%) and completion time (5%). In this case, we say that the task tends to the SPs more than the resources; therefore, we assign it to the best available SPs. Suppose that the results show the completion time (70%) to be the most important, followed by reputation (20%) and availability (10%). In this case, we say that the task tends to the resources more than the SPs; therefore, we assign it to the best available resource. We propose that the threshold for measuring the tendency of the tasks be based on (1) the number of SP-based/resource-based criteria and (2) the overall weight of the criteria resulting from the MCDM method. Finally, it is important to have a suitable mechanism for managing the load among the available resources; many mechanisms have been provided, as mentioned in the literature. However, the load fairness assignment is beyond the scope of this study; therefore, we examine the proposed method without considering this issue. Algorithms 1 and 2 show the steps of prioritizing and scheduling tasks. ```
Input:1. Sets of SPs, tasks, and resources. 2. Sets of criteria for SPs, tasks, and resources. Output: Prioritized SPs, tasks, and resources 1. Select the MCDM method. 2. Each SP evaluates its overall capability, and preferences are acquired. 3. Each SP evaluates tasks, and preferences are acquired. 4. Each SP evaluates the capability/performance of its resources, and preferences are acquired. 5. Apply the selected MCDM method to each evaluation. 6. Calculate the overall weight of each set of criteria. 7. Prioritize SPs. 8. Prioritize tasks. 9. Prioritize resources. ```  
**Algorithm 1**Prioritization of Tasks, Service Providers, and Resources  
```
Input: Prioritized SPs, tasks, and resources. Output: Assignment of tasks to the best available resources. 1. Calculate the tendency of each task based on a certain threshold. 2. Based on the task tendency, store each task in either the \"Is-tendency-to-SPs\" list or \"Is-tendency-to-resources\" list. 3. Calculate the overall ranking of tasks for the \"Is-tendency-to-SPs\" list. 4. Calculate the overall ranking of tasks for the \"Is-tendency-to-resources\" list. 5. Assign each task in the \"Is-tendency-to-SPs\" list to a resource in the best available SPs. 6. Assign each task in the \"Is-tendency-to- resources\" list to the resource in the best available resources regardless of its SPs. ```  
**Algorithm 2**Scheduling of Tasks Based on Their Tendencies