Parallel test task scheduling method based on improved adaptive genetic algorithm

By improving the adaptive genetic algorithm to adjust the crossover and mutation probabilities, the problem of genetic algorithms getting stuck in local optima in parallel test task scheduling is solved, and faster and more accurate scheduling schemes are obtained.

CN115617690BActive Publication Date: 2026-05-08UNIV OF ELECTRONICS SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
UNIV OF ELECTRONICS SCI & TECH OF CHINA
Filing Date
2022-11-02
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Traditional genetic algorithms are prone to getting stuck in local optima when scheduling parallel test tasks, resulting in suboptimal scheduling schemes that affect real-time performance and efficiency.

Method used

An improved adaptive genetic algorithm is adopted to dynamically adjust the crossover and mutation probabilities by the dissimilarity of the population, so as to ensure population diversity and avoid getting trapped in local optima.

Benefits of technology

It improves the convergence speed and success rate of genetic algorithms in finding the optimal solution, and quickly and accurately finds the optimal parallel test task scheduling scheme.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115617690B_ABST
    Figure CN115617690B_ABST
Patent Text Reader

Abstract

The application discloses a parallel test task scheduling method based on an improved adaptive genetic algorithm, acquires relevant data of a to-be-tested task of an electronic system, encodes the test task in a real number coding mode, restricts the encoding in a task constraint, takes the encoding sequence of the test task as an individual of a genetic algorithm to execute the genetic algorithm, calculates the crossover probability and the mutation probability of the individual based on the change of population diversity in the iteration process of the genetic algorithm, and selects an optimal individual to obtain a final parallel test task scheduling scheme after iteration is completed. The application adaptively takes values of the crossover and mutation probability of the genetic algorithm through the population diversity, solves the problem that the genetic algorithm is prone to falling into a local optimum, improves the convergence speed of the genetic algorithm and the success rate of searching for an optimal solution, and enables the genetic algorithm to quickly and accurately obtain an optimal parallel test task scheduling scheme when solving the parallel test task scheduling problem.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of electronic system testing technology, and more specifically, relates to a parallel test task scheduling method based on an improved adaptive genetic algorithm. Background Technology

[0002] As the complexity of high-precision equipment, such as industrial and aerospace equipment, continues to increase, new challenges are posed to the performance of automated testing for complex systems. This is particularly true in the aerospace field, where the parameters to be tested are numerous and demand high accuracy and real-time performance. Parallel testing addresses the problems of low testing efficiency and low resource utilization in automated testing systems by simultaneously testing multiple tasks using appropriate resources. However, parallel testing needs to consider issues such as resource contention, system deadlock, and starvation. Determining its task scheduling scheme is a complex and highly optimization-challenged non-deterministic polynomial (NP) complete problem.

[0003] The goal of parallel test task scheduling research is to determine the optimal scheduling scheme, such as minimizing test time, maximizing execution value, and load balancing. Currently, there are two main research directions: one is to use only intelligent algorithms, leveraging their excellent global optimization performance to solve the scheduling scheme, such as particle swarm optimization, genetic algorithms, ant colony optimization, artificial bee colony optimization, and simulated annealing; the other is to combine Petri nets with intelligent algorithms, first utilizing the powerful modeling capabilities of Petri nets to model the scheduling process, and then using intelligent algorithms to solve the scheduling scheme.

[0004] Genetic algorithms possess excellent global search capabilities, strong robustness, and simple design. They also exhibit parallelism, making them naturally suitable for solving parallel optimization problems such as parallel test task scheduling. However, traditional genetic algorithms use fixed crossover and mutation probabilities. When these probabilities are low, the population evolves slowly, increasing the number of iterations, reducing convergence speed, and impacting real-time task scheduling. Conversely, high probabilities lead to excessively rapid evolution, causing the genes of dominant individuals to spread quickly, resulting in a loss of population diversity and a tendency to get trapped in local optima. This results in a suboptimal scheduling scheme that fails to achieve the optimization objective.

[0005] To improve genetic algorithms, Srinivas et al. first proposed the adaptive genetic algorithm (AGA). This algorithm adjusts the crossover and mutation probabilities based on the individual's fitness value, which to some extent solves the problem of genetic algorithms getting trapped in local optima. However, this algorithm can cause the crossover and mutation probabilities of dominant individuals with high fitness values ​​to approach or equal to zero, resulting in the dominant individual's characteristics not being inherited and leading to a local optimum. Ren Ziwu et al. proposed an improved adaptive genetic algorithm (IAGA), which guarantees that all individuals have a minimum crossover and mutation probability. However, in the later stages of the algorithm's iteration, when the fitness values ​​of individuals are close to the average fitness value and the number of these individuals is large, it leads to a low crossover and mutation probability for most individuals, slowing down the evolutionary speed of the population. Summary of the Invention

[0006] The purpose of this invention is to overcome the shortcomings of the prior art and provide a parallel test task scheduling method based on an improved adaptive genetic algorithm. By adaptively selecting the crossover and mutation probabilities of the genetic algorithm through population dissimilarity, the problem of the genetic algorithm easily getting trapped in local optima is solved, the convergence speed of the genetic algorithm and the success rate of searching for the optimal solution are improved, so that it can quickly and accurately find the optimal parallel test task scheduling scheme when solving the parallel test task scheduling problem.

