A method and apparatus for determining a fitness function used in a genetic algorithm

By obtaining and processing the fitness parameters and weight sets in the fitness function and determining the target weight set, the problem of the limitations of manual setting of the fitness function in the existing genetic algorithm is solved, and the efficiency of the genetic solution is improved and the quality of the solution is improved.

CN114692870BActive Publication Date: 2024-09-17ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210387780.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-14
Publication Date
2024-09-17
Estimated Expiration
2042-04-14

AI Technical Summary

Technical Problem

In existing genetic algorithms, the fitness function is usually set by artificial experience, which results in the inability to select individuals that are more beneficial to genetic solutions, resulting in low solution efficiency.

Method used

By obtaining the fitness parameters and multiple sets of weight sets in the fitness function, the target weight set is determined, and the fitness function is calculated using the weight set and fitness parameters to evaluate the environmental adaptability of the genetic solution individual and select the optimal solution.

Benefits of technology

It improves the efficiency of genetic solving, ensures that the genetic algorithm evolves toward the optimal solution, and improves the solving efficiency and the quality of the solution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114692870B
    Figure CN114692870B
Patent Text Reader

Abstract

The embodiments of this specification describe a method, a business processing method and a device for determining the fitness function used in a genetic algorithm. According to the method of the embodiment, when determining the fitness function used in the genetic algorithm, the fitness parameter and the first weight set included in the fitness function are first obtained, and then the target weight set is determined based on the benefits that the genetic solution individual can obtain based on the first weight set, and then the fitness function can be determined based on the target weight set and the fitness parameter. The fitness function for determining whether the genetic solution individual is suitable for genetic solution in this scheme is determined based on the benefits of genetic solution individuals with different weights, which is consistent with the goal of genetic solution. Therefore, based on the fitness function, a genetic solution individual that makes the genetic solution evolve in the direction of obtaining the optimal solution can be selected, thereby improving the efficiency of genetic solution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of computer technology, and more particularly, to a method and apparatus for determining a fitness function used in a genetic algorithm. Background Art

[0002] In data processing, it is often necessary to use genetic algorithms for solving problems. In the process of solving problems using genetic algorithms, fitness is usually used to reflect the excellence of the individuals selected for genetic solving. The higher the fitness of the selected individual, the better the solution effect of using the individual for genetic solving.

[0003] In existing genetic algorithms, fitness is usually set manually based on experience. However, this method is limited by artificial experience and often cannot give a better fitness, that is, it cannot select individuals that are more beneficial to genetic solution, resulting in low solution efficiency of genetic algorithm. Summary of the invention

[0004] One or more embodiments of the present specification describe a method and apparatus for determining a fitness function used in a genetic algorithm, which can improve the efficiency of genetic solution.

[0005] According to a first aspect, a method for determining a fitness function used in a genetic algorithm is provided, wherein the fitness function is used to calculate the fitness of a genetic solution individual obtained in the genetic algorithm, and the fitness is used to characterize the environmental adaptability of the genetic solution individual, the method comprising:

[0006] Acquire at least one fitness parameter and at least two first weight sets included in the fitness function; wherein the first weight set is a set of weight values ​​of each of the at least one fitness parameter, and the weight values ​​in any two first weight sets are not completely the same;

[0007] Determining a target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying the at least two sets of first weight sets;

[0008] The fitness function is determined using the target weight set and the at least one fitness parameter.

[0009] In one possible implementation, each fitness parameter includes one of the following:

[0010] Genetic solution to the benefits that individuals can achieve;

[0011] Genetic solution of individual constraint values;

[0012] Any combination of the benefits, the constraint values, and the constraint boundaries.

[0013] In a possible implementation, the determining of the target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying the at least two sets of first weight sets includes:

[0014] For each set of first weights, calculate the benefits that can be achieved by the genetic solution individual using the current first weight set;

[0015] The target weight set is determined based on the benefits that can be achieved by the genetic solution individuals obtained from each group of the first weight set.

[0016] In a possible implementation, the calculation of the benefits that can be achieved by the genetic solution individual using the current first weight set includes:

[0017] Apply each weight value in the current first weight set to the corresponding fitness parameter to obtain a primary fitness function;

[0018] Determine a first genetic solution individual from at least one genetic solution individual using the primary fitness function; wherein the first genetic solution individual has a higher fitness among the at least one genetic solution individual;

[0019] The first genetic solution individual is solved by using a genetic algorithm to obtain the benefit that can be achieved by the first genetic solution individual obtained by the current first weight set.

[0020] In a possible implementation, the target weight set is determined based on the benefits that can be achieved by the genetic solution individuals obtained from each group of first weight sets, including:

[0021] Using at least one set of sample training data to train a profit prediction model; wherein each set of sample training data includes a set of first weight sets, and the profit that can be achieved by the genetic solution individual obtained by using the set of first weight sets;

[0022] Randomly generate at least two sets of second weight sets; wherein the second weight sets are sets of weight values ​​of the at least one fitness parameter, and the weight values ​​in any two sets of second weight sets are not completely the same;

[0023] Inputting the at least two second weight sets into the revenue prediction model respectively, and outputting a revenue result;

