Diversity-Aware Marine Predators Algorithm for Task Scheduling in Cloud Computing

With the increase in cloud users and internet of things (IoT) applications, advanced task scheduling (TS) methods are required to reasonably schedule tasks in cloud computing. This study proposes a diversity-aware marine predators algorithm (DAMPA) for solving TS in cloud computing. In DAMPA, to enhance the premature convergence avoidance ability, the predator crowding degree ranking and comprehensive learning strategies were adopted in the second stage to maintain the population diversity and thereby inhibit premature convergence. Additionally, a stage-independent control of the stepsize-scaling strategy that uses different control parameters in three stages was designed to balance the exploration and exploitation abilities. Two case experiments were conducted to evaluate the proposed algorithm. Compared with the latest algorithm, in the first case, DAMPA reduced the makespan and energy consumption by 21.06% and 23.47% at most, respectively. In the second case, the makespan and energy consumption are reduced by 34.35% and 38.60% on average, respectively. Meanwhile, the algorithm achieved greater throughput in both cases.


Introduction
Cloud computing is a large resource pool that is dynamic and scalable, and the data center of a third-party service operator provides resources. Users can directly use the computing and storage resources of the cloud servers through the network [1], and internet of things (IoT) applications are deployed on the cloud. It has facilitated applications based on artificial intelligence and IoT [2], whereas, with the many conveniences brought by cloud computing, the increasing task to be processed and expansion of cloud resources also make scheduling cloud resources challenging.
Cloud resource scheduling has two main layers. The first layer schedules appropriate virtual resources for tasks submitted by users, and the second layer schedules appropriate hosts for virtual resources. This study focuses on the first layer because task scheduling in cloud computing (TSCC) directly affects the quality of services (QoS) parameters [3], such as the makespan, energy consumption, resource utilization rate, task response time, and task rejection rate. Under the constraints of QoS parameters, mapping a set of tasks to a suitable virtual resource is an NP-hard problem [4,5], and the algorithm suffers from dimensionality breakdown as the problem sizes increase.
Hence, ideas that apply meta-heuristic algorithms (MHAs) to TS have emerged to efficiently allocate available resources to complex and diverse incoming tasks within a reasonable time and with limited resources because of some of its inherent properties, such as its stochastic behavior. In addition, it has no dependency on the problem being solved and can search the solution space quickly to find the approximate optimal solution. Classical meta-heuristics, such as GA [6], PSO [7], novel whale optimization algorithm (WOA) [8], and Harris hawks optimization (HHO) [9] have been applied to TSCC successfully. Although many MHA have been applied to cloud computing task scheduling problems, these algorithms tend to fall into the local optimum, resulting in high energy consumption of the system, long task completion time and other problems, affecting the overall optimization effect. This study applies a novel MHA, the marine predators algorithm (MPA), to solve TS in cloud computing. The motivation for this is that the MPA algorithm is capable of avoiding falling into the local optimum and achieves excellent performance in the optimization of complex problems [10]. To further strengthen the performance of the MPA algorithm and find a better solution that satisfies the QoS parameters, we propose a diversity-aware marine predators algorithm (DAMPA) to reduce makespan and energy consumption and increase throughput. Two strategies were used in the DAMPA to raise the variety of the population and prevent premature convergence. First, the predator crowding degree ranking strategy was designed to determine whether a predator performs exploration or exploitation in the second stage. Second, a comprehensive learning strategy was applied to enable predators to share the best experience. In addition, a stage-independent control of the stepsize-scaling strategy in DAMPA, which uses different control parameters in three stages, was designed to balance the exploration and exploitation abilities. The main contributions of this study are described below: (1) The DAMPA is proposed for resolving TSCC in reducing makespan and energy consumption and increasing throughput. (2) To avoid premature convergence, the predator crowding degree ranking strategy is designed, and the comprehensive learning strategy is applied. (3) A stage-independent control of the stepsize-scaling strategy is designed to balance the exploration and exploitation abilities.
This article's structure is as follows: Section 2 discusses the similar works on TSCC. Section 3 introduces the problem formulation of the TS. Section 4 first introduces the MPA algorithm and then elaborates on our proposed DAMPA algorithm. Section 5 presents an experimental evaluation consisting of tests for multiple indicators. Section 6 is the conclusion of this work.

