## 3 Materials and Methods
### Proposed Algorithm
The ratio \(P\) can be calculated with Equation (20) [6; 11]. \[P=\frac{|T_{l}|}{|T|} \tag{20}\]

Let task \(T_{i}^{r}\) represent a candidate task, where \(r\) = {1,2,3,4} represents the CPU, memory, bandwidth, and storage requirements of the task and \(V_{j}^{r}\) represents a VM in which \(r\) = {1,2,3,4} represents the CPU, memory, bandwidth, and storage capacity of the VM, respectively. The matching degree of task \(T_{i}^{r}\) with VM \(V_{j}^{r}\) can be calculated with Equation (21) [6; 11]. \[P(T_{i}^{r}|V_{j}^{r})= \begin{cases}(V_{j}^{r}/T_{i}^{r})^{2},&\text{if }T_{i}^{r}> V_{j}^{r}.\\ (V_{max}^{r}-V_{j}^{r}+T_{i}^{r})/V_{max}^{r},&\text{otherwise}.\end{cases}  \tag{21}\]

where \(V_{max}^{r}=k\in U^{max}V_{k}^{r}\) and \(k\) represents the type of VM. The possibility that a task \(T_{j}\) belongs to type \(Y_{j}\) can be calculated with Equation (22) [11]. \[P(Y_{j}|T_{i})=\Pi_{r=1}^{4}P(T_{i}^{r}|V_{j}^{r}) \tag{22}\]

The proposed algorithm uses PSO to optimize the scheduling problem. After the preprocessing phase, scheduling with PSO starts. Initially, particles are positioned randomly with a random velocity. During the execution, the particles are updated with the desired fitness function. The process is repeated iteratively, and the variables are updated in each iteration. The proposed algorithm uses the fitness function shown in Equation (15). Algorithm 5 shows the steps. The pseudocode of Algorithm 3 is a modified version of that from [13]. The mapping of resources to tasks in the presence of multiple objectives is a complex and challenging task [28]. In this scenario, a search space is created according to the number of tasks in the workflow. The dimensions of the search space are set to be equal to the number of tasks. The values of the dimensions are taken according to the number of VMs, i.e., from 1 to the number of VMs. In this study, the notations from previous studies [13; 32] are used to represent the mapping of tasks to VMs, i.e., \(x_{i}^{t}=(x_{i1}^{t},x_{i2}^{t},\ldots,x_{ij}^{t})\), where \(x_{ij}^{t}\) represents that, at time \(t\), the \(j\)th place of a particle is assigned to \(VM_{i}\). The number of tasks in the workflow represents the dimensions of the search space. The velocity is represented by \(v_{i}^{t}=(v_{i1}^{t},v_{i2}^{t},\ldots,v_{ij}^{t})\), where \(v_{ij}^{t}\) represents the velocity, which shows that, at time \(t\), \(VM_{i}\) moves to the \(j\)th place of a particle with velocity \(v\)[13]. In successive iterations, the algorithm finds non-dominated solutions. These solutions are stored in the archive. These solutions are called feasible solutions. Initially, the archive is empty and solutions are stored as long as the algorithms find non-dominated solutions. New solutions are added to the archive only if the new solutions dominate the current solutions. The dominance of the solutions is calculated with the fitness function used. Finally, the archive only contains feasible solutions, which are also referred to as non-dominated solutions. ```
Input : List of tasks, VM list Output : Mapping of tasks to VMs \(P\) = initial population \(p\) = \(i_{th}\) particle from \(P\)  Evaluate \(p\)  Calculate velocity of \(p\) \(gbest\)= global best position \(pbest\) = particles' best position for each particle \(p\) in \(P\)do for each task \(t\) in workflow \(w\)do  initialize \(X_{ij}^{t}\) randomly  initialize velocity \(v\) randomly  evaluate \(p_{i}\)  update \(pbest\) and \(gbest\)  end for  end for  Return the mapping of tasks to VMs
```

**Algorithm 5**PSO-based scheduling algorithm

## 4 Results and Discussion

This section presents the experimental evaluation of the proposed algorithm. Benchmark workflows were used to validate the proposed algorithm [33]. The datasets consist of different workflows with varying numbers of tasks and varying dependency levels. The datasets have been used to validate many scheduling algorithms in cloud environments. Table 1 and Figure 1 show the details and structure of the workflows, respectively [13].