[0024] The weight set with the best benefit result among the at least two groups of second weight sets is determined as the target weight set.

[0025] In a possible implementation manner, determining the fitness function by using the target weight set and the at least one fitness parameter includes:

[0026] Each weight value in the target weight set is determined as a weight coefficient of a fitness parameter corresponding to each weight value, and a fitness function used in a genetic algorithm is obtained.

[0027] According to a second aspect, a business processing method is provided, comprising:

[0028] Receive a business processing task; wherein the business processing task includes solving at least two genetic solution individuals to be genetically solved in a genetic solution problem, and any one of the genetic solution individuals contains a solution to the genetic solution problem;

[0029] Calculating the fitness of the at least two genetic solution individuals to be genetically solved using the fitness function determined by any of the methods described in the first aspect above;

[0030] According to the calculated fitness, selecting at least one target genetic solution individual from the at least two genetic solution individuals to be genetically solved;

[0031] A genetic solution algorithm is used to perform genetic solution on the at least one target genetic solution individual to obtain an optimal solution to the genetic solution problem.

[0032] According to a third aspect, a device for determining a fitness function used in a genetic algorithm is provided, wherein the fitness function is used to calculate the fitness of a genetic solution individual obtained in the genetic algorithm, and the fitness is used to characterize the environmental adaptability of the genetic solution individual, and the device comprises:

[0033] An acquisition module is configured to acquire at least one fitness parameter and at least two first weight sets included in the fitness function; wherein the first weight set is a set of weight values ​​of each of the at least one fitness parameter, and the weight values ​​in any two first weight sets are not completely the same;

[0034] A weight set determination module configured to determine a target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying the at least two groups of first weight sets obtained by the acquisition module;

[0035] The fitness function determination module is configured to determine the fitness function using the target weight set determined by the weight set determination module and the at least one fitness parameter acquired by the acquisition module.

[0036] According to a fourth aspect, a service processing device is provided, comprising:

[0037] A task receiving module is configured to receive a business processing task; wherein the business processing task includes solving at least two genetic solution individuals to be genetically solved in a genetic solution problem, and any genetic solution individual contains a solution to the genetic solution problem;

[0038] a fitness calculation module, configured to calculate the fitness of the at least two genetic solution individuals to be genetically solved received by the task receiving module using the fitness function determined by the apparatus according to claim 8;

[0039] A screening module, configured to select at least one target genetic solution individual from the at least two genetic solution individuals to be genetically solved according to the fitness obtained by the fitness calculation module;

[0040] The genetic solution module is configured to use a genetic solution algorithm to perform genetic solution on the at least one target genetic solution individual obtained by the screening module to obtain an optimal solution to the genetic solution problem.

[0041] According to a fifth aspect, a computing device is provided, comprising: a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method described in any one of the first and second aspects is implemented.

[0042] According to the method and device provided in the embodiment of this specification, when determining the fitness function used in the genetic algorithm, first obtain at least one fitness parameter and at least two sets of first weights included in the fitness function. Then determine the target weight set based on the benefits that can be achieved by the genetic solution individual obtained by the at least two sets of first weights, and then determine the fitness function based on the target weight set and the fitness parameter. It can be seen that the fitness function for judging whether the genetic solution individual is suitable for genetic solution in this scheme is determined based on the benefits of genetic solution individuals with different weights, which is consistent with the goal of genetic solution. Therefore, based on the fitness function, it is possible to select a genetic solution individual that makes the genetic solution evolve in the direction of obtaining the optimal solution, thereby improving the efficiency of genetic solution. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0044] Figure 1is a flow chart of a method for determining a fitness function used in a genetic algorithm provided by one embodiment of this specification;

[0045] Figure 2 is a flow chart of a method for determining a target weight set provided by an embodiment of this specification;

[0046] Figure 3 It is a flow chart of a method for determining individual benefits of genetic solution provided by one embodiment of this specification;

[0047] Figure 4 is a flow chart of a method for determining a target weight set provided by another embodiment of the present specification;

[0048] Figure 5 is a flow chart of a business processing method provided by an embodiment of this specification;

[0049] Figure 6 is a schematic diagram of a device for determining a fitness function used in a genetic algorithm provided by one embodiment of this specification;

[0050] Figure 7 It is a schematic diagram of a business processing device provided by an embodiment of this specification. DETAILED DESCRIPTION

[0051] In the genetic algorithm solution process, since the genetic solution will perform crossover and mutation on possible solutions, more possible solutions will be obtained. If all solutions are genetically processed every time the genetic solution is performed, it will inevitably lead to more and more solutions, resulting in insufficient computing resources and seriously affecting the efficiency of the genetic algorithm.

[0052] For example, in a business scenario, there are 5 machines used to complete a work task. However, each machine has different working efficiency, power consumption, and machine loss costs. Therefore, consider using genetic solution to plan the working time of each machine, that is, to determine how long each computer needs to work to complete the task at a lower cost. When solving this problem using genetic solution, it is necessary to perform genetic processing such as crossover and mutation on the genetic solution individual (a genetic solution individual represents a solution to the problem) in order to obtain the optimal genetic solution individual and complete the optimal solution for the task.