Related Works
TSCC has received considerable attention from scholars. Marahatta et al. [11] proposed a scheduling approach that first classifies heterogeneous tasks and virtual machines (VMs), then similar types of tasks are combined and scheduled. Additionally, it exploits the energy efficiency and optimal operating frequency of heterogeneous physical hosts to save energy when creating and deleting VMs. Hussain et al. [12] divided TS into two stages according to the optimization objectives. The first stage of scheduling focuses on reducing the execution time of the tasks, and the second stage is to reduce energy consumption.
In addition to classification-based and phased scheduling methods, meta-heuristic algorithms are key in solving TS problems in cloud computing because of their superior performance in the optimization of complex problems. For example, Chen et al. [13] used the WOA algorithm for improving the efficiency of task execution. Abdullah et al. [14] combined the PSO algorithm with the Pareto optimal frontier, and a mutation operator was introduced to avoid premature convergence. Laili et al. [15] designed a parallel TS algorithm, which divides tasks into several groups, finds the best solution with metaheuristic algorithms for each group and then merges all sub-solutions into the final solution. This algorithm decreases the total execution time and energy consumption, but the TS model is complex. Ali et al. [16] proposed an optimization model based on NSGA-II that realizes automatic mapping between tasks and cloud nodes and minimizes the total execution time.
To reduce the makespan, Xiong et al. [17] introduced Johnson's rule to GA, which adds a new crossover and the mutation operation. Pirozmand et al. [18] first prioritized tasks and then assigned tasks to VMs using GA. Pang et al. [19] introduced the estimated distribution algorithm (EDA) to the GA algorithm to initialize the solution. Xu et al. [20] prioritized the TS sequence according to the priority algorithm and used the ant colony algorithm (ACO) to obtain a global optimal scheduling scheme under certain constraints.
Because of the limitations of a single meta-heuristic algorithm, several scholars have adopted a hybrid bio-inspired algorithm. For example, Attiya et al. [21] combined the manta-ray foraging optimizer (MRFO) and Salp Swarm algorithm (SSA), which strengthens the exploitation capability, and the results indicate that the approach outperforms the existing algorithms. Similarly, Walia et al. [22] combined GA with the flower pollination algorithm (FPA), and the crossover and mutation of the GA are introduced in the FPA. Domanal et al. [23] used an improved PSO to find a better solution for mapping tasks to VMs and adopted a modified hybrid bio-inspired algorithm for resource allocation according to the needs of the tasks. Fu et al. [24] combined the PSO and GA algorithms to reduce the task completion time. Although hybrid algorithms have achieved better results in several indicators, they are also overly complex.
Based on the above analysis, various algorithms have been applied to the TS. The optimization of makespan, energy consumption, and throughput, three important indicators of TS, is still insufficient. Therefore, a new method based on MPA was proposed for TSCC.

