Experimental resource allocation method, system, equipment and medium based on genetic algorithm
Through the genetic algorithm-based method, the problem of multiple resources simultaneous allocation and time constraints in experimental resource allocation is solved, and efficient resource allocation and cost reduction are achieved.
Patent Information
- Application Number
- CN202210241683.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-11
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2042-03-11
AI Technical Summary
The prior art fails to effectively consider the simultaneous allocation of multiple test resources and the time constraints of the task itself in the allocation of test resources, resulting in low resource allocation efficiency.
Using a genetic algorithm-based method, by obtaining experimental resource information and allocation application information, a population with experimental resource allocation schemes is established, and the optimal experimental resource allocation is obtained through genetic evolutionary processing based on time and quantity. plan.
It realizes efficient resource allocation from multiple experimental resource storage locations to multiple resource usage locations, reduces resource allocation costs, and improves resource utilization efficiency while ensuring the resource requirements of the experimental plan.
Smart Images

Figure CN114723224B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of resource allocation, and relates to a test resource allocation method, system, equipment and medium based on genetic algorithm. Background Art
[0002] With the continuous development of resource allocation technology, its application in test resource allocation has gradually matured, supporting the automated allocation of test resources. In the plan-based test resource allocation, the test resource information maintained by the test supervisory unit may include information such as resource type, storage location and quantity. The same resource may be stored in multiple locations. Due to resource consumption, replenishment and maintenance, the number of test resources changes over time.
[0003] After receiving the application for test resource allocation of multiple test plans, the application may include information such as resource type, usage location, required quantity and usage time. The test supervisor can make a simple statistics on the storage status of test resources and the application for test resource allocation, and ensure that the total number of test resources stored in multiple locations meets the needs of the test plan through advance procurement and coordination. Then it is necessary to deal with the resource allocation problem from multiple test resource storage locations to multiple resource usage locations. Under the premise of ensuring the resource demand of the test plan within the specified time, the actual resource quantity constraints of each test resource storage location need to be considered, and the processing process is relatively complicated. Therefore, it is of great significance to formulate the optimal test resource allocation plan that meets the time and quantity constraints.
[0004] Reasonable allocation of experimental resources is an effective means to ensure that resources are effectively utilized. At present, experimental resource allocation mainly focuses on solving the problems of single experimental resource sharing conflicts and resource transition allocation, and only considers time constraints or resource quantity constraints, with the optimization goal of reducing the total execution time of all tasks or increasing the number of successfully executed tasks as resource allocation. However, in the process of realizing the present invention, the inventors found that most of the current resource allocation schemes allocate experimental resources according to the priority of the task, ensuring that tasks with high priority obtain resources first, while tasks with low priority are often delayed. In the allocation of experimental resources, the situation of allocating multiple experimental resources at the same time is not considered, and the time constraints of the tasks themselves are also ignored. There is a technical problem of low efficiency in the allocation of multiple experimental resources. Summary of the invention
[0005] In view of the problems existing in the above-mentioned traditional methods, the present invention proposes a test resource allocation method based on genetic algorithm, a test resource allocation system based on genetic algorithm, a computer device and a computer-readable storage medium, which can realize efficient multi-test resource allocation.
[0006] In order to achieve the above objectives, the embodiments of the present invention adopt the following technical solutions:
[0007] On the one hand, a method for allocating experimental resources based on a genetic algorithm is provided, comprising the steps of:
[0008] Acquire test resource information and test resource allocation application information; the test resource information includes resource types, resource storage locations, and changes in resource quantities over time for multiple test resources; the test resource allocation application information includes resource types, resource usage locations, resource demand quantities, and resource usage time based on multiple allocation plans;
[0009] Using the experimental resource information and experimental resource allocation application information, a population with the experimental resource allocation scheme as chromosome is established for each experimental resource, and the optimal chromosome is obtained through genetic evolution processing based on multiple conditional constraints of time and quantity;
[0010] The optimal chromosome is decoded to obtain the optimal allocation plan for each experimental resource.
[0011] On the other hand, a test resource allocation system based on genetic algorithm is also provided, comprising:
[0012] The information acquisition module is used to obtain test resource information and test resource allocation application information; the test resource information includes the resource types, resource storage locations and resource quantity changes over time of multiple test resources, and the test resource allocation application information includes the resource types, resource usage locations, resource demand quantities and resource usage time based on multiple allocation plans;
[0013] The scheme optimization module is used to use the test resource information and the test resource allocation application information to establish a population with the test resource allocation scheme as chromosome for each test resource, and obtain the optimal chromosome through genetic evolution processing based on multiple conditional constraints of time and quantity;
[0014] The solution output module is used to decode the optimal chromosome and obtain the optimal allocation solution for each experimental resource.
[0015] On the other hand, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned test resource allocation method based on genetic algorithm when executing the computer program.
[0016] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned test resource allocation method based on genetic algorithm are implemented.
[0017] One of the above technical solutions has the following advantages and beneficial effects:
[0018] The above-mentioned test resource allocation method, system, device and medium based on genetic algorithm obtain test resource information and test resource allocation application information to determine the available test resources and detailed information of resource allocation application, and then encode the resource allocation plan from multiple test resource storage locations to multiple resource use locations into chromosomes that meet multiple conditional constraints of time and quantity, and then iterate through genetic evolution based on multiple conditional constraints of time and quantity to obtain the optimal chromosome that meets the time and quantity constraints, and obtain the optimal allocation plan for test resources after decoding. Compared with the prior art, the present application realizes efficient resource allocation from multiple test resource storage locations to multiple resource use locations by adding genetic algorithms with multiple conditional constraints such as resource available time period, resource demand time period, resource available quantity and resource demand quantity, thereby reducing the resource allocation cost under the premise of ensuring the resource demand of the test plan. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 A schematic diagram of a flow chart of a test resource allocation method based on a genetic algorithm in an embodiment;
[0020] Figure 2 A schematic diagram of a process of genetic evolution processing based on multiple conditional constraints in one embodiment;
[0021] Figure 3 A schematic diagram of a process for generating a primary population of chromosomes in one embodiment;
[0022] Figure 4 A schematic diagram of a process of selecting a parent chromosome from a population of chromosomes in one embodiment;
[0023] Figure 5 A schematic diagram of a flow chart of selecting an operation in an embodiment;
[0024] Figure 6 A schematic diagram of a crossover operation process in one embodiment;
[0025] Figure 7 A schematic diagram of a process flow of a mutation operation in one embodiment;
[0026] Figure 8 A schematic diagram of an application flow of a test resource allocation method based on a genetic algorithm in an embodiment;
[0027] Fig. 9 The figure is a schematic diagram of the module structure of a test resource allocation system based on a genetic algorithm in one embodiment. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art to which the present application belongs. The terms used herein in the specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0030] The following will describe the implementation of the present invention in detail with reference to the accompanying drawings in the embodiment diagram of the present invention.
[0031] See also Figure 1 The embodiment of the present application provides a test resource allocation method based on a genetic algorithm, comprising the following steps S12 to S16:
[0032] S12, obtaining test resource information and test resource allocation application information; the test resource information includes resource types, resource storage locations and resource quantity changes over time of multiple test resources, and the test resource allocation application information includes resource types, resource usage locations, resource demand quantities and resource usage time based on multiple allocation plans.
[0033] It can be understood that the test resources can be the test facilities, equipment, software systems or platforms used by various test institutions to implement and ensure test tasks. The test resource information can be centrally managed by the test resource management module configured in the equipment system of the test supervisory unit. For example, the test resource management module can manage the test resource information of multiple test resources, such as the resource type and resource storage location, and the change of the number of resources over time due to resource consumption, replenishment or maintenance. The test resource allocation application information can also be centrally managed by the allocation application management module configured in the equipment system of the test supervisory unit. For example, the allocation application management module can manage the test resource allocation application information of multiple test plans, such as the resource type required for the test, the resource usage location, the resource demand quantity and the resource usage time.
[0034] In order to ensure that the test resources stored in multiple locations meet the needs of the test plan in terms of quantity, the equipment system can also perform simple statistics on the storage of test resources and the application for test resource allocation in advance, and obtain the changes in the total amount of various test resources in multiple locations over time, as well as the changes in the total resource demand of multiple test plans over time. The test supervisory unit can ensure that the test resources stored in multiple locations meet the needs of the test plan in terms of quantity through advance procurement and external coordination.
[0035] In some implementations, test resource (storage) information can be obtained directly or indirectly from a test resource management module, and test resource allocation application information can be obtained directly or indirectly from an allocation application management module to determine current test resource usage information, such as the resource usage location, resource demand quantity, and resource usage time of the test resources.
[0036] S14, using the experimental resource information and the experimental resource allocation application information, establishing a population with the experimental resource allocation scheme as chromosome for each experimental resource, and obtaining the optimal chromosome through genetic evolution processing based on multiple conditional constraints of time and quantity;
[0037] S16, decoding the optimal chromosome to obtain the optimal allocation plan for each experimental resource.
[0038] It can be understood that after obtaining the above-mentioned test resource information and test resource allocation application information, a genetic algorithm is applied to the technical concept of genetic evolution processing based on multiple conditional constraints of time and quantity, and the test resource information and test resource allocation application information are used to establish a population with the test resource allocation plan as chromosome for each test resource, and then a genetic evolution processing with multiple conditional constraints is performed to obtain the optimal chromosome in the population, and finally the optimal chromosome is decoded to output the optimal allocation plan for each test resource, completing the allocation processing of the test resources. The specific process of decoding the optimal chromosome can be understood by referring to the existing chromosome decoding process in the genetic algorithm, and will not be elaborated in this specification.
[0039] Through the above steps, an optimal allocation plan is generated for each test resource, achieving the optimal test resource allocation that takes into account the requirements of resource usage time and required quantity in the resource allocation application of the test plan, as well as the actual resource quantity constraints of the test resource storage location.
[0040] The above-mentioned test resource allocation method based on genetic algorithm obtains test resource information and test resource allocation application information to determine the available test resources and detailed information of resource allocation application, and then encodes the resource allocation plan from multiple test resource storage locations to multiple resource use locations into chromosomes that meet multiple conditional constraints of time and quantity, and then iterates through genetic evolution based on multiple conditional constraints of time and quantity to obtain the optimal chromosome that meets the time and quantity constraints, and obtains the optimal allocation plan for test resources after decoding. Compared with the prior art, the present application realizes efficient resource allocation from multiple test resource storage locations to multiple resource use locations by adding genetic algorithms with multiple conditional constraints such as resource available time period, resource demand time period, resource available quantity and resource demand quantity, thereby reducing the resource allocation cost while ensuring the resource demand of the test plan.
[0041] In one embodiment, in order to accurately and clearly describe the content of the present application, the test resource storage information in the test resource information may be, but is not limited to, represented as follows:
[0042] (1) The i-th storage location p[i] of the test resource; (2) The change in the number of test resources stored in the i-th storage location p[i] over time N[i][t]; where i = 0, 1, ..., n-1, indicating that the test resource is stored in n locations, and t represents a certain time period of the test.
[0043] The test resource usage information in the test resource allocation application information may be, but is not limited to, the following:
[0044] (1) The j-th usage location q[j] of the test resource; (2) The required quantity M[j] of the test resource at the j-th usage location q[j]; (3) The usage time t[j][0]~t[j][1] of the test resource at the j-th usage location q[j]; where j=0,1,...,m-1, indicating that the test resource is used at m locations.
[0045] See also Figure 2 In one embodiment, the above step S16 may specifically include the following processing steps S162 to S170:
[0046] S162, constructing a chromosome model with the experimental resource allocation plan as the chromosome and time and quantity constraints of the chromosome model according to the experimental resource information and the experimental resource allocation application information.
[0047] It can be understood that based on the principles of genetic algorithms, in this embodiment, the resource allocation plan from multiple test resource storage locations to multiple resource usage locations is encoded and processed into a chromosome (model) that meets multiple conditional constraints on time and quantity, and takes into account the requirements on resource usage time and demand quantity in the resource allocation application of the test plan, as well as the actual resource quantity constraints of the test resource storage location, to construct the time and quantity constraints of the chromosome model, that is, in this embodiment, a genetic algorithm based on multiple conditional constraints is used for genetic evolution processing.
[0048] In one embodiment, in the above step S162, the process of constructing a chromosome model with the experimental resource allocation scheme as the chromosome and the time and quantity constraints of the chromosome model may specifically include the following processing steps:
[0049] A two-dimensional array is used to represent the chromosome; the array elements in the two-dimensional array are used to represent the number of experimental resources deployed from the i-th resource storage position to the j-th resource use position; i and j are both positive integers;
[0050] Construct the first constraint in the time and quantity constraints; the first constraint is the quantity of the experimental resources transferred from the i-th resource storage location, which is subject to the change of the resource storage quantity of the i-th resource storage location over time;
[0051] The second constraint in the construction time and quantity constraints: The second constraint is that the number of test resources obtained at the j-th resource usage position must not be less than the required number of test resources at the j-th resource usage position.
[0052] Specifically, a two-dimensional array is used to represent the chromosome of the (experimental resource allocation plan), and the two-dimensional array can be recorded as {X[i][j]:i,j}. Among them, X[i][j] represents the number of experimental resources allocated from the i-th experimental resource storage position p[i] to the j-th resource use position q[j].
[0053] The time and quantity constraints may specifically include two parts: the first constraint and the second constraint as mentioned above. The first constraint may be expressed as follows: the number of test resources transferred from the i-th test resource storage location p[i] is subject to the change in the number of test resources stored in the i-th test resource storage location p[i] over time N[i][t]. The first constraint may be expressed as follows:
[0054] sum({X[i][k]:k in S[j]})<=N[i][t[j][0]]
[0055] In the formula, i=0,1,…,n-1; j=0,1,…,m-1, there are n*m inequalities in total. The inequalities transform time constraints into quantity constraints.
[0056] The second constraint can be expressed as: the number of test resources obtained by the j-th resource usage position q[j] should not be less than the required number M[j] of test resources at the j-th resource usage position q[j]. The second constraint can be expressed as follows:
[0057] sum({X[i][j]:i=0,1,…,n-1})>=M[j]
[0058] In the formula, j=0,1,…,m-1, there are m inequalities in total. The inequalities transform time constraints into quantity constraints.
[0059] The two-dimensional array {X[i][j]:i=0,1,...,n-1;j=0,1,...,m-1} should satisfy the following inequality:
[0060] sum({X[i][k]:k in S[j]})<=N[i][t[j][0]], i=0,1,…,n-1; j=0,1,…,m-1
[0061] sum({X[i][j]:i=0,1,…,n-1})>=M[j],j=0,1,…,m-1
[0062] In the above formula, S[j] is the set of resource usage locations that occupy or call the test resource when the j-th resource usage location q[j] applies for the test resource at time t[j][0]. The calculation formula of this set is as follows:
[0063] S[j]={k:t[k][0]<=t[j][0]<=t[k][1]},j=0,1,…,m-1
[0064] The above inequality converts the time and quantity constraints of the experimental resource allocation plan (chromosome) into quantity constraints, thereby obtaining the following constraints that the chromosome should satisfy:
[0065]
[0066] In some implementations, the following method may be used to determine whether the quantity of test resources stored in multiple locations meets the needs of the test plan:
[0067] S[j]={k:t[k][0]<=t[j][0]<=t[k][1]}
[0068] sum({N[i][t[j][0]]:i=0,1,...,n-1})>=sum({M[k]:k in S[j]}
[0069] In the formula, j = 0, 1, ..., m-1, S[j] represents the set of experimental resource usage locations that occupy or call experimental resources when the jth experimental resource usage location applies for experimental resources at time t[j][0]. It should be noted that the parameters in italics of various formulas in this article are equivalent to those in regular text.
[0070] S164, constructing a fitness function of the chromosome according to the test resource information, the test resource allocation application information and the chromosome model.
[0071] It can be understood that after constructing the above chromosome model and its constraints, it is also necessary to construct a corresponding fitness function for it so as to calculate the fitness value of each chromosome in subsequent processing.
[0072] In one embodiment, the fitness function is the inverse of the total cost of the experimental resource allocation scheme. It can be understood that the overall cost of the experimental resource allocation scheme is calculated based on the storage location information of the experimental resources and the usage location information of the experimental resources, as well as the above chromosome information, and the inverse of the overall cost of the experimental resource allocation scheme is taken as the fitness of the (experimental resource allocation scheme) chromosome.
[0073] Specifically, according to the storage location of the experimental resources {p[i]:i=0,1,...,n-1} and the usage location of the experimental resources {q[j]:j=0,1,...,m-1}, and the chromosome of the experimental resource allocation plan {X[i][j]:i=0,1,...,n-1;j=0,1,...,m-1}, the overall cost of the experimental resource allocation plan is calculated using the following formula:
[0074] cost=sum({T(p[i],q[j],X[i][j]):i=0,1,…,n-1;j=0,1,…,m-1})
[0075] Where T(p[i],q[j],X[i][j]) is the cost function for allocating X[i][j] experimental resources from the i-th experimental resource storage location to the j-th resource usage location.
[0076] The fitness calculation formula of the chromosome of the experimental resource allocation scheme is as follows:
[0077] fitness=1 / (cost+c)
[0078] In the formula, c is a number greater than 0, which is used to prevent the denominator from being 0, and is usually taken as 0.01.
[0079] In some embodiments, the goal of the genetic evolution process with multiple conditional constraints based on time and quantity can be set to minimize the following objective function:
[0080] sum({T(p[i],q[j],X[i][j]):i=0,1,…,n-1;j=0,1,…,m-1})
[0081] Where p[i] is the i-th experimental resource storage location, q[j] is the j-th resource usage location, and T is the cost function for allocating X[i][j] experimental resources from the i-th experimental resource storage location to the j-th resource usage location.
[0082] It can be seen that the process of solving the optimal allocation plan for each test resource can be expressed as solving the following test resource allocation optimization model based on multiple constraints such as time and quantity:
[0083] min sum({T(p[i],q[j],X[i][j]):i=0,1,…,n-1; j=0,1,…,m-1})
[0084] in,
[0085] sum({X[i][k]:k in S[j]})<=N[i][t[j][0]], i=0,1,…,n-1; j=0,1,…,m-1
[0086] sum({X[i][j]:i=0,1,…,n-1})>=M[j],j=0,1,…,m-1
[0087] S[j]={k:t[k][0]<=t[j][0]<=t[k][1]},j=0,1,…,m-1
[0088] S166, generating a primary population of chromosomes according to the experimental resource information, the experimental resource allocation application information, and the time and quantity constraints.
[0089] It can be understood that, according to the test resource storage information and the test resource use information, an initial generation population with a preset number of population chromosomes (which can be recorded as population) of chromosomes that meet time and quantity constraints is obtained; the number of initial iterations iter=0.
[0090] Among them, in the two-dimensional array {X[i][j]:i,j} representing the chromosome, the sum of the elements in each row sum({X[i][j]:j}) represents the number of experimental resources called out from the i-th experimental resource storage location, and this number is constrained by the change in the number of experimental resources stored in the i-th experimental resource storage location over time.
[0091] In the two-dimensional array {X[i][j]:i,j} representing the chromosome, the sum of the elements in each column sum({X[i][j]:i}) represents the number of experimental resources obtained from the j-th resource usage position, which should not be less than the number of experimental resource requirements of the j-th resource usage position.
[0092] In one embodiment, the above step S166 may specifically include the following processing steps:
[0093] Determine the preset number of chromosomes of the population;
[0094] Take out all experimental resources from the resource storage location in random order;
[0095] According to the number of chromosomes in the population, experimental resources that meet the resource demand quantity and resource usage time are allocated to the resource usage positions in a random order to obtain the initial generation population of chromosomes that meet the time and quantity constraints.
[0096] It can be understood that the number of initial iterations iter=0. The preset number of population chromosomes is population, and the experimental resource allocation operation is repeated population times to generate population chromosomes that meet the above constraints as the initial population. The experimental resource allocation operation can specifically include the following operations:
[0097] Randomly select a perm_deposit from 0, 1, ..., n-1, and randomly select a perm_use from 0, 1, ..., m-1;
[0098] Take out all test resources from the test resource storage location in the following order:
[0099] p[perm_deposit[0]],p[perm_deposit[1]]...,p[perm_deposit[n-1]]
[0100] Allocate test resources that meet the test resource requirements to the test resource usage locations in the following order:
[0101] q[perm_use[0]],q[perm_use[1]],...,q[perm_use[m-1]]
[0102] And assign values to X[perm_deposit[i]][perm_use[j]] in sequence according to the actual allocation quantity.
[0103] Since the experimental resources stored in multiple locations meet the needs of the experimental plan in quantity, the experimental resource allocation plan chromosome obtained through the above operation meets the time and quantity constraints, and the random order of allocation ensures the diversity of the experimental resource allocation plan chromosomes in the population of the experimental resource allocation plan chromosomes.
[0104] S168, judging whether the genetic evolution iteration of the chromosome model meets the termination condition according to the initial population and the fitness function;
[0105] S170, if satisfied, returns the optimal chromosome in the initial population.
[0106] It can be understood that after obtaining the initial population and its fitness function, the genetic evolution process can be started, the fitness value of the chromosome is calculated and the number of iterations is recorded. Whether to output the optimal chromosome or perform subsequent iterative processing is determined by judging whether the genetic evolution iteration meets the set termination condition.
[0107] In one embodiment, the termination condition includes that the number of genetic evolution iterations reaches a preset maximum number of iterations or the relative change in the optimal fitness of the chromosomes in the new population of chromosomes is less than a preset threshold.
[0108] Specifically, it is determined whether the group performance of the chromosome population (currently the primary population) meets a certain indicator or whether a predetermined maximum number of iterations has been completed. If at least one of the indicators is met, the optimal chromosome in the chromosome population is returned; otherwise, the number of iterations iter is increased by 1, and the subsequent genetic evolution process continues. Specifically, the aforementioned indicator can be the relative change in the optimal fitness of the chromosome in the chromosome population, which can be given according to actual needs.
[0109] In one embodiment, after the above step S168, the following processing steps may be specifically included:
[0110] If the termination condition is not met, the parent chromosome selection operation, selection operation, crossover operation and mutation operation are performed to obtain the next generation population of chromosomes that meet the time and quantity constraints.
[0111] It can be understood that in the genetic evolution process of the primary population, when the genetic evolution iteration of the chromosome model does not meet the termination condition, the number of iterations iter is increased by 1, and the subsequent genetic evolution processes such as the selection operation, crossover operation and mutation operation are continued.
[0112] In one embodiment, the above operation of selecting a parent chromosome may specifically include the following processing steps:
[0113] Calculate the fitness of chromosomes in the population according to the fitness function;
[0114] According to the preset selection ratio, the first F chromosomes with the best fitness are selected from the population as the parent excellent chromosomes of the experimental resource allocation scheme;
[0115] The excellent chromosomes of the parent are used as the new population of chromosomes.
[0116] It can be understood that according to the fitness function of the chromosome, the fitness of each chromosome in the chromosome population (currently the primary population) is calculated; according to the fitness of the chromosome, the optimal chromosome is selected as the parent chromosome according to a preset selection ratio (which can be recorded as choose_ratio).
[0117] Specifically, the fitness function of the chromosome is used to calculate the fitness of each chromosome in the chromosome population; according to the preset selection ratio choose_ratio, the top F (which can be recorded as floor(population*choose_ratio)) chromosomes with the best fitness are selected from the chromosome population as the parent excellent chromosomes of the experimental resource allocation scheme. The parent excellent chromosomes are used as the new chromosome population for the next iteration.
[0118] In one embodiment, the above selection operation may specifically include the following processing steps:
[0119] Convert the fitness of the excellent chromosomes of the parent generation into selection probability and obtain the cumulative selection probability of the excellent chromosomes of the parent generation;
[0120] The roulette algorithm is used to select a pair of chromosomes from the excellent chromosomes of the parent generation.
[0121] It can be understood that the fitness of the good chromosomes of the parent generation is converted into the selection probability, and a pair of chromosomes is selected from the good chromosomes of the parent generation according to the selection probability of the good chromosomes of the parent generation. Specifically, the fitness of the good chromosomes of the parent generation is converted into the selection probability using the following formula:
[0122] prob[u] = fitness[u] / sum({fitness[u]:u in parent's excellent chromosomes})
[0123] According to the selection probability of the excellent chromosomes of the parent generation, a pair of chromosomes is selected from the excellent chromosomes of the parent generation using the existing roulette algorithm, and the specific process may include the following:
[0124] The cumulative selection probability of excellent chromosomes in the parent generation is calculated using the following formula:
[0125] acc_prob[-1]=0; acc_prob[u]=prob[0]+prob[1]+...+prob[u]
[0126] Generate a random number r between 0 and 1;
[0127] When acc_prob[u - 1]<r <= acc_prob[u], select the excellent parental chromosome of the u-th test resource allocation plan.
[0128] In one embodiment, regarding the above-mentioned crossover operation, the following processing steps may be specifically included:
[0129] Perform a crossover operation on a pair of chromosomes selected by the selection operation to obtain a pair of new chromosomes;
[0130] Check the time and quantity constraint conditions for the new chromosomes;
[0131] Adopt an adjustment strategy to locally adjust the new chromosomes, and discard the new chromosomes that still do not meet the time and quantity constraint conditions after local adjustment.
[0132] It can be understood that a crossover operation is performed on a pair of chromosomes selected by the foregoing selection operation to obtain a pair of new chromosomes. Since the new chromosomes obtained after the crossover operation may not meet the time and quantity constraint conditions, an adjustment strategy is adopted to locally adjust the new chromosomes, and the new chromosomes that still do not meet the time and quantity constraint conditions after local adjustment are discarded.
[0133] Specifically, the two-dimensional arrays representing the foregoing pair of chromosomes are respectively represented as {X[i][j]: i = 0, 1,..., n - 1; j = 0, 1,..., m - 1} and {Y[i][j]: i = 0, 1,..., n - 1; j = 0, 1,..., m - 1}. Deform {X[i][j]: i, j} and {Y[i][j]: I, j} into one-dimensional arrays by rows or columns, randomly select a crossover point (which can be denoted as cross_i, cross_j), perform single-point crossover on the two one-dimensional arrays, and then restore them to two-dimensional arrays representing the corresponding new chromosomes, which can be expressed as follows:
[0134]
[0135]
[0136] It should be noted that the roman and italic fonts in the formulas in this article are equivalent representations, that is, the roman and italic representations of the same parameter have the same effect and both refer to the same parameter.
[0137] Check the time and quantity constraint conditions for the obtained new chromosomes, discard the new chromosomes that do not meet the time and quantity constraint conditions, or adopt an adjustment strategy to locally adjust the new chromosomes that do not meet the time and quantity constraint conditions to make them meet the time and quantity constraint conditions. The specific process can be as follows:
[0138] In the new chromosome, the cross_i-th experimental resource storage position may not meet the first constraint of the time and quantity constraints: "The number of experimental resources transferred from the i-th experimental resource storage position p[i] is subject to the change of the experimental resource storage quantity of the i-th experimental resource storage position p[i] over time N[i][t]"; or the new chromosome may not meet the second constraint of the time and quantity constraints: "The number of experimental resources obtained by the j-th resource usage position q[j] should not be less than the required number of experimental resources M[j] of the j-th resource usage position q[j]"; at this time, the following adjustment strategy can be used to locally adjust the new chromosome:
[0139] Sum the elements of the two-dimensional array representing the new chromosome by column, denoted as sum_columns;
[0140] According to the second constraint of the time and quantity constraints: "The number of experimental resources obtained at the j-th resource usage position q[j] should not be less than the required number M[j] of experimental resources at the j-th resource usage position q[j]", the array sum_columns should satisfy sum_columns[j]>=M[j], j=0,1,...,m-1. Therefore, add (M-sum_columns) to the cross_j-th row of the two-dimensional array of the new chromosome so that the new chromosome satisfies the second constraint.
[0141] Check whether the cross_i-th experimental resource storage position of the new chromosome meets the first constraint of the time and quantity constraints: "The number of experimental resources transferred from the i-th experimental resource storage position p[i] is subject to the time change N[i][t] of the experimental resource storage quantity of the i-th experimental resource storage position p[i]". If it is satisfied, keep the new chromosome, otherwise discard the new chromosome.
[0142] In one embodiment, the above mutation operation may specifically include the following processing steps:
[0143] According to the preset mutation ratio, the new chromosome is mutated and the time and quantity constraints are checked;
[0144] The adjustment strategy is used to locally adjust the new chromosomes, and the new chromosomes that still do not meet the time and quantity constraints after local adjustment are discarded.
[0145] It can be understood that some elements can be randomly selected in the two-dimensional array {X[i][j]:i,j} representing the new chromosome, and the values of the randomly selected elements can be randomly changed to obtain the new chromosome; the time and quantity constraints of the obtained new chromosome are checked, and the new chromosomes that do not meet the time and quantity constraints are discarded, or strategies are adopted to locally adjust the new chromosomes that do not meet the time and quantity constraints so that they meet the time and quantity constraints.
[0146] Specifically, according to the preset mutation ratio mutate_ratio, the new chromosome is mutated, as follows: randomly generate a number r between 0 and 1. If r is less than the preset mutation ratio mutate_ratio, the new chromosome is mutated. The two-dimensional array representing the chromosome is recorded as {X[i][j]: i=0,1,...,n-1;j=0,1,...,m-1}; randomly select a column mutate_i of the two-dimensional array and two different elements X[mutate_i][mutate_j] and X[mutate_i'][mutate_j] in the column, and exchange the positions of the two elements to obtain the following two-dimensional array representing the new chromosome:
[0147]
[0148] In the two-dimensional array representing the new chromosome, the row with the larger element between X[mutate_i][mutate_j] and X[mutate_i'][mutate_j] is mutate_r. Then the mutate_rth experimental resource storage position in the new chromosome may not satisfy the first constraint of the time and quantity constraints: "The number of experimental resources transferred from the i-th experimental resource storage position p[i] is subject to the change of the number of experimental resources stored in the i-th experimental resource storage position p[i] over time N[i][t]". Then the following adjustment strategy can be used to locally adjust the new chromosome:
[0149] Calculate S[mutate_j] = {k: t[k][0] <= t[mutate_j][0] <= t[k][1]};
[0150] Calculate sum_j = sum({X[mutate_r][k]:k in S[mutate_j]});
[0151] Calculate delta = max(sum_j-N[mutate_r][t[mutate_j][0]], 0);
[0152] If delta>0, randomly select an element j from S[mutate_j], subtract delta from X[mutate_r][j], randomly select an element i from {0,1,...,n-1}, and increase X[i][j] by delta;
[0153] Check if the i-th experimental resource storage position in the new chromosome may not meet the first constraint of the time and quantity constraints: "The number of experimental resources transferred from the i-th experimental resource storage position p[i] is subject to the time variation N[i][t] of the experimental resource storage quantity of the i-th experimental resource storage position p[i]". If it meets the constraint, the new chromosome is retained, otherwise the new chromosome is discarded.
[0154] In one embodiment, the process of obtaining the next generation population of chromosomes that meets the time and quantity constraints may specifically include the following processing steps:
[0155] Add the new chromosome obtained after the parent chromosome selection operation, selection operation, crossover operation and mutation operation to the new population of chromosomes; the new chromosome meets the time and quantity constraints;
[0156] Repeat the selection operation, crossover operation and mutation operation and add the obtained new chromosome into the new population;
[0157] When the number of chromosomes in the new population is equal to the preset number of chromosomes in the population, the next generation population is obtained.
[0158] It can be understood that the above-mentioned selection operation, crossover operation and mutation operation are repeatedly performed to obtain new chromosomes that meet the time and quantity constraints and add them to the new population of chromosomes; until the number of chromosomes in the new population of the aforementioned chromosomes is equal to the preset population number of chromosomes, thereby obtaining the next generation population of chromosomes.
[0159] See also Figure 3 In one embodiment, the change of the storage quantity of the input test resources over time N[i][t], the required quantity of the test resources M[j] and the usage time t[j][0]~t[j][1], and the preset population chromosome quantity population are recorded. The above step S166 can also be specifically represented as the following processing process:
[0160] Initialize counter u=0;
[0161] Counter u=u+1; if u<=population, continue to execute the subsequent steps, otherwise return population chromosomes;
[0162] Randomly generate a perm_deposit of 0, 1, ..., n-1; randomly generate a perm_use of 0, 1, ..., m-1;
[0163] Take out all test resources from the test resource storage location in the following order:
[0164] p[perm_deposit[0]],p[perm_deposit[1]]...,p[perm_deposit[n-1]]
[0165] Allocate test resources that meet the test resource requirements to the test resource usage locations in the following order:
[0166] q[perm_use[0]],q[perm_use[1]],...,q[perm_use[m-1]]
[0167] Assign values to X[perm_deposit[i]][perm_use[j]] in sequence according to the actual allocated quantity;
[0168] Save the two-dimensional array X and continue to execute the above step "counter u=u+1".
[0169] In this embodiment, since the experimental resources stored in multiple locations meet the needs of the experimental plan in quantity, the experimental resource allocation plan chromosomes obtained through the above operations meet the time and quantity constraints, and the random order of allocation ensures the diversity of the experimental resource allocation plan chromosomes in the population of experimental resource allocation plan chromosomes.
[0170] See also Figure 4 In one embodiment, the input chromosome population and the preset parent excellent chromosome selection ratio are recorded as choose_ratio. The above operation of selecting the parent chromosome can also be specifically expressed as the following processing process:
[0171] The fitness function of the chromosome is used to calculate the fitness of each chromosome in the chromosome population;
[0172] Sort the chromosomes in the population according to the size of the chromosome fitness; either positive or reverse order is acceptable;
[0173] Select the top floor (population*choose_ratio) chromosomes with the best fitness from the population as the parent excellent chromosomes of the experimental resource allocation plan.
[0174] See also Figure 5, in one embodiment, denote the fitness of the input excellent parental chromosome as fitness[u], and the above selection operation can specifically be represented as the following processing procedure:
[0175] Calculate the selection probability of the excellent parental chromosome using the following formula:
[0176] prob[u] = fitness[u] / sum({fitness[u]: u in excellent parental chromosome})
[0177] Calculate the cumulative selection probability of the excellent parental chromosome of the test resource allocation scheme using the following formula:
[0178] acc_prob[-1] = 0; acc_prob[u] = prob[0] + prob[1] +... + prob[u]
[0179] Randomly generate two numbers r1 and r2 between 0 and 1;
[0180] Calculate u1 and u2 that satisfy the conditions acc_prob[u1 - 1] < r1 <= acc_prob[u1] and acc_prob[u2 - 1] < r2 <= acc_prob[u2] respectively; if u1 == u2, then continue to execute the above step "Randomly generate two numbers r1 and r2 between 0 and 1", otherwise continue to execute the subsequent steps;
[0181] Select the u1-th and u2-th excellent parental chromosomes as a pair of selected chromosomes.
[0182] Please refer to Figure 6 , in one embodiment, denote a pair of input chromosomes as {X[i][j]: i = 0, 1,..., n - 1; j = 0, 1,..., m - 1} and {Y[i][j]: i = 0, 1,..., n - 1; j = 0, 1,..., m - 1}, and the above crossover operation can specifically be represented as the following processing procedure:
[0183] Randomly select a crossover point (cross_i, cross_j), where 0 <= cross_i < n and 0 <= cross_j < m;
[0184] Perform single-point crossover on a pair of chromosomes {X[i][j]: I, j} and {Y[i][j]: i, j} to obtain a pair of new chromosomes as follows:
[0185]
[0186] Sum the elements of the two-dimensional array of the new chromosomes by column, denoted as sum_columns;
[0187] Add (M - sum_columns) to the cross_j-th row of the two-dimensional array of the new chromosome;
[0188] Check whether the storage location of the cross_i-th test resource in the new chromosome satisfies the first constraint of the time and quantity constraints. If it is satisfied, return the new chromosome; otherwise, discard the new chromosome.
[0189] Please refer to Figure 7 , in one embodiment, denote the input new chromosome as {X[i][j]: i = 0, 1,..., n - 1; j = 0, 1,..., m - 1} and the preset mutation ratio as mutate_ratio. The above mutation operation can specifically be expressed as the following processing procedure:
[0190] Randomly generate a number r between 0 and 1; if r < mutate_ratio, continue to execute the subsequent steps; otherwise, return the new chromosome;
[0191] Randomly select a certain column mutate_i of the new chromosome and two different elements X[mutate_i][mutate_j] and X[mutate_i’][mutate_j] in this column, and swap the positions of these two elements to obtain a new chromosome as follows:
[0192]
[0193] Denote the row where the larger element between X[mutate_i][mutate_j] and X[mutate_i’][mutate_j] is located in the new chromosome as mutate_r;
[0194] Calculate the following formula:
[0195] S[mutate_j] = {k: t[k][0] <= t[mutate_j][0] <= t[k][1]};
[0196] sum_j = sum({X[mutate_r][k]: k in S[mutate_j]});
[0197] delta = max(sum_j - N[mutate_r][t[mutate_j][0]], 0);
[0198] If delta>0, randomly select an element j from S[mutate_j], subtract delta from X[mutate_r][j], randomly select an element i from {0,1,...,n-1}, increase X[i][j] by delta, and continue to execute subsequent steps; if delta==0, return the new chromosome;
[0199] Check whether the storage location of the i-th experimental resource in the new chromosome meets the first constraint of the time and quantity constraints. If so, return the new chromosome, otherwise discard the new chromosome.
[0200] In one embodiment, Figure 8 As shown, an overall flow chart of applying the above-mentioned test resource allocation method based on genetic algorithm is shown, which shows the overall application process of the above-mentioned method from the perspective of iterative processing.
[0201] It should be understood that although Figures 1 to 8 The steps in the flowchart are shown in sequence as indicated by the arrows, but the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of the steps, and the steps can be executed in other orders. Figures 1 to 8 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequentially, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0202] See also Fig. 9 In one embodiment, a test resource allocation system 100 based on a genetic algorithm is also provided, comprising an information acquisition module 11, a scheme optimization module 13 and a scheme output module 15. The information acquisition module 11 is used to obtain test resource information and test resource allocation application information; the test resource information includes the resource types, resource storage locations and resource quantity changes of multiple test resources over time, and the test resource allocation application information includes the resource types, resource usage locations, resource demand quantities and resource usage time based on multiple allocation plans. The scheme optimization module 13 is used to use the test resource information and the test resource allocation application information to establish a population with the test resource allocation scheme as chromosome for each test resource, and obtain the optimal chromosome through genetic evolution processing with multiple conditional constraints based on time and quantity. The scheme output module 15 is used to decode the optimal chromosome to obtain the optimal allocation scheme for each test resource.
[0203] The above-mentioned test resource allocation system 100 based on genetic algorithm obtains test resource information and test resource allocation application information through the cooperation of various modules, and after determining the detailed information of the test resources available and the resource allocation application, encodes the resource allocation plan from multiple test resource storage locations to multiple resource use locations into chromosomes that meet the multi-conditional constraints of time and quantity, and then iterates the genetic evolution based on the multi-conditional constraints of time and quantity to obtain the optimal chromosome that meets the time and quantity constraints, and obtains the optimal allocation plan for test resources after decoding. Compared with the prior art, the present application realizes efficient resource allocation from multiple test resource storage locations to multiple resource use locations by adding genetic algorithms with multi-conditional constraints such as resource available time period, resource demand time period, resource available quantity and resource demand quantity, thereby reducing the resource allocation cost under the premise of ensuring the resource demand of the test plan.
[0204] For the specific limitations of the test resource allocation system 100 based on genetic algorithm, please refer to the corresponding limitations of the test resource allocation method based on genetic algorithm above, which will not be repeated here. Each module in the above-mentioned test resource allocation system 100 based on genetic algorithm can be implemented in whole or in part through software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of a device with a specific data processing function in the form of hardware, or can be stored in the memory of the aforementioned device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. The aforementioned device can be, but is not limited to, various types of computing management devices already available in the art.
[0205] On the other hand, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the following processing steps when executing the computer program: obtaining test resource information and test resource allocation application information; using the test resource information and the test resource allocation application information, establishing a population with the test resource allocation scheme as chromosome for each test resource, and obtaining the optimal chromosome through genetic evolution processing with multiple conditional constraints based on time and quantity; decoding the optimal chromosome to obtain the optimal allocation scheme for each test resource. The test resource information includes the resource types, resource storage locations, and resource quantity changes over time of multiple test resources, and the test resource allocation application information includes the resource types, resource usage locations, resource demand quantities, and resource usage time based on multiple allocation plans.
[0206] In one embodiment, when the processor executes the computer program, the processor may also implement the steps or sub-steps added in each embodiment of the above-mentioned test resource allocation method based on genetic algorithm.
[0207] On the other hand, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the computer program is executed by a processor, the following processing steps are implemented: obtaining test resource information and test resource allocation application information; using the test resource information and the test resource allocation application information, establishing a population with the test resource allocation scheme as chromosome for each test resource, and obtaining the optimal chromosome through genetic evolution processing with multiple conditional constraints based on time and quantity; decoding the optimal chromosome to obtain the optimal allocation scheme for each test resource. The test resource information includes the resource types, resource storage locations, and resource quantity changes over time of multiple test resources, and the test resource allocation application information includes the resource types, resource usage locations, resource demand quantities, and resource usage time based on multiple allocation plans.
[0208] In one embodiment, when the computer program is executed by a processor, it can also implement the steps or sub-steps added in each embodiment of the above-mentioned test resource allocation method based on genetic algorithm.
[0209] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus dynamic random access memory (Rambus DRAM, referred to as RDRAM) and interface dynamic random access memory (DRDRAM).
[0210] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0211] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and all of them belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A test resource allocation method based on genetic algorithm, characterized in that: Includes steps: Acquire test resource information and test resource allocation application information; the test resource information includes resource types, resource storage locations, and changes in resource quantities over time for multiple test resources; the test resource allocation application information includes resource types, resource usage locations, resource demand quantities, and resource usage time based on multiple allocation plans; Using the test resource information and the test resource allocation application information, a population with the test resource allocation scheme as chromosome is established for each test resource, and an optimal chromosome is obtained through genetic evolution processing based on multiple conditional constraints of time and quantity; Decoding the optimal chromosome to obtain the optimal allocation plan for each experimental resource; wherein, According to the test resource information and the test resource allocation application information, the chromosome is represented by a two-dimensional array; the array elements in the two-dimensional array are used to represent the number of test resources allocated from the i-th resource storage position to the j-th resource use position; i and j are both positive integers, and the time and quantity constraints include a first constraint and a second constraint; Constructing the first constraint; the first constraint is the quantity of the test resources transferred from the i-th resource storage location, which is subject to the change of the quantity of resources stored in the i-th resource storage location over time; Constructing the second constraint: the second constraint is that the quantity of the test resources obtained at the j-th resource use position is not less than the required quantity of the test resources at the j-th resource use position; Constructing a fitness function of the chromosome according to the test resource information, the test resource allocation application information and the chromosome model; Generate a primary population of the chromosome according to the experimental resource information, the experimental resource allocation application information, and the time and quantity constraints; According to the primary population and the fitness function, determining whether the genetic evolution iteration of the chromosome model meets the termination condition; if so, returning the optimal chromosome in the primary population; The chromosome should satisfy the following constraints: Wherein, X[i][j] represents the number of test resources allocated from the i-th test resource storage location p[i] to the j-th resource usage location q[j], S[j] is the set of resource usage locations that occupy or call test resources when the j-th resource usage location q[j] applies for test resources at time t[j][0], M[j] represents the required number of test resources of the j-th resource usage location q[j], N[i][t] represents the change of the number of test resources stored in the i-th test resource storage location p[i] over time, n represents the number of storage locations for test resources, and m represents the number of usage locations for test resources.
2. The test resource allocation method based on genetic algorithm according to claim 1 is characterized in that: After the step of judging whether the genetic evolution iteration of the chromosome model meets the termination condition according to the primary population and the fitness function, the method further includes: If the termination condition is not met, a parent chromosome selection operation, a selection operation, a crossover operation and a mutation operation are performed to obtain a next generation population of chromosomes that meets the time and quantity constraints.
3. The test resource allocation method based on genetic algorithm according to claim 1, characterized in that: The step of generating the primary population of the chromosome according to the test resource information, the test resource allocation application information and the time and quantity constraints comprises: Determine the preset number of chromosomes of the population; Taking out all the test resources from the resource storage location in random order; According to the number of chromosomes in the population, the experimental resources that meet the resource demand quantity and the resource usage time are allocated to the resource usage positions in a random order to obtain the initial generation population of the chromosomes that meets the time and quantity constraints.
4. The test resource allocation method based on genetic algorithm according to claim 1 or 2, characterized in that: The termination condition includes that the number of iterations of the genetic evolution reaches a preset maximum number of iterations or the relative change in the optimal fitness of the chromosomes in the new population of the chromosomes is less than a preset threshold.
5. The test resource allocation method based on genetic algorithm according to claim 2 is characterized in that: The operation of selecting the parent chromosome includes: Calculating the fitness of chromosomes in the population according to the fitness function; According to a preset selection ratio, the first F chromosomes with the best fitness are selected from the population as the parent excellent chromosomes of the experimental resource allocation scheme; The parental excellent chromosomes are used as a new population of chromosomes.
6. The test resource allocation method based on genetic algorithm according to claim 5 is characterized in that: The selection operation includes: Converting the fitness of the excellent chromosome of the parent generation into a selection probability and obtaining the cumulative selection probability of the excellent chromosome of the parent generation; A roulette wheel algorithm is used to select a pair of chromosomes from the excellent chromosomes of the parent generation.
7. The test resource allocation method based on genetic algorithm according to claim 6 is characterized in that: The crossover operation includes: Performing a crossover operation on the pair of chromosomes selected by the selection operation to obtain a pair of new chromosomes; Performing the time and quantity constraint check on the new chromosome; An adjustment strategy is adopted to locally adjust the new chromosome, and the new chromosome that still does not meet the time and quantity constraints after the local adjustment is discarded.
8. The test resource allocation method based on genetic algorithm according to claim 7 is characterized in that: The mutation operation includes: According to a preset mutation ratio, performing a mutation operation on the new chromosome and performing the time and quantity constraint condition check; An adjustment strategy is adopted to locally adjust the new chromosome, and the new chromosome that still does not meet the time and quantity constraints after the local adjustment is discarded.
9. The test resource allocation method based on genetic algorithm according to claim 2 is characterized in that: The process of obtaining the next generation population of chromosomes that meets the time and quantity constraints includes: adding a new chromosome obtained after performing a parent chromosome selection operation, a selection operation, a crossover operation and a mutation operation to the new population of the chromosome; the new chromosome satisfies the time and quantity constraints; Repeating the selection operation, the crossover operation and the mutation operation and adding the obtained new chromosome to the new population; When the number of chromosomes in the new population is equal to the preset number of chromosomes in the population, the next generation population is obtained.
10. The test resource allocation method based on genetic algorithm according to claim 1, characterized in that: The fitness function is the inverse of the total cost of the experimental resource allocation plan.
11. A test resource allocation system based on genetic algorithm, characterized in that: include: An information acquisition module, used to acquire test resource information and test resource allocation application information; the test resource information includes resource types, resource storage locations, and changes in resource quantities over time for multiple test resources; the test resource allocation application information includes resource types, resource usage locations, resource demand quantities, and resource usage time based on multiple allocation plans; A scheme optimization module is used to use the test resource information and the test resource allocation application information to establish a population with the test resource allocation scheme as chromosome for each test resource, and obtain the optimal chromosome through genetic evolution processing based on multiple conditional constraints of time and quantity; The solution output module is used to decode the optimal chromosome to obtain the optimal allocation solution for each experimental resource; wherein, According to the test resource information and the test resource allocation application information, the chromosome is represented by a two-dimensional array; the array elements in the two-dimensional array are used to represent the number of test resources allocated from the i-th resource storage position to the j-th resource use position; i and j are both positive integers, and the time and quantity constraints include a first constraint and a second constraint; Constructing the first constraint; the first constraint is the quantity of the test resources transferred from the i-th resource storage location, which is subject to the change of the quantity of resources stored in the i-th resource storage location over time; Constructing the second constraint: the second constraint is that the quantity of the test resources obtained at the j-th resource use position is not less than the required quantity of the test resources at the j-th resource use position; Constructing a fitness function of the chromosome according to the test resource information, the test resource allocation application information and the chromosome model; Generate a primary population of the chromosome according to the experimental resource information, the experimental resource allocation application information, and the time and quantity constraints; According to the primary population and the fitness function, determining whether the genetic evolution iteration of the chromosome model meets the termination condition; if so, returning the optimal chromosome in the primary population; The chromosome should satisfy the following constraints: Wherein, X[i][j] represents the number of test resources allocated from the i-th test resource storage location p[i] to the j-th resource usage location q[j], S[j] is the set of resource usage locations that occupy or call test resources when the j-th resource usage location q[j] applies for test resources at time t[j][0], M[j] represents the required number of test resources of the j-th resource usage location q[j], N[i][t] represents the change of the number of test resources stored in the i-th test resource storage location p[i] over time, n represents the number of storage locations for test resources, and m represents the number of usage locations for test resources.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the test resource allocation method based on genetic algorithm described in any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the test resource allocation method based on genetic algorithm described in any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
System and method for generating a schedule to extract a resource from a reservoir
US20180230780A1
Method for automatic weapon allocation and scheduling against attacking threats
US6497169B1