[0007] To achieve the above-mentioned objectives, the parallel test task scheduling method based on the improved adaptive genetic algorithm of the present invention includes the following steps:

[0008] S1: For electronic systems to be tested in parallel, design test tasks for their subsystems based on the actual situation, and obtain relevant data for parallel testing, including:

[0009] Test task set T = {t1, t2, ..., t} M}, where t m Let m represent the m-th test task, where m = 1, 2, ..., M, and M represents the number of test tasks.

[0010] Test time set τ={τ1,τ2,···,τ M}, where τ m This represents the time required to complete the m-th test task;

[0011] Test resource set R = {r1, r2, ..., r N}, where r n Let N represent the nth type of resource required to test the test task set T, where n = 1, 2, ..., N, and N represents the number of resource types required for the test.

[0012] The task resource matrix TR, of size M×N, is used to represent the resource occupancy status. If TR(m,n)=1, then the test task t is considered to be in a given state. m The test requires the use of resources r. n If TR(m,n) = 0, then the test task t m No resources are consumed during testing. n ;

[0013] The task constraint matrix TS, of size M×M, is used to represent the execution order of test tasks. If TS(m,m′)=1, then the test task t m It is necessary to test task t m′ Previously, if TS(m,m′) = 0, then test task t... m and test task t m′ There is no restriction on the order of the elements, m′=1,2,…,M&m′≠m;

[0014] S2: The test task is encoded using real number encoding. During the encoding process, if the task constraint matrix TS(m,m′)=1, it indicates that the test task t is... m and test task t m′ The execution of test task t has a specific order, at which point the test task t... m and test task t m′ If the encodings are the same, otherwise test task t m and test task t m′ The encodings are different;

[0015] S3: Using the coding sequence of the test task as individuals in the genetic algorithm, randomly sort the coding sequence of the test task K times to generate K coding sequences, forming the initial population Q of the genetic algorithm. Let the i-th individual be X. i ={x i,1 ,x i,2 ,···,x i,M}, x i,m Represents individual X i The code for the m-th test task performed in the test, where i = 1, 2, ..., K;

[0016] S4: Calculate the dissimilarity D0 of the initial population. The specific method for calculating population dissimilarity is as follows:

[0017] For the current population, first calculate the dissimilarity d between any two individuals. i,j :

[0018]

[0019]

[0020] Where i = 1, 2, ..., K, j = 1, 2, ..., K, and i ≠ j, x i,m x j,m Individual X in the current population i X j The code for the m-th test task performed in the test;

[0021] Then, the dissimilarity D of the current population is calculated using the following formula:

[0022]

[0023]

[0024] S5: Calculate the fitness of each individual in the current population Q, using the following method:

[0025] Based on the order of test task encodings in an individual, the test time set τ, the task resource matrix TR, and the task constraint matrix TS, a parallel test task scheduling scheme is generated. The time TIME required for the scheduling scheme to complete the test is obtained, and then the fitness f of the individual is calculated using the following formula:

[0026]

[0027] The greater the fitness, the better the individual;

[0028] S6: Determine whether the termination condition is met. If yes, proceed to step S11; otherwise, proceed to step S7.

[0029] S7: Select dominant individuals from the current population Q to form a new population Q1;

[0030] S8: Perform a crossover operation on the individuals in the new population Q1 to obtain the offspring population Q2, where the crossover probability of each individual is calculated using the following method:

[0031] The dissimilarity D1 of the new population Q1 is calculated using the method in step S4, the fitness of each individual in the new population Q1 is calculated using the method in step S5, and then the crossover probability of the individuals is calculated using the following formula:

[0032]

[0033] Where, p c p represents the crossover probability. cmax p is the preset maximum crossover probability. cmin The minimum crossover probability is set in advance, and f′ is the larger of the fitness values ​​of the two parent individuals performing the crossover operation. max f represents the maximum fitness value of the new population Q1. avg γ represents the average fitness value of the new population Q1, and γ is the preset minimum value;

[0034] S9: Perform a mutation operation on the individuals in the offspring population Q2 to obtain the offspring population Q3, where the mutation probability of each individual is calculated using the following method:

[0035] The dissimilarity D2 of the offspring population Q2 is calculated using the method in step S4, the fitness of each individual in the offspring population Q2 is calculated using the method in step S5, and then the mutation probability of each individual in the offspring population Q2 is calculated using the following formula:

[0036]

[0037] Where, p m p is the mutation probability. mmax p is the preset maximum mutation probability. mmin Let f be the preset minimum mutation probability, f' be the fitness value of the mutated individual, and f' be the value of the mutated individual. max f′ represents the maximum fitness value of the offspring population Q2. avg This represents the average fitness value of the offspring population Q2;

[0038] S10: Set the offspring population Q3 to population Q, and return to step S5;

[0039] S11: Select the individual with the highest fitness in the current population, and generate a parallel test task scheduling scheme based on the order of test task encoding, test time set τ, task resource matrix TR, and task constraint matrix TS of that individual.