Task Scheduling
In the cloud, the data center receives the tasks uploaded through the network, and the broker allocates the tasks to the appropriate available resources according to the task requirements and information of the VMs and optimization goals. TS in the cloud can be summarized as the mapping of a group of tasks {T 1 , m is the total number of tasks to be processed, n is the total number of virtual machines. T i has a corresponding task size, and the key factors of V M j are processing speed, RAM, and CPU processing elements. One task can only be assigned to one VM, and each VM executes multiple tasks. In this study, our goal is to map tasks to VMs to decrease the makespan and energy consumption and increase throughput.

Mathematical Model
In the TS process, D ij represents the decision variable of the allocation process, which is expressed as follows: The ranges of the subscripts i and j of the decision variable D ij are the number of tasks and the number of virtual machines respectively. When the number of virtual machines or tasks increases, more decision values are required. Since each task must be handled by just one VM, and since the schedule allocates all the tasks, we have The processing time of T i on V M j can be calculated by the following: where t ij represents the processing time of T i on V M j , W i represents the task size of task T i , S j represents the processing speed of V M j .

Makespan
We assumed that each VM starts executing the first task from time 0 until the last task is executed, and the time spent during this period is the total execution time of V M j . The makespan can be calculated as follows: where t j represents the total execution time of V M j , t M represents the makespan.

Energy Consumption
The energy consumed by VMs includes the idle state and the working state. The consumption of VMs in the idle state is approximately 0.6 times the working state [25]. The total energy consumption (TEC) is calculated as follows:

Throughput
Throughput metric measures, the performance of the cloud system to complete tasks over a period is reflected in work completed by the cloud data center per unit of time. It can be calculated as follows:

Fitness Function
The fitness function measures the performance of individuals. Based on our optimization goals of energy consumption, makespan, and throughput, as makespan is a key factor in throughput, we set the objective function to the following to evaluate the candidate solutions: where λ 1 + λ 2 = 1, we set λ 1 = 0.5 and λ 2 = 0.5.

The Proposed Algorithm
This part first introduces the MPA algorithm to present its optimization process, and then the proposed DAMPA algorithm is elaborated. There are three differences between DAMPA and MPA: the predator crowding degree ranking strategy, comprehensive learning strategy, and stage-independent control of the stepsize-scaling strategy.

Elite and Prey Matrix
Based on the theory of survival of the fittest, the best predators are better at foraging in natural survival. Therefore, the optimal solution is set as the top predator. The optimal solution for each predator constructs the El matrix. The El matrix is as follows: The prey matrix (P e ) and the El matrix are similar, the Pe matrix saves the new value produced each iteration, and the El matrix represents the historical optimal solution of the predators. The P e matrix is expressed as follows: where − → I P j = I P j,1 , I P j,2 . . . I P j,d . In the initialization phase of the algorithm, the values in the P e matrix will be randomly generated within the specified range, the optimal solution − → I E will be obtained through calculating each − → I P , and the El matrix will be initialized by duplicating − → I E .

Optimization Process
In the first stage, all predators perform exploration. Taking advantage of the Brownian motion step sizes helps predators approach the optimal target more quickly at the initial stage when they are far from the optimal target. Formulated as follows, when where − → L i represents the step size of each predator, − → M B is a vector composed of standard normal distribution random numbers (RND), − → R is a uniform RND vector in [0, 1], and P is a constant, − → Pe i and − → El i are the row vector of the matrix, iter is the current number of iterations, and Maxiter is the maximum number of iterations.
The second stage involves the shift from exploration to exploitation. Half of the predators adopted the exploitation strategy, and the remainder adopted the exploration strategy. When 1 3 Maxiter < iter < 2 3 Maxiter, we have the following. First one-half of predators: Other predators: where − → M L is a RND vector generated based on the Levy distribution and CF controls the step sizes of the predators and can be calculated as follows: In the third stage, all individuals are in a state of Levy movement and execute the exploitation strategy, when iter > 2 3 Maxiter: In simulating the survival of predators, the eddy taking shape or fish aggregation device (FADs) effect in the environment also causes predators to adjust to their movement states. A broad range of jumps helps the algorithm avoid stagnancy in the local optima. The FADs effect is expressed as follows: where FADs = 0.2 represents the probability that the solution is affected during the update process, r is a RND in [0,1], and R is a RND vector in [0,1]. − → Pe l consists of the minimum value in each dimension and − → Pe u consists of the maximum value in each dimension. U is a binary number, and i1 and i2 are random indices. Finally, the pseudocode of the MPA is expressed as Algorithm 1. Update Pe using (13) and (14) 9: else if 1 3 Maxiter < iter < 2 3 Maxiter then 10: First one-half of predators: 11: Update Pe using (15) and (16) 12: other predators: 13: Update Pe using (17) and (18) 14: else if iter > 2 3 Maxiter then 15: Update Pe using (20) and (21) 16: end if 17: Compute the fitness 18: Saving memory 19: Applying FADs effect using (22) 20: In the optimization process of the MPA, the second stage, which carries out the transition from exploration to exploitation, is indispensable. Here, the MPA algorithm neglects the population diversity when selecting predators to perform exploitation and exploration. If predators that are closer to each other are selected for exploitation in the second stage, the population diversity will be prematurely reduced. Therefore, to raise the variety of the population and thereby avoid premature convergence, the predator crowding degree ranking strategy is adopted in the DAMPA. The crowding degree of a predator describes the magnitude of the location difference between the predator and the remaining predators in the population, if a predator is close to other predators, it has a larger crowding degree. After the end of the first stage in the DAMPA, the crowding degree of each predator is calculated using (23) and (24), and rank the predators according to their degree of crowding from small to large. The predators with lower rankings execute the exploration, and the remaining predators execute the exploitation. The number of predators executing the two strategies was the same. Algorithm 2 shows the crowding degree ranking algorithm. We assume that − → Pe i is the current predator and − → Pe j is the other predator. The mathematical expression for crowding degree (CD) is as follows: Computing CD i based on (23) and (24) 4: end for 5: for j = 0 to PopulationSize do 6: for k = 0 to PopulationSize do 7: if CD j < CD k then 8: Ranking j + + 9: end if 10: end for 11: end for 12: return Ranking

Comprehensive Learning Strategy
In DAMPA, a comprehensive learning strategy is also applied in the second stage, which enables the exchange of best experiences between predators. This maintains the population diversity and avoids premature convergence [26]. Predators with high crowding degrees are given a larger learning rate to maximize the population diversity, and the learning rate of predators can be calculated by the following: where c = 0.05, and e = 0.5. A comprehensive learning strategy is shown in Algorithm 3. First, the learning rate Pe l of the predators was calculated. Subsequently, a random value r is generated, and predators Pe k1 and Pe k2 are randomly selected. When r < Pe l , the fitness value of each predator was calculated. If the fitness value of Pe k1 is less than Pe k2 , then Pe k1 is used as an exemplar. Otherwise, Pe k2 was used as an example. If r > Pe l , then the predator is used as an exemplar.
Next, in the second stage, we applied comprehensive learning, in which (15) and (17) are replaced by (26) and (28), respectively.
First one-half of predators: Algorithm 3 Comprehensive learning strategy.

Stage-Independent Control of Stepsize-Scaling Strategy
In MPA, P is the parameter of step size scaling, which controls the enlargement or reduction of the step sizes in three stages simultaneously. Figure 1 shows the convergence performance at each stage with different step sizes scaling control parameters. When P = 0.1, the algorithm performs better in the first stage and has a strong exploration ability, but the exploitation ability is insufficient in the third stage. When P = 0.5, the algorithm has a strong exploitation ability, but the exploration ability in the first stage is insufficient. Therefore, to balance the exploration and exploitation capabilities of the MPA algorithm, the stage-independent control of the stepsize-scaling strategy is designed in DAMPA to optimize the performance at each stage by using P 1 , P 2 , and P 3 to control the scaling of the step sizes of the three stages. The control parameter is set to P 1 in the first stage. The second stage corresponds to P 2 . In the third stage, we have P 3 .

Complexity Analysis
The complexity of the MPA algorithm is O(T(Pd × Ps + C × Ps)), the crowding degree ranking algorithm is O(Ps × Ps × Pd), and the comprehensive learning strategy is O( 1 3 × T × Ps). The DAMPA complexity is O(T(Pd × Ps + C × Ps) + Ps × Ps × Pd), where T is the maximum iterations, Ps is the amount of predators, C is the evaluated cost, and Pd is the dimension of predators.

Experiment and Analysis
This section introduces the dataset settings, parameter settings, and experimental results compared with those of other algorithms. The proposed DAMPA is written based on the Java language, and the experimental computer specifications are inter-core i7-9700CPU@3.0GHZ, 32 GB RAM, Windows 10 64-bit operating system, Cloudsim4.0.

Data Set
The establishment of the dataset was mainly from the perspectives of tasks and VMs. It was considered in two cases to simulate resource-limited and resource-rich situations.

Case1
The number of VMs is fixed at 50, and the processing speed of each VM to 2000 + j × 40, where j is the index of the VMs and j = 1, 2, 3 . . . 50. The tasks is set to 100, 200, 300, 400, 500, 600, 700, and 800. The size of the tasks was randomly generated within [200, 12,000].

Case2
The number of tasks is fixed at 200, and the size of each task was set to 1000 + i × 5, where i is the index of the tasks and i = 1, 2, 3 . . . 200. The VM is set to 50, 60, 70, 80, 90, 100, 110, 120, and 130. The S j of the VMs was generated in [200, 12,000] randomly.

Parameter Setting
We compared the proposed algorithm with existing algorithms including IMMPA [27], WOA, MRFOSSA [21], and HHO to verify our algorithm performance. Table 1 lists the parameter settings of the algorithms, the population size is 50, and the maximum iteration is ten thousand. Each algorithm was run twenty times independently, and the results were averaged.

Discretization
At this stage, since the proposed optimization algorithm contains continuous values, it needs to be discretized. The continuous values of predator need to be converted to discrete values (VMs number). First, the predator vector is normalized as follows: where min and max are the minimum and maximum values in the predator vector − → I , respectively. NV is the new value generated by each update in the vector − → I , and normalized NV represents the normalized value. After that, the following equation is used to scale the value in vector − → I : where scaled NV is the scaled value, n is the number of virtual machines.

Experimental Results
In the first case, the fitness under different numbers of tasks is shown in Table 2, which indicates that DAMPA obtains a lower fitness value than IMMPA, HHO, MRFOSSA, and WOA. DAMPA has a small improvement based on IMMPA, and a large improvement based on HHO, MRFOSSA, and WOA. Table 3 shows the makespan under the different number of tasks. The makespan value increases when the amount of tasks to be processed increases. DAMPA obtains the lesser makespan value. To more accurately describe the effect of optimization, Table 4 compares the percentage of makespan decrease of different algorithms, when the task size is minimal and the makespan value is reduced by 2.60%, 11.56%, 16.27%, and 31.37%, over IMMPA, HHO, MRFOSSA, and WOA. With the expansion of the scale of the scheduling problem, finding a solution becomes difficult for all algorithms, and the overall optimization effect of DAMPA is constantly weakening. DAMPA improved by 7.38% at most based on IMMPA and improved by 1.86-11.56%, 12.59-21.06%, 7.58-31.37% based on HHO, MRFOSSA, and WOA respectively. Table 5 lists the TEC under the different numbers of tasks. More energy is consumed with an increasing number of tasks. DAMPA consumes less energy than IMMPA, HHO, MRFOSSA, and WOA. More specifically, Table 6 describes the improvement percentage in TEC. When the task size is minimal, the TEC is reduced by 0.99%, 17.64%, 23.47%, and 33.14% over IMMPA, HHO, MRFOSSA, and WOA, respectively. As the scale of the problem increases, the optimization effect of DAMPA weakens on the whole. Compared with IMMPA, HHO, MRFOSSA, and WOA, the improvement ranges are 0.07-6.33%, 1.85-17.64%, 11.57-23.47%, and 5.60-33.14%, respectively. The throughput of the system under different numbers of tasks is depicted in Figure 2, which shows that DAMPA achieves a greater throughput than IMMPA, HHO, MRFOSSA, and WOA.    In the second case, Figure 3 shows the effect of different numbers of VMs on fitness. The fitness value keeps increasing with the number of VMs increasing, which is caused by more energy consumption. The fitness value of DAMPA is below IMMPA, HHO, MRFOSSA, and WOA. The makespan for different numbers of VMs is shown in Figure 4, which indicates that DAMPA obtains a lower makespan value than IMMPA, HHO, MRFOSSA, and WOA. More VMs enable DAMPA, IMMPA, MRFOSSA, and HHO to find better scheduling schemes, makespan continues to decrease, and the WOA algorithm has the largest fluctuation. Table 7 lists the percentage reduction of makespan, the increase in VMs scale has no obvious impact on the optimization effect of DAMPA, the makespan was reduced by 6.81%, 26.92%, 34.35%, and 50.60% on average over IMMPA, HHO, MRFOSSA, and WOA, respectively. The TEC of VMs is shown in Figure 5, which shows that the DAMPA consumes less energy. To obtain more accurate results, Table 8 lists the percentage of TEC optimization, the TEC is reduced by 6.30%, 27.04%, 38.60%, and 47.50% on average over IMMPA, HHO, MRFOSSA, and WOA, respectively. Figure 6 shows the system throughput for different VMs. The DAMPA achieves a greater throughput of all algorithms.
Summarizing case 1 and case 2, when there are many tasks with limited resources, the improvement of DAMPA based on other algorithms is up to 33.14% at most, when the available resources increase, DAMPA can reduce the makespan by 50.60% and the energy consumption by 47.50% at most.

Conclusions
This study proposes a novel meta-heuristic algorithm DAMPA for solving TSCC. In DAMPA, the predator crowding degree ranking strategy and comprehensive learning strategy are taken to maintain the diversity of the population, thereby avoiding premature convergence. In the second stage of DAMPA, the predators are selected to perform exploration or exploitation according to the ranking of the crowding degree of the predators, and a comprehensive learning strategy makes predators share the optimal historical experience. Additionally, to balance the exploitation and exploration capabilities of the algorithm, a stage-independent control of the stepsize-scaling strategy is designed, which uses different control parameters for scaling the step sizes in three stages. Two case experimental results show that DAMPA achieves lower makespan and energy consumption and greater throughput compared with the latest algorithms: IMMPA, HHO, MRFOSSA, and WOA. Especially in the second case, DAMPA has a distinct advantage in solving TSCC problems.
In the future, we will focus on applying the DAMPA algorithm to other problems, such as cloud-fog collaborative TS with constraints and cloud-edge collaborative TS.