A task scheduling method for cloud testing platform based on improved genetic algorithm
By improving the genetic algorithm, establishing a task scheduling model and designing a fitness function, the problem of low task scheduling efficiency in the cloud test platform is solved, the dependence between tasks and the optimization of parallel execution are realized, and the processor load balance and task completion time are improved. .
Patent Information
- Application Number
- CN202011377220.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-30
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-11-30
AI Technical Summary
Existing cloud test platform task scheduling methods based on genetic algorithms have limitations in the number of processors, do not consider dependencies between tasks, and ignore processors executing multiple tasks in parallel, resulting in low scheduling efficiency.
A cloud test platform task scheduling method based on an improved genetic algorithm is proposed. By establishing a task scheduling model, encoding task status, designing a fitness function, and using a roulette algorithm to select chromosomes, perform crossover and mutation, and ultimately achieve the shortest time for task scheduling .
It effectively solves the problems of the number of processors, dependencies between tasks and parallel execution of tasks, improves the efficiency of task scheduling and processor load balance, and achieves the completion of all tasks in the shortest time.
Smart Images

Figure CN112486651B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of genetic algorithms for cloud testing platform task scheduling, and in particular relates to a cloud testing platform task scheduling method based on an improved genetic algorithm. Background Art
[0002] As a model of resource management and supply, cloud computing technology virtualizes hardware resources such as computing, storage and network into a resource pool shared by multiple users, and then provides scalable virtual resources to users on demand through the network, breaking through the limitations of physical space.
[0003] The cloud testing platform that applies cloud computing technology to testing can use large-scale virtualized environments to carry out testing. That is, it can use the cloud testing platform to more effectively organize and utilize various test infrastructure resources (computing resources, network resources, storage resources, etc.), and provide a testing method with transparent test resources, on-demand environment, open platform, and efficient execution in the form of services. It provides a new application model for using test services anytime and anywhere, and provides strong support for test activities such as test design, environment establishment, execution management and control, status monitoring, and result analysis.
[0004] The cloud test platform serves many users. The hardware resources required by the tasks submitted by users are different. The dependencies between tasks are complex. Reasonable task scheduling is an important guarantee to ensure that users get timely responses from the cloud test platform and complete tasks on time. The primary goal of test task scheduling is to find a reasonable scheduling strategy under the premise of meeting the task dependency constraints, map the test tasks to the processor in sequence, and execute the tasks in parallel as much as possible so that the system can complete all tasks in the shortest time.
[0005] At present, there are some problems in the research of task scheduling in cloud testing platforms based on genetic algorithms, such as limiting the number of processors, not considering the dependencies between tasks, and ignoring the fact that the processor can execute multiple tasks in parallel. Summary of the invention
[0006] In view of this, the present disclosure proposes a cloud test platform task scheduling method based on an improved genetic algorithm, which can effectively solve problems such as the number of processors, inter-task dependencies and parallel execution of tasks.
[0007] According to one aspect of the present invention, a cloud test platform task scheduling method based on an improved genetic algorithm is proposed, the method comprising:
[0008] Establishing the cloud testing platform task scheduling model;
[0009] Encoding the test task scheduling method based on the cloud test platform task scheduling model to form a test task status table;
[0010] Designing the fitness function of the improved genetic algorithm according to the test task state table;
[0011] Initializing a population of the improved genetic algorithm based on the fitness function, and selecting chromosomes in the population using a roulette algorithm;
[0012] After the chromosomes of the improved genetic algorithm are crossed and mutated, when the end condition of the improved genetic algorithm is met, the shortest time for task scheduling of the cloud testing platform is obtained.
[0013] In a possible implementation, the cloud test platform task scheduling model is a six-tuple G, G = (T, E, S P ,S T ,R,C), where T is the node set of the DAG graph of the cloud test platform task scheduling, E is the matrix of the directed edges of the DAG graph of the cloud test platform task scheduling, S P is the matrix of resources that the processor of the cloud test platform can provide, S T is the matrix of resources required for the test task on the cloud test platform, R is the matrix of the execution time of the test task on different processors, and C is the matrix of the test task conversion time.
[0014] In a possible implementation, the test task scheduling method based on the cloud test platform task scheduling model is encoded to form a test task status table, including:
[0015] The mapping relationship between the test tasks of the test task scheduling mode of the cloud test platform task scheduling model and the processor forms the test task coding table;
[0016] Form a test task status table according to all preconditions for the test task to enter the to-be-executed state and the test task execution status;
[0017] Defining a weight of the test task according to the execution completion time of the test task, and executing the test task according to the weight of the test task;
[0018] The execution completion time of executing all the test tasks is calculated according to the test task status table.
[0019] In a possible implementation, designing the fitness function of the improved genetic algorithm according to the test task state table includes:
[0020] Calculating the load of the processor of the cloud testing platform during the execution of the test task according to the test task status table and the test task coding table;
[0021] Calculate the average value of all processor loads according to the load of the processor to obtain the load balance of the processor during the execution of the test task on the cloud test platform;
[0022] The fitness function of the improved genetic algorithm is set based on the shortest execution time for the cloud testing platform to complete all test tasks and the load balance of the processors of the cloud testing platform during the execution of the test tasks.
[0023] In one possible implementation, the test task status table includes: test task number, processor number, predecessor task of the test task, successor task of the test task, number of computing cores, memory size, hard disk size, completion status of the predecessor task of the test task, satisfaction status of test task required resources, test task pending status, test task executing status and test task completed status.
[0024] In a possible implementation, the calculating the execution completion time of the test task according to the test task status table includes:
[0025] Find the test task T according to the test task coding table i and its corresponding processor P j , searching for the predecessor task and the successor task of the test task according to the DAG graph of the task scheduling model of the cloud test platform;
[0026] The execution time matrix R of the test task on different processors is used to calculate the time allocated to the processor P. j The weights of all test tasks;
[0027] When the test task T i The predecessor task has been completed, and the processor P is judged j Whether the test task T is met i resource requirements;
[0028] When the processor P j Satisfy the test task T i resource requirements, determine the test task T i When the pending status, executing status, and completed status in the test task status table are all 0, the test task T i The pending execution status is set to 1;
[0029] Determine the test task T i In the processor P j When the weight of all the test tasks to be executed on is the largest, the test task T i The executing state in the test task status table is set to 1, the pending state is set to 0, and the processor P jThe resource matrix S provided P Subtract the resources required for the task and record the start time of the test task;
[0030] The test task T i After the execution is completed, the test task T i The completed status in the test task status table is set to 1, and the processor P j The resource matrix S provided P Add the resources required for the task and record the time when the test task is completed;
[0031] Returns the test task T i The start time and end time of the test task T i The execution completion time.
[0032] In a possible implementation, the processor P j The load is, Among them, C, M, and D are processors P j The number of computing cores, memory size, and hard disk size provided, C x T x Processor P in time period j The number of occupied computing cores, M y T y Processor P in time period j The size of the memory occupied, D z T z Processor P in time period j The size of the hard disk occupied;
[0033] The processor P j The load balancing degree is, in, is the average value of all processor loads;
[0034] The fitness function is Among them, a and b are constants, and i and n are positive integers.
[0035] The disclosed cloud test platform task scheduling method based on improved genetic algorithm is as follows: establishing the cloud test platform task scheduling model; encoding the test task scheduling mode based on the cloud test platform task scheduling model to form a test task status table; designing the fitness function of the improved genetic algorithm according to the test task status table; initializing the population of the improved genetic algorithm based on the fitness function, and selecting chromosomes in the population using the roulette algorithm; after performing crossover and mutation on the chromosomes of the improved genetic algorithm, when the end condition of the improved genetic algorithm is met, the shortest time for scheduling the cloud test platform task is obtained. It can effectively solve the problems of the number of processors, inter-task dependency and parallel execution of tasks.
[0036] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0038] Figure 1 A flow chart of a method for scheduling cloud test platform tasks based on an improved genetic algorithm according to an embodiment of the present disclosure is shown;
[0039] Figure 2 A schematic diagram showing a DAG graph of a cloud test platform task scheduling model based on an improved genetic algorithm according to an embodiment of the present disclosure;
[0040] Figure 3 A further defined flow chart of step S2 according to an embodiment of the present disclosure is shown;
[0041] Figure 4 A further defined flow chart of step S24 according to an embodiment of the present disclosure is shown;
[0042] Figure 5 A further defined flow chart of step S3 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0043] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0044] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0045] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0046] The task scheduling method disclosed in the present invention designs a mapping coding method for a test task scheduling algorithm according to the characteristics of tasks in a cloud testing platform, and proposes a method for calculating the test task completion time according to a test task status table in combination with the characteristics of a scheduling algorithm based on a test task coding table. In addition, the fitness function of the genetic algorithm and the calculation formula for load balancing are improved according to important evaluation indicators in cloud testing, and the problems of the number of processors, dependency between tasks, and parallel execution of tasks are effectively solved.
[0047] Figure 1 FIG. 1 is a flow chart of a method for scheduling cloud test platform tasks based on an improved genetic algorithm according to an embodiment of the present disclosure. Figure 1 As shown, the method may include:
[0048] Step S1: Establishing the cloud testing platform task scheduling model.
[0049] Among them, the cloud testing platform task scheduling model can address the problems of existing heuristic and meta-heuristic test task scheduling algorithms that limit the number of processors, do not consider the dependencies between tasks, ignore the situation where the processor can execute multiple tasks in parallel, etc., and combine the characteristics of the scheduling algorithm based on the test task coding table to improve the existing cloud testing platform task scheduling algorithm based on genetic algorithms.
[0050] Figure 2 A schematic diagram of a DAG graph of a cloud testing platform task scheduling model based on an improved genetic algorithm according to an embodiment of the present disclosure is shown.
[0051] For example, suppose there are n processors {p1, p2, ... n}, there are m cloud test tasks submitted by users {T1,T2,...T m}. In general, the number of test tasks m is much larger than the number of processors n. We can define a six-tuple G, G = (T, E, S P ,S T ,R,C) is used to represent the task scheduling model of the cloud testing platform.
[0052] Among them, T is the node set of the cloud test platform task scheduling DAG graph, and E is the matrix of directed edges of the cloud test platform task scheduling DAG graph. Considering the scheduling constraints between cloud test tasks, the constraint relationship between test tasks is represented by a directed acyclic graph DAG. The nodes in the graph represent test tasks, and the directed edges between nodes represent the dependency relationship between test tasks. Figure 2 As shown in the figure, T1 is the predecessor task of T2 and T3, that is, T2 and T3 cannot start before T1 is executed. T5 and T6 are the predecessor tasks of T7, that is, T7 cannot start before T5 and T6 are all executed. According to the definition of the directed edge matrix E of the cloud test platform task scheduling DAG graph, when e ij =1, T i It is T j The previous task of T i Before the execution is completed, T j Cannot start execution, then T i T j The previous task, T j T i The successor task, when e ij =0, T i and T j There is no direct relationship between them.
[0053] S P is the matrix of resources that the processor of the cloud test platform can provide, S T It is the matrix of resources required by the cloud test platform test tasks. When the processor meets the resources required by multiple tasks at the same time, multiple virtual machines can be run simultaneously to perform tasks. Define S p =(C p ,M p ,D p ),S T =(C T ,M T ,D T ), where vector C P ,M P ,D P They represent the number of computing cores, memory size (in GB), and hard disk size (in GB) that the processor can provide. The vector C T ,M T ,D T They represent the number of computing cores, memory size, and hard disk size required for the test task. j Assigned to the designated processor P i If the processor can meet the resources required for task execution (C Tj <C pi 、M Tj <Mpi and D Tj <D pi All meet the requirements), the processor builds a computing core with the number of C Tj 、Memory size M Tj , Hard disk size D Tj The virtual machine executes the test task T j , and subtract the corresponding part from the amount of resources that can be provided. j After the execution is completed, the resources are recycled and the corresponding part is added back to the available resource quantity.
[0054] R is the matrix of the execution time of the test tasks on different processors, and C is the matrix of the test task conversion time. Since the CPU, memory, and hard disk models and performance of each processor are different, the execution time of different test tasks assigned to different processors is different. The element r in the matrix R is ji For task T j Assigned to processor P i The execution time on . The elements C in the matrix C ji Indicates that on the same processor, from task T i End to next task T j The test preparation time and data communication time are started.
[0055] Based on the cloud test platform task scheduling model established above, combined with the characteristics of the scheduling algorithm based on the test task coding table, improvements are made to the existing cloud test platform task scheduling algorithm based on genetic algorithm.
[0056] Step S2: Encode the test task scheduling method based on the cloud test platform task scheduling model to form a test task status table.
[0057] Figure 3 A further defined flow chart of step S2 according to an embodiment of the present disclosure is shown.
[0058] This step may include two layers of operations, the first layer of operation is the encoding method, and the second layer of operation is forming a test task status table.
[0059] In one example, if Figure 2 As shown, step S2 may include:
[0060] Step S21: forming the test task coding table by mapping the test tasks of the test task scheduling mode of the cloud test platform task scheduling model and the processing machines;
[0061] Step S22: forming a test task status table according to all preconditions for the test task to enter the to-be-executed state and the test task execution status;
[0062] Step S23: defining the weight of the test task according to the execution completion time of the test task, and executing the test task according to the weight of the test task;
[0063] Step S24: Calculate the execution completion time of the test task according to the test task status table.
[0064] Among them, encoding is the process of mapping the solution of the cloud testing platform task scheduling method into a mathematical expression of a string or a number string. The solution in the cloud testing task scheduling is an arrangement of the execution order and execution location of the test tasks.
[0065] Since a processor can generate an indefinite number of virtual machines based on the number of resources it can provide and the number of resources required by the test task, directly scheduling the test task to the corresponding virtual machine will result in different lengths of the chromosomes generated by the code, which will bring great difficulties to subsequent operations such as crossover and mutation. Chromosomes can be a possible way to match test tasks and processors in cloud test task scheduling. Each chromosome (scheduling scheme) is an m*1 vector, and the value x corresponding to the subscript i (1≤i≤m) in the vector represents the task T i Assigned to processor P x As shown in Table 1, the corresponding value of the chromosome subscript 1 is 8, which means that task T1 is assigned to processor P8 for execution.
[0066] Table 1 Chromosome coding table
[0067] Vector Subscript 1 2 3 4 5 6 7 Corresponding value 8 5 12 8 3 5 5
[0068] When different test tasks are assigned to the same processor, the scheduling strategy for the execution order of the test tasks can be adjusted and executed according to the weights of the test tasks. For example, test tasks T1 and T4 are both assigned to processor P8. First, it is necessary to determine whether the predecessor tasks of test tasks T1 and T4 have been completed. Assuming that the predecessor tasks of tasks T1 and T4 have been completed, it is necessary to determine whether processor P8 can provide the resources required to execute test tasks T1 and T4. Assuming that the resources are sufficient, it is necessary to determine the execution order of test tasks T1 and T4 based on the weights of test tasks T1 and T4. When the chromosome (test task scheduling scheme), that is, the test task and processor matching method, is timed, it can be seen from steps S241 to S247 that the execution completion time of each test task is also determined (search in matrix R).
[0069] Test Task T i The weight is: Among them, t i For the test task T i The execution time, t j Ti The post-task T j When there are two or more tasks in the waiting state on the same processor, the order of execution is determined by the weight of the task.
[0070] All preconditions for the test task to enter the waiting state and the execution state of the task are summarized to obtain the test task state table of the test task, as shown in Table 2.
[0071] Table 2 Test task status table
[0072]
[0073]
[0074] In one example, as shown in Figure 2, the test task status table may include: test task number, processor number, predecessor task of the test task, successor task of the test task, number of computing cores, memory size, hard disk size, completion status of the predecessor task of the test task, satisfaction status of the test task required resources, test task pending status, test task executing status and test task completed status, a total of 12 items.
[0075] Among them, the test task number can be numbering the test tasks according to the order in which the test tasks are submitted, such as the test task T4 in Table 2. The processor number can be based on the matching method of tasks and processors in the chromosome (test task scheduling scheme), and the value of the corresponding processor when the chromosome vector subscript is 4 is found to be 8, that is, task T4 is assigned to processor P8. The predecessor task of the test task can be found through the DAG graph describing the constraint relationship between the test tasks to find that the predecessor tasks of task T4 are T2 and T3. The successor task of the test task can be found through the DAG graph describing the constraint relationship between the test tasks to find that the successor tasks of task T4 are T5 and T6. The number of computing cores can be the number of computing cores required by test task T4. The memory size can be the memory size required by test task T4 (in GB). The hard disk size can be the hard disk size required by test task T4 (in GB). The completion status of the predecessor task of the test task can be set to 1 when all predecessor tasks are in the completed state, otherwise it is set to 0. The test task required resource satisfaction status can be set to 1 when the processor can meet all the resources required by the test task, otherwise it is set to 0. The test task pending status can be set to 1 when the executing status and the completed status are both 0, and the predecessor task completion status and the required resource satisfaction status are both 1. The test task executing status can be selected according to the weight after the test task pending status judgment is completed, and the test task executing status is set to 1 and the pending status is set to 0. The test task completed status can be set to 1 after the test task is executed, and the executing status is set to 0.
[0076] Figure 4 A further defined flow chart of step S24 according to an embodiment of the present disclosure is shown.
[0077] In one example, if Figure 4 As shown, step S24 may include:
[0078] Step S241: Find the test task T according to the test task coding table i and its corresponding processor P j , searching for the predecessor task and the successor task of the test task according to the DAG graph of the task scheduling model of the cloud test platform;
[0079] Step S242: Calculate the execution time matrix R of the test task on different processors to allocate the time to the processor P. j The weights of all test tasks;
[0080] Step S243: When the test task T i The predecessor task has been completed, and the processor P is judged j Whether the test task T is meti resource requirements;
[0081] Step S244: When the processor P j Satisfy the test task T i resource requirements, determine the test task T i When the pending status, executing status, and completed status in the test task status table are all 0, the test task T i The pending execution status is set to 1;
[0082] Step S245: Determine the test task T i In the processor P j When the weight of all the test tasks to be executed on is the largest, the test task T i The executing state in the test task status table is set to 1, the pending state is set to 0, and the processor P j The resource matrix S provided P Subtract the resources required for the task and record the start time of the test task;
[0083] Step S246: The test task T i After the execution is completed, the test task T i The completed status in the test task status table is set to 1, and the processor P j The resource matrix S provided P Add the resources required for the task and record the time when the test task is completed;
[0084] Step S247: Return to the test task T i The start time and end time of the test task T i The execution completion time.
[0085] Through the above steps, the execution completion time of each test task can be calculated according to the test task status table.
[0086] Step S3: Designing the fitness function of the improved genetic algorithm according to the test task status table.
[0087] Figure 5 A further defined flow chart of step S3 according to an embodiment of the present disclosure is shown.
[0088] In an example, Figure 5 As shown, step S3 may include:
[0089] Step S31: Calculate the processor load of the cloud test platform during the execution of the test task according to the test task status table and the test task coding table; that is, calculate the processor load according to the correspondence between the test task and the processor.
[0090] Step S32: Calculate the average value of all processor loads according to the load of the processor to obtain the load balance of the processors of the cloud test platform during the execution of the test task;
[0091] Step S33: The fitness function of the improved genetic algorithm is set based on the shortest execution time for the cloud testing platform to complete all test tasks and the load balance of the processors of the cloud testing platform during the execution of the test tasks.
[0092] Among them, the genetic algorithm eliminates bad chromosomes through the fitness algorithm and obtains the optimal solution through repeated iterations.
[0093] Taking into account both shortening the test task execution time and load balancing in cloud platform testing, the scheduling results of test tasks should meet the following requirements: the cloud test platform can complete all test tasks in the shortest possible time and the cloud test platform must ensure load balancing during task execution.
[0094] In terms of test task execution time, calculate the time it takes to complete all test tasks. In terms of load balancing, assume that for processor P i The total time to complete the test task is T, and T is divided into n1 time periods. In each time period, processor P i The number of computing cores occupied by the task always remains unchanged. Similarly, T is divided into n2 and n3 time periods, and in each time period, processor P i The memory size and hard disk size occupied by the task always remain unchanged.
[0095] Define processor P j The load is Among them, C, M, and D are processors P j The number of computing cores, memory size, and hard disk size provided, C x T x Processor P in time period j The number of occupied computing cores, M y T y Processor P in time period j The size of the memory occupied, D z T z Processor P in time period j The size of the hard disk occupied.
[0096] Using processor P j The load balancing degree is in, is the average load of all processors.
[0097] Based on the requirements of test task completion time and load balance, the fitness function is defined as Among them, a and b are constants, and i and n are positive integers.
[0098] The size of constants a and b is determined by the weights of the two metrics of test task completion time and load balance in the fitness function. As can be seen from the processor load formula, the shorter the total execution time of the test task and the more balanced the load, the larger the value of the fitness function, which means that the chromosome is better and has a greater probability of survival. The fitness function can be used to screen out excellent chromosome populations, which can not only achieve the shortest time for executing the test task but also avoid the situation where the local optimization result is determined only based on the test time.
[0099] Step S4: Initializing the population of the improved genetic algorithm based on the fitness function, and selecting chromosomes in the population using a roulette algorithm.
[0100] For example, 30% of the initial population can be generated using the Min-Min algorithm, and the remaining 70% of the chromosomes can be generated using random numbers, and the 1st to nth test tasks can be assigned to random processors according to the task numbers. Among them, the Min-Min algorithm is an easy-to-implement classic heuristic algorithm with short running time and high running efficiency. It mainly sorts the test tasks according to the running time of the test tasks, executes the small tasks with short time first, and then assigns the large tasks.
[0101] Assuming that there are n chromosomes in the population P(k), and the fitness function of chromosome k is represented by F(k), then the probability P(k) of chromosome k being selected is: Among them, Represents the sum of the fitness of n chromosomes in the population.
[0102] The selection probability calculated by the roulette wheel selection algorithm is between [0,1] each time, and the probability of a chromosome being selected is completely determined by its own fitness. The higher the fitness of a chromosome, the more likely it is to be selected, and its excellent genes are more likely to be passed on to the next generation. Chromosomes with lower fitness also have a probability of being selected, which increases the diversity of chromosomes in the population.
[0103] Step S5: After the chromosomes of the improved genetic algorithm are crossed and mutated, when the end condition of the improved genetic algorithm is met, the shortest time for task scheduling of the cloud testing platform is obtained.
[0104] Among them, the crossover algorithm usually selects two chromosomes according to the set crossover probability and exchanges the gene sequences of the corresponding parts in these two chromosomes.
[0105] For example, let the two selected chromosomes be F1 and F2, and the crossover algorithm operates as follows:
[0106] First, randomly select the total number of test tasks x (0.2L ≤ x ≤ 0.8L), where L is the chromosome length;
[0107] Second, select a chromosome segment centered on the total number of test tasks x in chromosomes F1 and F2 respectively, and its length is Denoted as K1 and K2 respectively;
[0108] Finally, exchange the positions of chromosome segments K1 and K2, and the newly generated chromosome segments are denoted as S1 and S2 respectively. Thus, the crossover operation of the new chromosome is realized.
[0109] The mutation operation of the chromosome can effectively ensure the genetic diversity of the population and prevent the genetic algorithm from converging prematurely and falling into a local optimal solution.
[0110] Then the mutation operation of the chromosome is specifically as follows: randomly select two values u and v (u < v), select chromosome S according to the mutation probability, take out the chromosome segment numbered from u to v in chromosome S, reverse its order and then re-inject it into the same position of chromosome S to form chromosome S′, and inject the formed chromosome S′ into the population to realize the mutation operation of the chromosome.
[0111] After the chromosome completes the corresponding selection, crossover, and mutation operations, the genetic algorithm completes an iteration process. According to the iteration end condition of the genetic algorithm, the optimal solution of the task scheduling method for the cloud testing platform is obtained. Among them, the iteration end condition of the genetic algorithm can be that the number of times exceeds a predetermined quantity, there is no change in the population in the last 10 iterations of the genetic algorithm, and all chromosomes in the population converge to the same chromosome. As long as one of these three conditions is met, the genetic algorithm stops and outputs the optimal solution in the current population.
[0112] The disclosed cloud test platform task scheduling method based on improved genetic algorithm is as follows: establishing the cloud test platform task scheduling model; encoding the test task scheduling mode based on the cloud test platform task scheduling model to form a test task status table; designing the fitness function of the improved genetic algorithm according to the test task status table; initializing the population of the improved genetic algorithm based on the fitness function, and selecting chromosomes in the population using the roulette algorithm; after performing crossover and mutation on the chromosomes of the improved genetic algorithm, when the end condition of the improved genetic algorithm is met, the shortest time for scheduling the cloud test platform task is obtained. It can effectively solve the problems of the number of processors, inter-task dependency and parallel execution of tasks.
[0113] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A cloud test platform task scheduling method based on an improved genetic algorithm, characterized in that: The method comprises: Establishing the cloud testing platform task scheduling model; Encoding the test task scheduling method based on the cloud test platform task scheduling model to form a test task status table; Designing the fitness function of the improved genetic algorithm according to the test task state table; Initializing a population of the improved genetic algorithm based on the fitness function, and selecting chromosomes in the population using a roulette algorithm; After the chromosomes of the improved genetic algorithm are crossed and mutated, when the end condition of the improved genetic algorithm is met, the shortest time for scheduling the tasks of the cloud testing platform is obtained; The test task scheduling method based on the cloud test platform task scheduling model is encoded to form a test task status table, including: The mapping relationship between the test tasks and the processors in the test task scheduling mode of the cloud test platform task scheduling model forms the test task coding table; Form a test task status table according to all preconditions for the test task to enter the to-be-executed state and the test task execution status; Defining a weight of the test task according to the execution completion time of the test task, and executing the test task according to the weight of the test task; Calculate the execution completion time of all the test tasks according to the test task status table; Designing the fitness function of the improved genetic algorithm according to the test task state table includes: Calculating the processor load of the cloud testing platform during the execution of the test task according to the test task status table and the test task coding table; Calculate the average value of all processor loads according to the processor loads to obtain the load balance of the processors during the execution of the test task on the cloud test platform; The fitness function of the improved genetic algorithm is set based on the shortest execution time of the cloud testing platform to complete all test tasks and the load balance of the processors of the cloud testing platform during the execution of the test tasks; The test task status table includes: test task number, processor number, predecessor task of the test task, successor task of the test task, number of computing cores, memory size, hard disk size, completion status of the predecessor task of the test task, satisfaction status of the test task required resources, test task pending status, test task executing status and test task completed status.
2. The cloud test platform task scheduling method according to claim 1, characterized in that: The task scheduling model of the cloud testing platform is a six-tuple G, G = (T, E, S P ,S T ,R,C), where T is the node set of the DAG graph of the cloud test platform task scheduling, E is the matrix of the directed edges of the DAG graph of the cloud test platform task scheduling, S P is the matrix of resources that the processor of the cloud test platform can provide, S T is the matrix of resources required for the test task on the cloud test platform, R is the matrix of the execution time of the test task on different processors, and C is the matrix of the test task conversion time.
3. The cloud test platform task scheduling method according to claim 1, characterized in that: The calculating the execution completion time of all the test tasks according to the test task status table includes: Find the test task T according to the test task coding table i and its corresponding processor P j , searching for the predecessor task and the successor task of the test task according to the DAG graph of the task scheduling model of the cloud test platform; The execution time matrix R of the test task on different processors is used to calculate the time allocated to the processor P. j The weights of all test tasks; When the test task T i The predecessor task has been completed, and the processor P is judged j Whether the test task T is met i resource requirements; When the processor P j Satisfy the test task T i resource requirements, determine the test task T i When the pending status, executing status, and completed status in the test task status table are all 0, the test task T i The pending execution status is set to 1; Determine the test task T i In the processor P j When the weight of all the test tasks to be executed on is the largest, the test task T i The executing state in the test task status table is set to 1, the pending state is set to 0, and the processor P j The resource matrix S provided P Subtract the resources required for the task and record the start time of the test task; The test task T i After the execution is completed, the test task T i The completed status in the test task status table is set to 1, and the processor P j The resource matrix S provided P Add the resources required for the task and record the time when the test task is completed; Returns the test task T i The start time and end time of the test task T i The execution completion time.
4. The cloud test platform task scheduling method according to claim 1, characterized in that: The processor P j The load is, Among them, C, M, and D are processors P j The number of computing cores, memory size, and hard disk size provided, C x T x Processor P in time period j The number of occupied computing cores, M y T y Processor P in time period j The size of the memory occupied, D z T z Processor P in time period j The size of the hard disk occupied; The processor P j The load balancing degree is, in, is the average value of all processor loads; The fitness function is Among them, a and b are constants, and i and n are positive integers.