[0040] This invention relates to a parallel test task scheduling method based on an improved adaptive genetic algorithm. It acquires relevant data of the electronic system to be tested, encodes the test task using real number encoding, and restricts the encoding by the task. The encoded sequence of the test task is used as an individual of the genetic algorithm to execute the genetic algorithm. During the iteration process of the genetic algorithm, the crossover probability and mutation probability of the individual are calculated based on the change of population dissimilarity. After the iteration is completed, the optimal individual is selected to obtain the final parallel test task scheduling scheme.

[0041] This invention correlates the crossover and mutation probabilities of the genetic algorithm with the diversity of the population. When the population diversity is high, the crossover and mutation probabilities are reduced to decrease the population evolution speed and improve search accuracy. Conversely, when the population diversity is low, the crossover and mutation probabilities are increased to increase the population evolution speed and avoid getting trapped in local optima. These improvements ensure that the crossover and mutation probabilities have appropriate values ​​throughout the iteration process, guaranteeing population diversity, reducing the possibility of getting trapped in local optima, and thus obtaining a parallel test task scheduling scheme more quickly and accurately, thereby improving testing efficiency. Attached Figure Description

[0042] Figure 1This is a flowchart illustrating a specific implementation of the parallel test task scheduling method based on an improved adaptive genetic algorithm according to the present invention.

[0043] Figure 2 This is a Gantt chart of the parallel test task scheduling scheme corresponding to each individual in this embodiment;

[0044] Figure 3 This is an example diagram of individual intersections in this embodiment;

[0045] Figure 4 This is an example diagram of individual variation in this embodiment;

[0046] Figure 5 This is the parallel test Gantt chart obtained from the test task sequence in this embodiment;

[0047] Figure 6 This is a comparison chart showing the change in population dissimilarity with the number of iterations between the present invention and two comparative methods;

[0048] Figure 7 This is a comparison graph showing the maximum fitness value of the present invention and two comparative methods as a function of the number of iterations;

[0049] Figure 8 This is a comparison chart showing how the probability of obtaining the optimal solution changes with the number of iterations between the present invention and two comparative methods. Detailed Implementation

[0050] The specific embodiments of the present invention will now be described with reference to the accompanying drawings to enable those skilled in the art to better understand the invention. It should be particularly noted that in the following description, detailed descriptions of known functions and designs that might obscure the main content of the invention will be omitted here.

[0051] Example

[0052] Figure 1 This is a flowchart illustrating a specific implementation of the parallel test task scheduling method based on an improved adaptive genetic algorithm according to the present invention. Figure 1 As shown, the specific steps of the parallel test task scheduling method based on the improved adaptive genetic algorithm of this invention include:

[0053] S101: Obtain data related to parallel testing:

[0054] For electronic systems to be tested in parallel, test tasks are designed for their subsystems based on the actual situation, and relevant data for the tasks under test are obtained, including:

[0055] Test task set T = {t1, t2, ..., t} M}, where t mLet m represent the m-th test task, where m = 1, 2, ..., M, and M represents the number of test tasks.

[0056] Test time set τ={τ1,τ2,···,τ M}, where τ m This represents the time required to complete the m-th test task;

[0057] Test resource set R = {r1, r2, ..., r...} N}, where r n This represents the nth type of resource required to test the test task set T, where n = 1, 2, ..., N, and N represents the number of types of resources required for testing. Test resources generally include instruments, channels, etc.

[0058] The task resource matrix TR, of size M×N, is used to represent the resource occupancy status. If TR(m,n)=1, then the test task t is considered to be in a given state. m The test requires the use of resources r. n If TR(m,n) = 0, then the test task t m No resources are consumed during testing. n ;

[0059] The task constraint matrix TS, of size M×M, is used to represent the execution order of test tasks. If TS(m,m′)=1, then the test task t m It is necessary to test task t m′ Previously, if TS(m,m′) = 0, then test task t... m and test task t m′ There is no restriction on the order of the elements, and m′=1,2,…,M&m′≠m.

[0060] S102: Test Task Coding:

[0061] The encoding method determines the expression of genes in an individual and the execution of selection, crossover, and mutation. Common gene encoding methods include binary encoding, Gray code encoding, and real number encoding. This invention addresses the task scheduling problem, and real number encoding is more suitable for practical applications. However, due to task constraints in this invention, these limitations must be considered during encoding. Therefore, the specific method for testing task encoding in this invention is as follows:

[0062] The test task is encoded using real number encoding. During the encoding process, if TS(m,m′)=1 in the task constraint matrix, it indicates that the test task t is... m and test task t m′ The execution of test task t has a specific order, at which point the test task t... m and test task t m′ If the encodings are the same, otherwise test task tm and test task t m′ The encodings are different.

[0063] Suppose the test task set contains 10 test tasks, i.e., T = {t1, t2, ..., t...} 10 Since test task t3 needs to be executed before test task t5, the test task set can be encoded as {1,2,3,4,3,6,7,8,9,10}, and both test tasks t3 and t5 can be encoded as "3". The first "3" represents t3 and the first "3" represents t5, ensuring that t3 is executed before t5.