[0053] For example, for two genetic solvers A{(machine 1, 4h), (machine 2, 5h), (machine 3, 3h), (machine 4, 3h), (machine 5, 5h)} and B{(machine 1, 3h), (machine 2, 2h), (machine 3, 5h), (machine 4, 5h), (machine 5, 4h)}, after crossover of the genetic solvers, two crossover genetic solvers A1{(machine 1, 4h), (machine 2, 5h), (machine 3, 5h), (machine 4, 3h), (machine 5, 5h)} and B1{(machine 1, 3h), (machine 2, 2h), (machine 3, 3h), (machine 4, 5h), (machine 5, 4h)} may be further obtained, that is, the working hours of machine 3 in genetic solvers A and B are crossed to obtain two new genetic solvers A1 and B1. In this way, the original two genetic solvers become four. Moreover, each genetic solution individual can be further mutated. For example, A can be mutated to obtain A2{(machine 1, 4h), (machine 2, 3h), (machine 3, 3h), (machine 4, 3h), (machine 5, 5h)}, that is, the working time of machine 2 in A is changed from 5h to 3h. In other words, a large number of genetic solution individuals may be obtained after each round of genetic solution, and all genetic solution individuals in the previous round need to be genetically solved separately in the next round of genetic solution. Therefore, with the continuous execution of genetic solution, there will inevitably be more and more possible solutions, which will seriously affect the efficiency of genetic solution.

[0054] Fitness is a quantity that reflects the excellence of the individuals selected for genetic solution. The higher the fitness of the selected individuals, the better the solution effect of genetic solution using the individuals. Selecting genetic solution individuals with good fitness can greatly improve the efficiency of genetic solution. Therefore, before genetic processing, this scheme considers judging the fitness of each genetic solution individual to screen possible solutions, thereby improving the solution efficiency of genetic algorithm.

[0055] like Figure 1 As shown, the embodiment of this specification provides a method for determining a fitness function used in a genetic algorithm, wherein the fitness function is used to calculate the fitness of a genetic solution individual obtained in the genetic algorithm, and the fitness is used to characterize the environmental adaptability of the genetic solution individual. The method may include the following steps:

[0056] Step 101: obtaining at least one fitness parameter and at least two first weight sets included in a fitness function; wherein the first weight set is a set of weight values ​​of at least one fitness parameter, and the weight values ​​in any two first weight sets are not completely the same;

[0057] Step 103: determining a target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying at least two sets of first weight sets;

[0058] Step 105: Determine a fitness function using the target weight set and at least one fitness parameter.

[0059] In the present embodiment, when determining the fitness function used in the genetic algorithm, first obtain at least one fitness parameter and at least two groups of first weight sets included in the fitness function. Then determine the target weight set based on the benefits that the genetic solution individual can achieve based on the at least two groups of first weight sets, and then determine the fitness function based on the target weight set and the fitness parameter. It can be seen that the fitness function for judging whether the genetic solution individual is suitable for genetic solution in this scheme is determined based on the benefits of genetic solution individuals with different weights, which is consistent with the goal of genetic solution. Therefore, based on the fitness function, it is possible to select a genetic solution individual that makes the genetic solution evolve in the direction of obtaining the optimal solution, thereby improving the efficiency of genetic solution.

[0060] The following is a detailed description of the attached Figure 1 The various steps in are described below.

[0061] First, in step 101, at least one fitness parameter and at least two first weight sets included in the fitness function are obtained; wherein the first weight set is a set of weight values ​​of at least one fitness parameter, and the weight values ​​in any two first weight sets are not exactly the same.

[0062] In this step, when a data processing task is received that uses a genetic algorithm to perform a genetic solution on a problem to be genetically solved, the fitness function used in the genetic algorithm for performing a genetic solution on the problem to be genetically solved can be first determined. When determining the fitness function used in the genetic algorithm, at least one fitness parameter and at least two groups of first weight combinations included in the fitness function can be first obtained. That is, the fitness function generated for calculating the fitness of the genetic solution individual uses the fitness parameter as a variable, and the fitness represents the environmental adaptability of the genetic solution individual.

[0063] Among them, for genetic solvers, each genetic solver can be a solution in the genetic problem, that is, each genetic solver is a feasible solution to the genetic problem. Furthermore, each genetic solver can obtain more genetic solvers through crossover and mutation in the genetic algorithm. For example, when using multiple machines to complete a task, in order to achieve the production capacity required by the task at the lowest cost, the time required for each machine to be used can be determined separately, that is, the amount of tasks to be completed by each machine is allocated, and the time used by all machines to complete this task is a genetic solver. For example, when five machines are used to complete a task, in one possible implementation, the five machines can complete the task in 4h, 5h, 3h, 3h, and 5h respectively. Then the corresponding genetic solver individuals are {(machine 1, 4h), (machine 2, 5h), (machine 3, 3h), (machine 4, 3h), (machine 5, 5h)}. A feasible solution for this task is that machine 1 works for 4h, machine 2 works for 5h, machine 3 works for 3h, machine 4 works for 3h, and machine 5 works for 5h. For another example, in order to reach a destination in the shortest time, the direction of movement at each intersection can be determined separately, and the route chosen at each intersection is a genetic solver individual.

