A New Black Widow Algorithm for Discontinuous Optimization in Cloud Task Environment

Task scheduling in cloud environment has received extensive attention due to its complex characteristics, and most of the previous methods ignore the discontinuity problem of workflow scheduling. Therefore, a new black widow optimization algorithm (NBWO) is proposed. NBWO proposed a new reproductive strategy to select excellent male individuals and female individuals to obtain better offspring. In NBWO, the number of female individuals is fixed, and males obtain mating rights through competition; NBWO improves the mutation strategy, which makes the exploration ability and development ability of the algorithm more balanced. Applying NBWO to cloud computing task scheduling, the experimental results show that NBWO has excellent performance in dealing with discontinuous optimization problems.


Introduction
Cloud computing is a new infrastructure, and its essence is a kind of distributed computing, which provides elastic and heterogeneous computing resources through the network. Resource utilization in a cloud environment can be significantly improved, and construction and maintenance costs can be amortized to customers. In the cloud environment, users can obtain services on demand according to their own conditions. However, task scheduling in cloud environment faces challenges such as heterogeneous resources and complex costs [1]. Task scheduling is an NP-complete problem [2], so it is difficult for mathematical programming methods to deal with it in a reasonable time [3]. In recent years, several studies based on meta-heuristics have shown excellent performance in task scheduling problems. However, each meta-heuristic algorithm has its own weaknesses. The methods based on GA [4] are sensitive to parameters and tend to converge prematurely; the methods based on ACO [5] have the problem of slow convergence; the traditional black widow algorithm (BWO) [6] performs poorly when dealing with discontinuous optimization problems. In this study, a new black widow optimization algorithm is proposed to deal with discontinuous optimization problems.

Initialization population
The population is initialized as the number of spiders, so that each spider can represent a potential solution. In d-dimensional optimization problems, a black widow individual is an array of 1*d, representing a solution to the optimization problem. The array is defined by equation (1)

Procreate
Select nr excellent individuals from the population according to their fitness and save them in pop1, nr=NP*PP, PP is the fertility rate. I n pop1, two individuals are randomly selected for mating each time, and d offspring are produced according to equation (3). This process requires a random number α, x1 and x2 for parents, and y1 and y2 for children.
This process is repeated d/2 times, and randomly selected numbers are not repeated. After mating, the spider father will be eaten, and the spider mother and their children will be kept and added to an array and sorted by their fitness value to proceed to the next stage. Based on cannibalism ratings, some of the best individuals are added to the newly generated group.

Cannibalism
The black widow algorithm includes three kinds of cannibalism. The first is that the female black widow eats the male black widow after mating in the Procreate stage. The gender of an individual is judged by fitness, and a female individual with a smaller fitness value. The second is cannibalism between siblings. Strong black widow spiders eat weak siblings. In the algorithm, the number of surviving spiders can be controlled by setting a cannibalistic parameter CR. The third is where young spiders eat their mothers, using fitness values to determine strong or weak young spiders.

Mutation
At this phase, nm individuals are randomly selected from pop1, where nm=NP*PM, and PM is the mutation rate. The selected individuals randomly swap the values of the two dimensions, As shown in Figure 1.

A new black widow algorithm
The performance of the standard black widow algorithm significantly degrades when dealing with discontinuous optimization problems, in order to solve this problem, this paper proposes a new black widow algorithm.

Improved Procreate phase
The fertility process of the modified black widow algorithm has the following steps: • Sort the population by fitness, and select the top nm outstanding individuals as female individuals, nm=NP*mp, where mp is the proportion of female individuals in the population. Because in the natural world, female black widow spiders are much larger and more viable than male black widow spiders, the individuals with the highest fitness in the population are selected as female individuals. • The remaining NP-nm individuals are male, and they are randomly grouped with two individuals in each group, and then the individuals with poor fitness in each group are eliminated. This step is to simulate the male individuals fighting each other for mating rights in nature. Some individuals will encounter predation by natural enemies, etc., continue to randomly eliminate some male individuals until the number of male and female individuals is equal. • The procreate process largely determines the development ability of the algorithm, and the strength of the development ability determines the convergence speed of the algorithm. In order to enhance the development performance of the algorithm and accelerate the convergence speed of the algorithm, a new offspring generation strategy is designed. Randomly pair female individuals and screened male individuals to breed d offspring according to equation (4).
Where x1 is a female individual, x2 is a male individual, y is the offspring, and  is a random number. x1+x2 is the direct fusion of male and female individuals, which ensures the diversity of the population. x1-x2 is to adjust the direction of the newly generated offspring vector, so that it is biased towards female individuals with better fitness, which enhances the development ability of the algorithm.
The improved reproductive process more vividly reflects the actual situation of the black widow's reproductive process. Due to the fighting among male individuals and some individuals being preyed by natural enemies, the number of female individuals is much smaller than that of male individuals, and mp is set to 0.3 in this paper.