[0064] S103: Initialize the population:

[0065] The encoded sequence of the test task is used as the individual in the genetic algorithm. The code of the test task is randomly sorted K times to generate K encoded sequences, which constitute the initial population Q of the genetic algorithm. The value of K is set according to actual needs. Let the i-th individual be X. i ={x i,1 ,x i,2 ,···,x i,M}, x i,m Represents individual X i The m-th test task is encoded, i = 1, 2, ..., K.

[0066] S104: Calculate the dissimilarity of the initial population:

[0067] Population diversity is represented by dissimilarity. During iteration, the initial population is uniformly distributed across the solution space, resulting in the highest diversity and dissimilarity. As the number of iterations increases, the population evolves towards the optimal solution, with more and more individuals exhibiting characteristics of the optimal solution, leading to a decrease in population diversity and dissimilarity. In this invention, to ensure population diversity during iteration, it is necessary to determine the crossover and mutation probabilities of individuals based on changes in dissimilarity. Therefore, it is necessary to first calculate the dissimilarity D0 of the initial population. The specific method for calculating population dissimilarity is as follows:

[0068] For the current population, first calculate the dissimilarity d between any two individuals. i,j :

[0069]

[0070]

[0071] Where i = 1, 2, ..., K, j = 1, 2, ..., K, and i ≠ j, x i,m x j,m Individual X in the current population i Xj The code for the m-th test task performed in the test.

[0072] Then, the dissimilarity D of the current population is calculated using the following formula:

[0073]

[0074]

[0075] S105: Calculate individual fitness:

[0076] In genetic algorithms, the fitness value of an individual is used to evaluate its quality and determine the evolutionary direction of the population. The fitness function varies depending on the optimization direction of the specific problem. The goal of this invention's parallel test task scheduling research is to determine the scheduling scheme that minimizes the total testing time; therefore, the total testing time is used as the standard for evaluating individual quality. The specific method for calculating the fitness of each individual in the current population Q in this invention is as follows:

[0077] Based on the order of test task encodings in an individual, the test time set τ, the task resource matrix TR, and the task constraint matrix TS, a parallel test task scheduling scheme is generated. The time TIME required for the scheduling scheme to complete the test is obtained, and then the fitness f of the individual is calculated using the following formula:

[0078]

[0079] f is actually the acceleration ratio, that is, the degree to which parallel testing accelerates the test completion time; it is a function of evaluating the time required for parallel testing to complete the test. Therefore, it is clear that in this invention, the greater the fitness, the better the individual.

[0080] The following method is used to generate the parallel test task scheduling scheme in this embodiment:

[0081] A test task sequence is generated based on the order of test task codes within individuals. When identical test task codes exist, the order of the corresponding test tasks is determined according to the task constraint matrix TS. A Gantt chart is set up, and the test resource set R = {r1, r2, ..., r...} is used. NThe N test resources in the test time set τ are used as items in the Gantt chart. Then, based on the time required by each test task in the test time set τ and the resources required by each test task in the task resource matrix TR, the workflow of each test task on the required resources is plotted sequentially in the Gantt chart according to the test task sequence, resulting in a serial test Gantt chart. Then, in the serial test Gantt chart, according to the order of test task execution, test tasks are moved to the most movable position at the beginning without occupying the resources of preceding test tasks, resulting in a parallel test Gantt chart. Based on the parallel test Gantt chart, a parallel test task scheduling scheme and the time TIME required for the scheduling scheme to complete the test are obtained.

[0082] Taking 10 test tasks and 5 types of test resources as an example, the Task Resource Matrix (TR) is as follows:

[0083]

[0084] The test time set τ = {1,1,1,2,1,1,1,1,1,1,1}, with the test time unit being seconds. Assuming test task t3 needs to be executed before test task t5, the test task set is encoded as {1,2,3,4,3,6,7,8,9,10}. Assuming the current individual is {9,2,3,7,10,8,3,6,4,1}, the resulting test task sequence is {9,2,3,7,10,8,5,6,4,1}. Figure 2 This is a Gantt chart showing the parallel test task scheduling scheme for each individual task in this embodiment. For example... Figure 2 As shown, the parallel test task scheduling scheme for each individual in this embodiment requires a total of 7 steps: step 1 executes tasks 7 and 9, step 2 executes task 2, step 3 executes task 3, step 4 executes tasks 8 and 10, step 5 executes tasks 5 and 1, step 6 executes task 6, and step 7 executes task 4. The time required for this parallel test task scheduling scheme to complete the test is 8 seconds.

[0085] S106: Determine whether the termination condition is met. If yes, proceed to step S111; otherwise, proceed to step S107.

[0086] Termination conditions can be set according to actual needs. There are generally two types: one is when the number of iterations reaches the maximum number of iterations, and the other is when the fitness of the optimal individual converges.

[0087] S107: Individual Choice

[0088] Select dominant individuals from the current population Q to form a new population Q1.