[0064] In this way, more genetic solution individuals will be continuously obtained through crossover mutation and other processes in the genetic algorithm. If all genetic solution individuals are used to continuously perform crossover mutation each time, a large number of genetic solution individuals will be obtained, which seriously affects the efficiency of genetic solution. Since fitness is a quantity that can reflect the excellence of the selected individual for genetic solution, the higher the fitness of the selected individual, the better the solution effect of using the individual for genetic solution. Selecting genetic solution individuals with good fitness can greatly improve the efficiency of genetic solution. Therefore, consider using fitness to screen the genetic solution individuals obtained after each genetic solution. And using fitness for screening, it is necessary to have a suitable fitness screening standard. This scheme aims to generate a fitness function for screening genetic solution individuals, and the fitness can be determined by fitness parameters as variables.

[0065] The fitness parameter is a parameter that can characterize the effect on the result of genetic solution. For example, each fitness parameter can include one of the benefits that can be achieved by the genetic solution individual, the constraint value of the genetic solution process, the constraint boundary of the genetic solution process, etc., and can also include any combination of the benefits that can be achieved by the genetic solution individual, the constraint value of the genetic solution individual and the constraint boundary of the genetic solution process. Such as the sum, difference, product, quotient, power, etc. of at least any two of them.

[0066] For example, for machines assigned to complete a task, the benefits may include the production capacity required to complete the task; the constraint value may include the restriction relationship between two machines, or the constraint relationship between the production capacity and loss of a machine; the constraint boundary may include the maximum working time limit, the shortest working time limit, and the minimum production capacity standard of each machine or a machine.

[0067] For another example, for the task of finding the optimal route, the benefit may include the time taken to reach the destination; the constraint value may include that one or more directions at a certain intersection cannot reach the destination, or that one direction at a certain intersection is a required direction to reach the destination, or that when selecting a direction at an intersection, a direction at another intersection must / cannot be selected, such as when selecting direction 1 at intersection A, direction 3 at intersection B must be selected, etc.; and the constraint boundary may include that when selecting a certain intersection, the time to reach the next intersection cannot exceed T, etc.

[0068] Furthermore, after determining the fitness parameters, it is necessary to consider the appropriate weight values ​​of each fitness parameter. For example, a fitness expression can be given based on the fitness parameters: , where f1, f2, and f3 represent three fitness parameters, , , are the weight coefficients of the three fitness parameters f1, f2, and f3 in the fitness expression. Then, by determining the appropriate weight coefficients, a relatively excellent fitness function can be obtained.

[0069] In a possible implementation, when obtaining at least two sets of first weight sets included in the fitness function in step 101, it is possible to consider randomly generating at least two sets of first weight sets. It is easy to understand that each weight value in any randomly generated first weight set uniquely corresponds to a fitness parameter, and the weight values ​​in any two sets of first weight sets are not exactly the same.

[0070] For the expression , you can generate multiple groups of [ , , ], the first weight set can be [1, -2, 3], [1, 2, 1], [-0.5, -2, 1], [-1, -2, 0.5], [0.7, 1, -0.3], [1, 0.8, -0.2], etc.

[0071] Of course, when randomly generating the first weight set, the weights can also be evaluated and the value range of each weight value can be limited. For example, The possible value range of is [1,10]. The possible value range of is [-10,1]. The possible value range of is [-1,1]. In this way, each weight value is randomly generated within a fixed range by limiting the range, thereby avoiding the increase of calculation amount and waste of computing resources due to too large random range.

[0072] Then in step 103, based on the benefits that can be achieved by the genetic solution individuals obtained by applying at least two groups of first weight sets, a target weight set is determined.

[0073] Since the genetic solution is to find the solution with the maximum benefit, in this step, the appropriate target weight set is determined from multiple first weight sets based on the benefits that can be achieved by the genetic solution individuals. In a possible implementation, Figure 2 As shown, step 103 can be implemented by the following steps:

[0074] Step 201: for each set of first weights, calculate the benefits that can be achieved by the genetic solution individuals using the current first weight set;

[0075] Step 203: Determine the target weight set according to the benefits that can be achieved by the genetic solution individuals obtained from each group of the first weight set.

[0076] In the present embodiment, when determining the target weight set based on the benefits that can be achieved by the genetic solution individual, first, for each group of first weight sets, the benefits that can be achieved by the genetic solution individual obtained by using the current first weight set are calculated. In this way, a suitable target weight set can be reasonably determined based on the benefits that can be achieved by the genetic full solution individual obtained by each group of first weight sets. Since the target weight set is determined based on the benefits that can be achieved by the genetic solution individual, it is consistent with the goal of genetic solution, so that the target weight set determined by this scheme can make the fitness function have a better effect. Then, the fitness function can be used to select the genetic solution individual that makes the genetic solution evolve in the direction of obtaining the optimal solution, so as to improve the efficiency of genetic solution and the quality of solution.

[0077] Step 201 is described below.

