## 3 Three-Layer Cloud Dispatching Architecture
### Cluster Selection Layer  
After completing the classification of the category assignment cluster layer, the classified tasks can be dispatched to the corresponding category cluster. Subsequently, a Cluster Selection Algorithm (CSA) is proposed to assign the tasks to appropriate clusters by using the factors of Reliability (\(R_{i}\)), Cost (\(C_{i}\)), and MakeSpan (\(M_{i}\)) [3,21], as shown in Equations (1)-(3). MakeSpan is the length of time to complete a task. Basically, when the MakeSpan value increases, the system will need longer operation time. Due to the similarity of the fault tolerance of clusters, the computing power will increase as the Reliability gets higher. Therefore, we need to focus on clusters' computing power [3,21]. Finally, the cost factor is defined as the cost needed for a task to be sent and responded to. When taking these three factors into account, tasks can be assigned to suitable clusters and the system efficiency can be enhanced. In addition, users and service providers can customize those three factors based on their own requirements. According to the above description, in the following example, we customize the \begin{table}
\begin{tabular}{c c} \hline \hline
**Notations** & **Description** \\ \hline \(N\) & The total number of tasks \\ \(L\) & The total number of clusters \\ \(k\) & The cluster \(k\) \\ \(n_{k}\) & The number of tasks assigned to the \(k\) cluster \\ \(T_{r}\) & The threshold value of the overall reliability \\ \(T_{c}\) & The threshold value of the overall cost \\ \(A_{i}\) & The assignment \(i\) \\ \(R_{k}\) & The reliability of the cluster \(k\). \\ \(M_{k}\) & The makespan of the cluster \(k\) \\ C\({}_{k}\) & The cost of the cluster \(k\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The descriptions of notation in the cluster selection layer. Reliability (\(R_{i}\)) and Cost (\(C_{i}\)), and arrange the tasks to the suitable clusters. The reliability and the cost of assignment \(i\) are expressed by  
\[R_{i}=\left(\sum_{k=1}^{C}R_{k}n_{k}\right)/N \tag{1}\]  
and  
\[C_{i}=\left(\sum_{k=1}^{L}C_{k}n_{k}\right) \tag{2}\]  
respectively. Moreover, the makespan of assignment \(i\) is expressed by  
\[M_{i}=\left(\sum_{k=1}^{C}M_{k}n_{k}\right)/N \tag{3}\]  
Subsequently, we propose an example to explain Algorithm 1. In Line (4) of Algorithm 1, we arrange the combination of tasks in all clusters. The cluster will choose an appropriate task combination and then help the node to adjust these tasks. Furthermore, Lines (5) to (8) are proposed to check if the \(R_{i}\) and \(C_{i}\) of each assignment \(i\) agree with \(R_{i}\geq T_{r}\) && \(C_{i}\geq T_{c}\). Then, among those assignments, the one with the smallest \(M_{i}\) is scheduled. If there are more than two eligible groups, we compare \(R_{i}\) and \(M_{i}\) and choose \(A_{i}\) as the combination of the highest reliability and the least time. In CSA, users can customize the quality of services by reliability, cost, and MakeSpan factors. Thus, algorithms can meet the requirements of various users and can enhance the efficiency of job scheduling. Subsequently, an example is shown to explain the CSA algorithm and the related assumptions are shown in Table 2.  
We assumed that there are 10 tasks need to be sent to 3 cloud clusters; the process is the following: Step 1: \(T_{r}\) and \(T_{c}\) are set by the user. In this example, \(T_{r}\) and \(T_{c}\) are 22 and 260, respectively. Step 2: Calculate \(R_{i}\), \(C_{i}\), and \(M_{i}\) of each allocation combination.