[0089] The purpose of selection is to choose individuals from the population for crossover and mutation operations. In this embodiment, a roulette wheel selection algorithm and an elite preservation strategy are used to ensure that superior genes are inherited by offspring as much as possible, thus increasing the likelihood of producing better offspring. The specific method is as follows:

[0090] Set parameters A and B, let A+B=K, use the roulette wheel algorithm to select A individuals from the current population to add to the new population, then sort the remaining individuals in descending order of fitness, and select the top B individuals to add to the new population.

[0091] The roulette wheel selection algorithm selects individuals based on their fitness values. A higher fitness value increases the probability of selection, making it more likely that superior individuals will pass on their genes to their offspring. The elite retention strategy directly selects a subset of superior individuals, addressing the issue of superior individuals potentially being overlooked in the roulette wheel selection algorithm, thus making the new population more balanced.

[0092] S108: Individual Crossover:

[0093] The offspring population Q2 is obtained by performing a crossover operation on the individuals in the new population Q1, where the crossover probability of each individual is calculated as follows:

[0094] The dissimilarity D1 of the new population Q1 is calculated using the method in step S104, the fitness of each individual in the new population Q1 is calculated using the method in step S105, and then the crossover probability of the individuals is calculated using the following formula:

[0095]

[0096] Where, p c p represents the crossover probability. cmax p is the preset maximum crossover probability. cmin The minimum crossover probability is set in advance, and f′ is the larger of the fitness values ​​of the two parent individuals performing the crossover operation. max f represents the maximum fitness value of the new population Q1. avg γ is the average fitness value of the new population Q1, and γ is a preset minimum value, which is equivalent to an infinitesimal to prevent the denominator from being 0.

[0097] Crossover generates offspring by crossing partial gene segments from two parents, passing on some of the parent's traits to the offspring to increase population diversity and improve global search capabilities. This embodiment employs a two-point crossover method, specifically as follows:

[0098] 1) Randomly select the parent individuals to be crossed and the crossover gene segments, denoted as p1 and p2, and the crossover gene segments as follows: m1 represents the starting index of the crossover gene segment, m2 represents the ending index of the crossover gene segment, and 1 < m1 ≤ m2 < M.

[0099] 2) Initialize blank offspring individuals c1 and c2, and add the crossover gene fragment from parent individual p2. Fill the crossover gene fragment of the parent individual p1 into the offspring individual c1 position [m1:m2]. Fill the offspring individual c2 position [m1:m2].

[0100] 3) To prevent coding conflicts, the remaining gene fragments are handled as follows: the crossover gene fragments are extracted from the parent individual p1. The included test task codes are deleted, and the remaining test task codes are filled into the positions [1:m1-1] and [m2+1:M] of the offspring individual c1 in sequence; similarly, the crossover gene fragments are extracted from the parent individual p2. The test task codes included are deleted, and the remaining test task codes are filled into the positions [1:m1-1] and [m2+1:M] of the offspring individual c2 in order.

[0101] Figure 3 This is an example diagram of individual intersections in this embodiment. For example... Figure 3 As shown, the gene fragment at position [4:7] is selected as the crossover gene fragment, and then the crossover gene fragments are swapped. The blank gene positions in the individual are occupied by "X". Then, the test task code in the crossover gene fragment [6,9,2,3] in the parent individual p1 is deleted to obtain the remaining test task code [3,7,10,8,4,1]. Then, it is filled into the remaining positions in order. The operation is similar for another individual.

[0102] S109: Individual variation:

[0103] The offspring population Q3 is obtained by performing a mutation operation on the individuals in the offspring population Q2, and the mutation probability of each individual is calculated using the following method:

[0104] The dissimilarity D2 of the offspring population Q2 is calculated using the method in step S104, the fitness of each individual in the offspring population Q2 is calculated using the method in step S105, and then the mutation probability of each individual in the offspring population Q2 is calculated using the following formula:

[0105]

[0106] Where, p m p is the mutation probability. mmax p is the preset maximum mutation probability. mmin Let f be the preset minimum mutation probability, f' be the fitness value of the mutated individual, and f' be the value of the mutated individual. maxf′ represents the maximum fitness value of the offspring population Q2. avg Q2 represents the average fitness value of the offspring population.

[0107] Mutation operations generate offspring by altering certain genes in parent individuals, thereby increasing population diversity and mitigating local optima to some extent. This embodiment employs reverse mutation, specifically as follows:

[0108] A mutated gene fragment is randomly selected from the parent individuals. The test task encoding in the mutated gene fragment is reversed to generate a new gene fragment, thereby obtaining the offspring individuals.

[0109] Figure 4 This is an example diagram of individual variation in this embodiment. For example... Figure 4 As shown, the mutated gene fragment [7,10,8,3] is selected from the parent individual, and then the gene fragment [3,8,10,7] is obtained by reversing the order.