[0078] In this step, based on the consideration that the scheme determines the fitness according to the benefits of each genetic solution individual, after obtaining multiple sets of first weight sets, the benefits corresponding to the genetic solution individuals obtained by each first weight set are calculated. In a possible implementation, Figure 3 Step 201, when calculating the benefits that can be achieved by the genetic solution individuals obtained by using the current first weight set for each group of first weight sets, can be implemented by the following steps:

[0079] Step 301: applying each weight value in the current first weight set to the corresponding fitness parameter to obtain a primary fitness function;

[0080] Step 303: using the primary fitness function to determine a first genetic solution individual from at least one genetic solution individual; wherein the first genetic solution individual has a higher fitness among the at least one genetic solution individual;

[0081] Step 305: Solve the first genetic solution individual using a genetic algorithm to obtain the benefit that can be achieved by the first genetic solution individual obtained by the current first weight set.

[0082] In this embodiment, when calculating the income corresponding to each first weight set, first consider applying each weight value in the current first weight set to the corresponding fitness parameter to obtain a primary fitness function, and then use the primary fitness function to determine a first genetic solution individual with higher fitness from at least one genetic solution individual. Then use a genetic algorithm to solve the first genetic solution individual to obtain the income that can be achieved by the first genetic solution individual obtained by the current first weight set. It can be seen that this scheme determines different fitness functions by applying each first weight set to the fitness parameter. Then use the complete genetic solution process to solve, and realize the use of different fitness functions to screen the genetic solution individuals, so that the income corresponding to each fitness function can be obtained, that is, the income that can be achieved by the first genetic solution individual of each first weight set is obtained.

[0083] For example, the three randomly generated first weight sets are [1, 2, 1], [-0.5, -2, 1], and [1, 0.8, -0.2]. Then the primary fitness functions corresponding to the three first weight sets are: , , In this way, the three fitness functions can be used to select genetic solution individuals in the genetic solution, so as to further calculate the benefits of the selected genetic solution individuals.

[0084] It should be pointed out that the fitness parameter in genetic solution is calculated based on the feasibility of the genetic solution individual. For example, the fitness parameter f1 represents the benefit that the genetic solution individual can achieve. Then, using the fitness function When calculating the fitness of a genetic solver, the benefit f1 that the genetic solver can achieve can be calculated using the solution of the genetic solver. For example, if a genetic solver is {(machine 1, 4h), (machine 2, 5h), (machine 3, 3h), (machine 4, 3h), (machine 5, 5h)}, then the production capacity that can be achieved by machine 1 working for 4h, machine 2 working for 5h, machine 3 working for 3h, machine 4 working for 3h, and machine 5 working for 5h is the benefit f1 of the genetic solver.

[0085] For example, the fitness parameter f2 represents the constraint value of the genetic solution process, so using the fitness function When calculating the fitness of a genetic solver, the constraint value f2 of the genetic solver can be calculated using the solution of the genetic solver. For example, for the genetic solver mentioned above, if machine 1 works for 4 hours, machine 2 works for 5 hours, machine 3 works for 3 hours, machine 4 works for 3 hours, and machine 5 works for 5 hours, the cost generated by each machine is the constraint value of the genetic solver.

[0086] For another example, the fitness parameter may also include any combination of benefits, constraint values, and constraint boundaries, etc. For example, f3 may be the difference or sum of benefits and constraint values, or the product of constraint boundaries and constraint values, or the nth power of benefits, where n is the constraint boundary.

[0087] Therefore, the fitness parameter is calculated based on the solution of the genetic solver, and different genetic solvers have different calculated values ​​of the fitness parameter. Of course, the fitness parameter may also be a fixed value. For example, for the same genetic problem, the constraint boundary of the genetic solution process may be a fixed value. Then, when the fitness function is used to calculate the fitness of the genetic problem, the fitness parameter of the constraint boundary of the genetic solution process in the fitness function is the corresponding fixed value. Of course, the constraint boundary is more likely to be a fitness function composed of any combination of the benefit and the constraint value as the fitness parameter.

[0088] Of course, when using the fitness expression to select genetic solver individuals, it is not limited to selecting one from multiple genetic solver individuals. It is also possible to set a fitness range and select genetic solver individuals whose fitness values ​​are within the fitness range for profit calculation and for the next round of genetic solution.

[0089] Step 203 is described below.

[0090] After obtaining each first weight set and the income corresponding to the first weight set, they can be used as samples for training to obtain an income prediction model, and then the income prediction model can be used to determine the most appropriate target weight set. In a possible implementation, Figure 4As shown, when determining the target weight set according to the benefits that can be achieved by the genetic solution individuals obtained from each group of first weight sets, step 203 can be implemented by the following steps:

[0091] Step 401: training a profit prediction model using at least one set of sample training data; wherein each set of sample training data includes a set of first weight sets and the profit that can be achieved by the genetic solution individual obtained using the set of first weight sets;

[0092] Step 403: randomly generating at least two second weight sets; wherein the second weight set is a set of weight values ​​of at least one fitness parameter, and the weight values ​​in any two second weight sets are not completely the same;