Improved cannibalism
In the Modified black widow algorithm, we added a form of cannibalism, where male black widows kill each other for the right to mate. The specific operation is to randomly divide the male black widow into a group of two individuals and let them kill each other. The winner will have the opportunity to obtain the right to mate, and the weak will be eaten by the winner.

Improved Mutation
The reproductive process determines the development ability and convergence speed of the algorithm, and the mutation strategy affects the exploration ability of the algorithm, preventing the algorithm from prematurely falling into local optimum. However, if the exploration ability is too strong, it will affect the convergence speed of the algorithm. This paper proposes a balanced mutation strategy to balance the exploration ability and development ability of the algorithm. The improved mutation process is as follows: • In order to ensure the diversity of the population and enhance the exploration ability of the algorithm, each individual in the population has the opportunity to mutate. Randomly select nm individuals from the population to participate in the mutation, nm=NP*PM, PM is the mutation rate, which represents the proportion of the number of mutant individuals to the total number of individuals in the population. • Each individual participating in the mutation randomly selects two dimensions m and n, and rerandomly assigns all dimensions between m and n. Since this mutation method is too exploratory, further processing of the mutated individuals is required, as shown in Figure 2. • Use equation (5) to adjust the direction of the individual vector of the mutation, so that it is biased towards the global optimal solution to balance the exploration ability and development ability of the algorithm. w is a random number between 0 and 1, pi is the ith mutant individual, and best is the global optimal individual in the current generation

Cloud computing task scheduling experiment and analysis
This paper only studies the maximum optimization of the task completion time. Cloud computing task scheduling is to assign task M to virtual machine V to minimize the total completion time of all tasks. In equation (6), M represents the task sequence, and m represents the number of tasks. In equation (7), V represents the sequence of virtual machines, and v is the number of virtual machines. In equation (8), A matrix T of m*v is used to store the time consumed by each task executing on each virtual machine, and Ti,j is the time required for the ith task to execute on the jth virtual machine, that is, the ith task The length of the task divided by the performance of the jth virtual machine. S is the scheduling sequence of tasks.
The fitness function F is the total completion time of all tasks. According to the time cost matrix T and the task scheduling sequence S, F can be calculated using equation (9).

Parameter setting
The number of cloud tasks is set to 100, 300, 500, 700, 900 and 1000 respectively; the length of each cloud task is a random value from 10000 to 100000; the number of virtual machines is set to 7, and its performance is 699, 1299, 1899, 2399, 2899, 3399, 3999 (unit:MIPS).The parameters of the BWO, DE and PSO algorithm are shown in the table 1. The population size of all algorithms was set to 500, and the number of iterations was set to 500.  Table 2, where ti represents the total completion time of i cloud tasks (unit: seconds). Figure  3-8 shows the convergence effect of different numbers of cloud tasks on different algorithms.
It can be seen from the experimental results that BWO has a fast convergence speed, but it is easy to fall into a local optimum; PSO and DE have similar performance, but both have the problem of too slow convergence; NBWO retains the advantages of BWO's fast convergence speed, and its optimization ability It is also far superior to PSO and DE, and as the number of tasks increases, the advantages of NBWO are also increasing.

Conclusion
In this paper, a new improved black widow optimization algorithm is proposed to deal with the task scheduling problem in cloud environment. In NBWO, a new reproductive strategy was introduced, whereby male individual mate with females through competition to obtain superior offspring. In addition, an improved mutation strategy is proposed to balance the exploration ability and development ability of the algorithm, and reduce the local exploration ability to avoid local optimal solutions. Under the condition of guaranteed convergence, the search ability is enhanced. In conclusion, the proposed NBWO is efficient and stable for discontinuity problems.   Figure 4. The number of cloud tasks is 300. Figure 5.The number of cloud tasks is 500. Figure 6.The number of cloud tasks is 700.  Figure 7.The number of cloud tasks is 900. Figure 8.The number of cloud tasks is 1000.