[0110] According to the calculation formulas for crossover probability and mutation probability in this invention, in the early stage of iteration, the dissimilarity D of the current population is similar to the dissimilarity D0 of the initial population, and the crossover probability p c With the mutation probability p m The crossover and mutation probabilities are similar to those in the existing IAGA algorithm. However, in the later stages of the algorithm, as the population evolves towards the optimal solution, the dissimilarity D of the current population decreases, and the crossover probability p... c With the mutation probability p m The addition of this feature effectively addresses the issue of low crossover and mutation probabilities in most individuals during the later stages of the IAGA algorithm iteration. Overall, the calculation method for crossover and mutation probabilities in this invention ensures that the probabilities have appropriate values ​​throughout the entire iteration process, guaranteeing population diversity and resolving the problem of genetic algorithms easily getting trapped in local optima.

[0111] S110: Set the offspring population Q3 to population Q, and return to step S105.

[0112] S111: Determine the parallel test task scheduling scheme:

[0113] Select the individual with the highest fitness in the current population, and generate a parallel test task scheduling scheme based on the order of test task encoding, test time set τ, task resource matrix TR, and task constraint matrix TS of that individual.

[0114] To better illustrate the technical effects of the present invention, specific examples are used to experimentally verify the present invention.

[0115] This embodiment uses the testing of a drone as an example. Parallel testing of the drone is completed by the automatic testing system in the ground testing equipment of the drone platform management system. This drone platform includes a braking subsystem, a power subsystem, a temperature control subsystem, a power distribution subsystem, and an electrical subsystem. In this embodiment, a total of 15 test tasks are set for the above 5 subsystems. The test involves a total of 7 types of resources: analog input boards, analog output boards, discrete input boards, discrete output boards, resistor boards, synchronous RS422 boards, and asynchronous RS422 boards. For ease of description, these resources are represented by r1, r2, r3, ..., r7. Table 1 is the test task information table in this embodiment. The test cases used in the test tasks in Table 1 do not correspond to all test cases in the system, but rather are automatically designed test cases according to requirements during automatic testing.