[0093] Step 405: inputting at least two sets of second weight sets into the revenue prediction model respectively, and outputting the revenue result;

[0094] Step 407: Determine the weight set with the best profit result in the at least two groups of second weight sets as the target weight set.

[0095] In this embodiment, when determining the most suitable target weight set, firstly, a set of first weight sets and the benefits that can be achieved by the genetic solver individuals obtained by the set of first weight sets are used as a set of sample training data, so that the benefit prediction model is trained using multiple sets of sample training data. Then, at least two sets of second weight sets for testing are randomly generated. Further, the randomly generated second weight sets are respectively input into the benefit prediction model to obtain a benefit set. In this way, according to the benefit results, the second weight set with the optimal benefit result can be determined as the target weight set. It can be seen from this that this scheme can predict the benefits of a large number of randomly generated second weight sets by establishing the relationship between the first weight set and the benefits, and there is no need to obtain the benefits of each second weight set through a complete genetic calculation, so that the target weight set with the optimal benefit can be quickly determined based on the randomly generated second weight set, thereby improving the efficiency of determining fitness.

[0096] In this solution, a revenue prediction model can be obtained by training through machine learning, and the revenue prediction model is the relationship between the first weight set and the revenue. In this way, when generating the second weight set, as many second weight sets as possible can be generated, so that the second weight set with the optimal revenue can be found.

[0097] Of course, it should be pointed out that the optimal benefit obtained at this time does not necessarily mean the optimal solution that can be achieved by the genetic solution problem, but refers to the optimal solution that can be achieved by the current algorithm. The optimal benefit obtained at this time may be the best solution for the genetic solution problem, or it may be a relatively optimal solution, that is, the optimal benefit is the best solution that can be achieved at the current moment.

[0098] For example, the optimal benefit can be the optimal solution that can be achieved when the termination condition of the genetic treatment is met. When determining whether the genetic treatment meets the termination condition, it can be determined whether the number of genetic treatments reaches a preset threshold of the number of iterations, whether the duration of the genetic treatment reaches a preset threshold of the duration of the treatment, and whether the solution obtained by the genetic treatment meets the preset optimal solution standard. In this way, by setting appropriate termination conditions, one or more of the above are determined during the genetic treatment, thereby obtaining the optimal solution when the termination condition is met.

[0099] In addition, the optimal benefit mentioned in the embodiments of this specification does not necessarily refer to the real profit. For example, the benefit can be production capacity, profit, etc. At this time, of course, the solution with the maximum benefit is the optimal solution. For another example, the benefit can also be indirect benefits such as cost. At this time, it is obvious that the minimum benefit is the optimal benefit. Therefore, it needs to be set according to the actual research object. It is not necessarily that the greater the benefit, the better the benefit, nor is it necessarily that the smaller the benefit, the better the solution.

[0100] Finally, in step 105, a fitness function is determined using the target weight set and at least one fitness parameter.

[0101] After the target weight set is obtained in step 103, a fitness function can be determined based on the target weight set and each fitness parameter. In a possible implementation, each weight value in the target weight set can be determined as a weight coefficient of the fitness parameter corresponding to each weight value to obtain the fitness function used in the genetic algorithm.

[0102] For example, f1, f2, and f3 are three fitness parameters that represent fitness, and the target weight set obtained by this scheme is [1.2, -2.4, -0.5]. Then it can be seen that the fitness function used in the genetic algorithm is .

[0103] like Figure 5 As shown, the embodiment of this specification provides a business processing method, which may include the following steps:

[0104] Step 501: receiving a business processing task; wherein the business processing task includes solving at least two genetic solution individuals to be genetically solved in a genetic solution problem, and any genetic solution individual contains a solution to the genetic solution problem;

[0105] Step 503: using the fitness function determined by the method provided in any of the above embodiments, calculating the fitness of at least two genetic solution individuals to be genetically solved;

[0106] Step 505: selecting at least one target genetic solution individual from at least two genetic solution individuals to be genetically solved according to the calculated fitness;

[0107] Step 507: Perform genetic solution on at least one target genetic solution individual using a genetic solution algorithm to obtain an optimal solution to the genetic solution problem.

[0108] In this embodiment, when performing business processing on a genetically solved problem, the fitness function determined by the method for determining the fitness function used in a genetic algorithm provided in any of the above embodiments can be used to select at least one target genetic solver individual from at least two genetic solver individuals in the received business processing task, and then use the selected target genetic solver individual to perform genetic solving, thereby obtaining the optimal solution to the genetically solved problem.

[0109] Step 503, when calculating the fitness of at least two genetic solvers to be genetically solved in the business processing task, can be determined by using a method for determining the fitness function used in the genetic algorithm provided by any of the above embodiments. For example, the fitness function obtained above can be Perform calculations.

[0110] When determining the target genetic solution individual according to the fitness in step 505, a fitness standard can be set. For example, the genetic solution individual with a fitness not less than A is determined as the target genetic solution individual, and the target genetic solution individual is used for genetic solution. The genetic solution individuals with a fitness less than A are filtered out and do not participate in the genetic solution operation.