[0116] Test task Test object Resource consumption Test time / s Temporal Relationship <![CDATA[t1]]> Braking subsystem <![CDATA[r2]]> 2 <![CDATA[After t9]]> <![CDATA[t2]]> Power subsystem <![CDATA[r2,r3]]> 9 none <![CDATA[t3]]> Temperature control subsystem <![CDATA[r5,r7]]> 4 none <![CDATA[t4]]> Power subsystem <![CDATA[r5,r6]]> 11 none <![CDATA[t5]]> Electronic distribution system <![CDATA[r2]]> 2 none <![CDATA[t6]]> Temperature control subsystem <![CDATA[r2,r5]]> 16 <![CDATA[t 11 Previously <![CDATA[t7]]> Electronic distribution system <![CDATA[r1,r2]]> 19 <![CDATA[t 10 After that <![CDATA[t8]]> Electrical subsystem <![CDATA[r1]]> 20 none <![CDATA[t9]]> Braking subsystem <![CDATA[r3,r7]]> 12 <![CDATA[Before t1]]> <![CDATA[t 10 ]]> Electrical subsystem <![CDATA[r1,r6]]> 17 <![CDATA[Before t7]]> <![CDATA[t 11 ]]> Temperature control subsystem <![CDATA[r2,r5]]> 12 <![CDATA[After t6]]> <![CDATA[t 12 ]]> Electronic distribution system <![CDATA[r2,r7]]> 12 none <![CDATA[t 13 ]]> Electrical subsystem <![CDATA[r4,r6]]> 18 none <![CDATA[t 14 ]]> Temperature control subsystem <![CDATA[r5]]> 13 none <![CDATA[t 15 ]]> Power subsystem <![CDATA[r3]]> 13 none

[0117] Table 1

[0118] According to Table 1, the test task set T = {t1, t2, t3, ..., t...} is obtained. 15 The test resource set R = {r1, r2, r3, ..., r7}, and the test time set τ = {2, 9, 4, 11, 2, 16, 19, 20, 12, 17, 12, 12, 18, 13, 13} are given. The task constraint matrix TS is 15×15, where TS(9,1) = 1, TS(6,11) = 1, TS(10,7) = 1, and the rest are 0. The task resource matrix TR is 15×7, and its expression is as follows:

[0119]

[0120] Table 2 is the parameter setting table for the genetic algorithm in this embodiment.

[0121] parameter value Population size 20 Maximum number of iterations 100 <![CDATA[Maximum crossover probability p cmax > 0.9 <![CDATA[Minimum crossover probability p cmin > 0.3 <![CDATA[Maximum mutation probability p mmax > 0.1 <![CDATA[Minimum mutation probability p mmin > 0.01

[0122] Table 2

[0123] The test task sequence corresponding to the individual with the highest fitness obtained by using this invention is {8,2,14,9,6,3,1,10,12,13,5,11,15,7,4}. Figure 5 This is the parallel test Gantt chart obtained from the test task sequence in this embodiment. For example... Figure 5 As shown, the maximum number of execution steps for parallel testing in this embodiment is 10. Based on the parallel testing Gantt chart, the task scheduling matrix TP for this embodiment can be obtained, with a size of 7×10, where each element represents the test task occupying the corresponding resources in the corresponding execution step. The task scheduling matrix TP is:

[0124]

[0125] The parallel test task scheduling scheme requires 72 seconds to complete the test, which is the same as the optimal scheduling scheme, indicating that the present invention can effectively solve the problem of parallel test task scheduling.

[0126] With the same parameter settings, the present invention was compared with the existing AGA algorithm and IAGA algorithm in a comparative experiment. Figure 6 This is a comparison chart showing the change in population dissimilarity with the number of iterations between the present invention and two comparative methods. From Figure 6 It can be seen that the population dissimilarity reaches its maximum initially. In the later stages of iteration, the population dissimilarity of the AGA and IAGA algorithms fluctuates within a small range, indicating low population diversity; while the population dissimilarity of the present invention fluctuates within a larger range, indicating high population diversity. This demonstrates that the present invention maintains population diversity during the iteration process, illustrating the rationality of its design.

[0127] Figure 7 This is a comparison graph showing the maximum fitness value of the present invention and two comparative methods changing with the number of iterations. From Figure 7 It can be seen that both the AGA algorithm and the IAGA algorithm get stuck in local optima and require multiple iterations to escape them. However, the present invention has a better ability to escape local optima.

[0128] Figure 8 This is a comparison chart showing how the probability of obtaining the optimal solution changes with the number of iterations for the present invention and two comparative methods. From Figure 8 It can be seen that the probability of finding the optimal solution by the three methods tends to stabilize after 40 iterations. The AGA algorithm stabilizes at about 75%, the IAGA algorithm at about 95%, and the present invention at about 99%. The IAGA algorithm shows a significant improvement over the AGA algorithm, while the present invention shows an improvement of about 4% over the IAGA algorithm. Before 10 iterations, the probability of finding the optimal solution by the present invention is similar to that of the IAGA algorithm; however, after 10 iterations, the probability of finding the optimal solution by the present invention is better than that of the IAGA algorithm, which is in line with the design expectations.

[0129] With a maximum of 50 iterations, the three methods were run 1000 times each, and the results were statistically analyzed. Table 3 is a comparison table of the simulation results of the present invention and the two alternative methods in this embodiment.

[0130]

[0131] Table 3

[0132] As shown in Table 3, compared with the IAGA algorithm, the present invention increases the probability of finding the optimal solution by about 5.5% while keeping the average search time the same.

[0133] In summary, this invention introduces adaptive adjustment of crossover and mutation probabilities based on population dissimilarity, which improves the problem of traditional IAGA algorithm easily getting trapped in local optima in the later stages, improves the convergence speed of the method, has better search performance, and can quickly and accurately obtain parallel test task scheduling schemes.

[0134] Although the illustrative specific embodiments of the present invention have been described above to enable those skilled in the art to understand the invention, it should be understood that the invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the invention as defined and determined by the appended claims, and all inventions utilizing the concept of the present invention are protected.

Claims

1. A parallel test task scheduling method based on an improved adaptive genetic algorithm, characterized in that, Includes the following steps: S1: For electronic systems to be tested in parallel, design test tasks for their subsystems based on the actual situation, and obtain relevant data for parallel testing, including: Test task set T = {t1, t2, ..., t} M }, where t m Let m represent the m-th test task, where m = 1, 2, ..., M, and M represents the number of test tasks. Test time set τ={τ1,τ2,···,τ M }, where τ m This represents the time required to complete the m-th test task; Test resource set R = {r1, r2, ..., r...} N }, where r n Let N represent the nth type of resource required to test the test task set T, where n = 1, 2, ..., N, and N represents the number of resource types required for the test. The task resource matrix TR, of size M×N, is used to represent the resource occupancy status. If TR(m,n)=1, then the test task t is considered to be in a given state. m The test requires the use of resources r. n If TR(m,n) = 0, then the test task t m No resources are consumed during testing. n ; The task constraint matrix TS, of size M×M, is used to represent the execution order of test tasks. If TS(m,m′)=1, then the test task t m It is necessary to test task t m′ Previously, if TS(m,m′) = 0, then test task t... m and test task t m′ There is no restriction on the order of the elements, m′=1,2,…,M&m′≠m; S2: The test task is encoded using real number encoding. During the encoding process, if the task constraint matrix TS(m,m′)=1, it indicates that the test task t is... m and test task t m′ The execution of test task t has a specific order, at which point the test task t... m and test task t m′ If the encodings are the same, otherwise test task t m and test task t m′ The encodings are different; S3: Using the coding sequence of the test task as individuals in the genetic algorithm, randomly sort the coding sequence of the test task K times to generate K coding sequences, forming the initial population Q of the genetic algorithm. Let the i-th individual be X. i ={x i,1 ,x i,2 ,···,x i,M }, x i,m Represents individual X i The code for the m-th test task performed in the test, where i = 1, 2, ..., K; S4: Calculate the dissimilarity D0 of the initial population. The specific method for calculating population dissimilarity is as follows: For the current population, first calculate the dissimilarity d between any two individuals. i,j : Where i = 1, 2, ..., K, j = 1, 2, ..., K, and i ≠ j, x i,m x j,m Individual X in the current population i X j The code for the m-th test task performed in the test; Then, the dissimilarity D of the current population is calculated using the following formula: S5: Calculate the fitness of each individual in the current population Q, using the following method: Based on the order of test task encodings in an individual, the test time set τ, the task resource matrix TR, and the task constraint matrix TS, a parallel test task scheduling scheme is generated. The time TIME required for the scheduling scheme to complete the test is obtained, and then the fitness f of the individual is calculated using the following formula: The greater the fitness, the better the individual; S6: Determine whether the termination condition is met. If yes, proceed to step S11; otherwise, proceed to step S7. S7: Select dominant individuals from the current population Q to form a new population Q1; S8: Perform a crossover operation on the individuals in the new population Q1 to obtain the offspring population Q2, where the crossover probability of each individual is calculated using the following method: The dissimilarity D1 of the new population Q1 is calculated using the method in step S4, the fitness of each individual in the new population Q1 is calculated using the method in step S5, and then the crossover probability of the individuals is calculated using the following formula: Where, p c p represents the crossover probability. cmax p is the preset maximum crossover probability. cmin The minimum crossover probability is set in advance, and f′ is the larger of the fitness values ​​of the two parent individuals performing the crossover operation. max f represents the maximum fitness value of the new population Q1. avg γ represents the average fitness value of the new population Q1, and γ is the preset minimum value; S9: Perform a mutation operation on the individuals in the offspring population Q2 to obtain the offspring population Q3, where the mutation probability of each individual is calculated using the following method: The dissimilarity D2 of the offspring population Q2 is calculated using the method in step S4, the fitness of each individual in the offspring population Q2 is calculated using the method in step S5, and then the mutation probability of each individual in the offspring population Q2 is calculated using the following formula: Where, p m p is the mutation probability. mmax p is the preset maximum mutation probability. mmin Let f be the preset minimum mutation probability, f' be the fitness value of the mutated individual, and f' be the value of the mutated individual. max f′ represents the maximum fitness value of the offspring population Q2. avg This represents the average fitness value of the offspring population Q2; S10: Set the offspring population Q3 to population Q, and return to step S5; S11: Select the individual with the highest fitness in the current population, and generate a parallel test task scheduling scheme based on the order of test task encoding, test time set τ, task resource matrix TR, and task constraint matrix TS of that individual.

2. The parallel test task scheduling method according to claim 1, characterized in that, The method for generating the parallel test task scheduling scheme in step S5 is as follows: A test task sequence is generated based on the order of the test task codes in an individual. When there are identical test task codes, the order of the test tasks corresponding to the identical test task codes is determined based on the task constraint matrix TS. Set up a Gantt chart and define the test resource set R = {r1, r2, ..., r...} N The N test resources in the test time set τ are used as items in the Gantt chart. Then, based on the time required by each test task in the test time set τ and the resources required by each test task in the task resource matrix TR, the work process of each test task on the required resources is drawn sequentially in the Gantt chart according to the test task sequence, resulting in a serial test Gantt chart. Then, in the serial test Gantt chart, according to the order of execution of the test tasks, the test tasks are moved to the most movable position without occupying the resources of the preceding test tasks, resulting in a parallel test Gantt chart. Based on the parallel test Gantt chart, the parallel test task scheduling scheme and the time TIME required for the scheduling scheme to complete the test are obtained.

3. The parallel test task scheduling method according to claim 1, characterized in that, The specific method for individual selection in step S7 is as follows: Set parameters A and B, let A+B=K, use the roulette wheel algorithm to select A individuals from the current population to add to the new population, then sort the remaining individuals in descending order of fitness, and select the top B individuals to add to the new population.

4. The parallel test task scheduling method according to claim 1, characterized in that, In step S8, the individual crossover uses a two-point crossover method, specifically as follows: 1) Randomly select the parent individuals to be crossed and the crossover gene segments, denoted as p1 and p2, and the crossover gene segments as follows: m1 represents the starting number of the crossover gene segment, m2 represents the ending number of the crossover gene segment, and 1 < m1 ≤ m2 < M. 2) Initialize blank offspring individuals c1 and c2, and add the crossover gene fragment from parent individual p2. Fill the crossover gene fragment of the parent individual p1 into the offspring individual c1 position [m1:m2]. Fill the offspring individual c2 position [m1:m2] with the filler; 3) Transfer the crossover gene fragment from the parent individual p1 The included test task codes are deleted, and the remaining test task codes are filled into the positions [1:m1-1] and [m2+1:M] of the offspring individual c1 in sequence; similarly, the crossover gene fragments are extracted from the parent individual p2. The test task codes included are deleted, and the remaining test task codes are filled into the positions [1:m1-1] and [m2+1:M] of the offspring individual c2 in order.

5. The parallel test task scheduling method according to claim 1, characterized in that, In step S8, the individual variation adopts reverse sequence variation, and the specific method is as follows: A mutated gene fragment is randomly selected from the parent individuals. The test task encoding in the mutated gene fragment is reversed to generate a new gene fragment, thereby obtaining the offspring individuals.

Citation Information

Patent Citations

  • Cloud computing task scheduling method based on improved genetic algorithm

    CN112181598A

  • Cloud test platform task scheduling method based on improved genetic algorithm

    CN112486651A