[0111] It is easy to understand that in each round of genetic solution operation, this scheme can be used to screen genetic solution individuals according to fitness, so as to avoid the continuous increase of genetic solution individuals through genetic processing such as crossover mutation, thereby making it impossible for genetic solution to quickly obtain high-quality solutions.

[0112] like Figure 6As shown, this specification provides a device for determining a fitness function used in a genetic algorithm, wherein the fitness function is used to calculate the fitness of a genetic solution individual obtained in the genetic algorithm, and the fitness is used to characterize the environmental adaptability of the genetic solution individual, and the device comprises:

[0113] The acquisition module 601 is configured to acquire at least one fitness parameter and at least two first weight sets included in the fitness function; wherein the first weight set is a set of weight values ​​of at least one fitness parameter, and the weight values ​​in any two first weight sets are not completely the same;

[0114] The weight set determination module 602 is configured to determine a target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying the at least two groups of first weight sets obtained by the acquisition module 601;

[0115] The fitness function determination module 603 is configured to determine a fitness function using the target weight set determined by the weight set determination module 602 and at least one fitness parameter acquired by the acquisition module 601 .

[0116] In a possible implementation, each fitness parameter received by the acquisition module 601 includes one of the following:

[0117] Genetic solution to the benefits that individuals can achieve;

[0118] Genetic solution of individual constraint values;

[0119] Any combination of payoffs, constraint values, and constraint bounds.

[0120] In a possible implementation, when determining the target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying at least two sets of first weight sets, the weight set determination module 602 is configured to perform the following operations:

[0121] For each set of first weights, calculate the benefits that can be achieved by the genetic solution individual using the current first weight set;

[0122] The target weight set is determined based on the benefits that can be achieved by the genetic solution individuals obtained from each group of the first weight set.

[0123] In a possible implementation, when the weight set determination module 602 calculates the benefits that can be achieved by the genetic solution individuals obtained by using the current first weight set for each group of first weight sets, it is configured to perform the following operations:

[0124] Apply each weight value in the current first weight set to the corresponding fitness parameter to obtain a primary fitness function;

[0125] Determine a first genetic solution individual from at least one genetic solution individual using the primary fitness function; wherein the first genetic solution individual has a higher fitness among the at least one genetic solution individual;

[0126] The first genetic solution individual is solved by using a genetic algorithm to obtain the benefit that can be achieved by the first genetic solution individual obtained by the current first weight set.

[0127] In a possible implementation, when determining the target weight set according to the benefits that can be achieved by the genetic solution individuals obtained from each group of first weight sets, the weight set determination module 602 is configured to perform the following operations:

[0128] Using at least one set of sample training data to train a profit prediction model; wherein each set of sample training data includes a set of first weight sets and the profit that can be achieved by the genetic solution individual obtained by using the set of first weight sets;

[0129] Randomly generate at least two sets of second weight sets; wherein the second weight set is a set of weight values ​​of at least one fitness parameter, and the weight values ​​in any two sets of second weight sets are not completely the same;

[0130] Inputting at least two sets of second weight sets into the revenue prediction model respectively, and outputting the revenue result;

[0131] A weight set having an optimal benefit result among the at least two second weight sets is determined as a target weight set.

[0132] In a possible implementation, when the fitness function determination module 603 determines the fitness function using the target weight set and at least one fitness parameter, it is configured to perform the following operations:

[0133] Each weight value in the target weight set is determined as a weight coefficient of a fitness parameter corresponding to each weight value, and a fitness function used in a genetic algorithm is obtained.

[0134] like Figure 7 As shown, an embodiment of this specification provides a service processing device, which may include:

[0135] The task receiving module 701 is configured to receive a business processing task; wherein the business processing task includes solving at least two genetic solution individuals to be genetically solved in a genetic solution problem, and any one of the genetic solution individuals contains a solution to the genetic solution problem;

[0136] The fitness calculation module 702 is configured to calculate the fitness of at least two genetic solution individuals to be genetically solved received by the task receiving module 701 using the fitness function determined by the device for determining the fitness function used in the genetic algorithm as described above;

[0137] The screening module 703 is configured to select at least one target genetic solution individual from at least two genetic solution individuals to be genetically solved according to the fitness obtained by the fitness calculation module 702;

[0138] The genetic solution module 704 is configured to use a genetic solution algorithm to perform genetic solution on at least one target genetic solution individual obtained by the screening module 703 to obtain an optimal solution to the genetic solution problem.

[0139] The present specification also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed in a computer, the computer is caused to execute a method in any one of the embodiments in the specification.

[0140] The present specification also provides a computing device, including a memory and a processor, wherein executable codes are stored in the memory, and when the processor executes the executable codes, a method in any embodiment of the present specification is implemented.

[0141] It is to be understood that the structures illustrated in the embodiments of this specification do not constitute specific limitations on the device and service processing device for determining the fitness function used in the genetic algorithm. In other embodiments of the specification, the device and service processing device for determining the fitness function used in the genetic algorithm may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0142] The information interaction, execution process, etc. between the units in the above-mentioned device are based on the same concept as the method embodiments of this specification. For specific contents, please refer to the description in the method embodiments of this specification and will not be repeated here.

[0143] Those skilled in the art should be aware that in one or more of the above examples, the functions described in this specification can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0144] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects described in this specification. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A business processing method using a fitness function used in a genetic algorithm, wherein the fitness function is used to calculate the fitness of a genetic solver obtained in the genetic algorithm, and the fitness is used to characterize the environmental adaptability of the genetic solver; the business processing method is applied to a business scenario in which when multiple machines complete a task, it is determined how long each machine needs to work to complete the task at a lower cost; The working time of each genetic solver to complete the task for all machines; The method includes: Acquire at least one fitness parameter and at least two first weight sets included in the fitness function; wherein the first weight set is a set of weight values ​​of each of the at least one fitness parameter, and the weight values ​​in any two first weight sets are not completely the same; Determining a target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying the at least two sets of first weight sets; Determining the fitness function using the target weight set and the at least one fitness parameter; Receive a business processing task; wherein the business processing task includes solving at least two genetic solution individuals to be genetically solved in a genetic solution problem, and any one of the genetic solution individuals contains a solution to the genetic solution problem; Calculating the fitness of the at least two genetic solution individuals to be genetically solved using the determined fitness function; According to the calculated fitness, selecting at least one target genetic solution individual from the at least two genetic solution individuals to be genetically solved; A genetic solution algorithm is used to perform genetic solution on the at least one target genetic solution individual to obtain an optimal solution to the genetic solution problem.

2. The method according to claim 1, wherein: Each fitness parameter consists of one of the following: Genetic solution to the benefits that individuals can achieve; Genetic solution of individual constraint values; Any combination of the benefits, the constraint values, and the constraint boundaries.

3. The method according to claim 1, wherein: The method of determining the target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying the at least two sets of first weight sets includes: For each set of first weights, calculate the benefits that can be achieved by the genetic solution individual using the current first weight set; The target weight set is determined based on the benefits that can be achieved by the genetic solution individuals obtained from each group of the first weight set.

4. The method according to claim 3, wherein: The calculation of the benefits that can be achieved by the genetic solution individual using the current first weight set includes: Apply each weight value in the current first weight set to the corresponding fitness parameter to obtain a primary fitness function; Determine a first genetic solution individual from at least one genetic solution individual using the primary fitness function; wherein the first genetic solution individual has a higher fitness among the at least one genetic solution individual; The first genetic solution individual is solved by using a genetic algorithm to obtain the benefit that can be achieved by the first genetic solution individual obtained by the current first weight set.

5. The method according to claim 3, wherein: The target weight set is determined based on the benefits that can be achieved by the genetic solution individuals obtained from each group of first weight sets, including: Using at least one set of sample training data to train a profit prediction model; wherein each set of sample training data includes a set of first weight sets, and the profit that can be achieved by the genetic solution individual obtained by using the set of first weight sets; Randomly generate at least two sets of second weight sets; wherein the second weight sets are sets of weight values ​​of the at least one fitness parameter, and the weight values ​​in any two sets of second weight sets are not completely the same; Inputting the at least two second weight sets into the revenue prediction model respectively, and outputting a revenue result; The weight set with the best benefit result among the at least two groups of second weight sets is determined as the target weight set.

6. The method according to any one of claims 1 to 5, wherein: The determining the fitness function by using the target weight set and the at least one fitness parameter comprises: Each weight value in the target weight set is determined as a weight coefficient of a fitness parameter corresponding to each weight value, and a fitness function used in a genetic algorithm is obtained.

7. A business processing device using a fitness function used in a genetic algorithm, wherein the fitness function is used to calculate the fitness of a genetic solver obtained in the genetic algorithm, and the fitness is used to characterize the environmental adaptability of the genetic solver; the business processing device is used in a business scenario where when multiple machines complete a task, it is determined how long each machine needs to work to complete the task at a lower cost; each genetic solver is a working time for all machines to complete the task; the device comprises: An acquisition module is configured to acquire at least one fitness parameter and at least two first weight sets included in the fitness function; wherein the first weight set is a set of weight values ​​of each of the at least one fitness parameter, and the weight values ​​in any two first weight sets are not completely the same; A weight set determination module configured to determine a target weight set based on the benefits that can be achieved by the genetic solution individuals obtained by applying the at least two groups of first weight sets obtained by the acquisition module; a fitness function determination module configured to determine the fitness function using the target weight set determined by the weight set determination module and the at least one fitness parameter acquired by the acquisition module; A task receiving module is configured to receive a business processing task; wherein the business processing task includes solving at least two genetic solution individuals to be genetically solved in a genetic solution problem, and any genetic solution individual contains a solution to the genetic solution problem; A fitness calculation module, configured to calculate the fitness of the at least two genetic solution individuals to be genetically solved received by the task receiving module using the fitness function determined by the fitness function determination module; A screening module, configured to select at least one target genetic solution individual from the at least two genetic solution individuals to be genetically solved according to the fitness obtained by the fitness calculation module; The genetic solution module is configured to use a genetic solution algorithm to perform genetic solution on the at least one target genetic solution individual obtained by the screening module to obtain an optimal solution to the genetic solution problem.

8. A computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 6 is implemented.