Method for executing artificial intelligence optimal solution search based on genetic model

By generating a uniform population using the Latin hypercube sampling method and combining it with diversity monitoring and dynamic step size adjustment, the problems of uneven population distribution and insufficient diversity in traditional methods are solved, and efficient global optimal solution search is achieved.

CN120893530APending Publication Date: 2025-11-04XIAMEN MINGSHUN XIANGZHUO DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510740126.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-05
Publication Date
2025-11-04

AI Technical Summary

Technical Problem

Traditional optimal solution search methods suffer from uneven initial population distribution when dealing with complex solution spaces, resulting in a low probability of global optimal solutions. Furthermore, they lack effective population diversity monitoring mechanisms and are prone to getting trapped in local optima.

Method used

A uniform initial population is generated using the Latin hypercube sampling method. Genotypic and phenotypic diversity indices are calculated in real time. A diversity early warning mechanism is set up, gradient descent local search is performed, and a dynamic step size adjustment strategy is adopted, combined with tournament selection and Gaussian mutation operations.

Benefits of technology

It increases the probability of finding the global optimum, avoids getting trapped in local optima, and improves the quality and efficiency of search results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120893530A_ABST
    Figure CN120893530A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of optimal solution search, in particular to a genetic model-based artificial intelligence optimal solution search method, which comprises the following steps of: generating an initial population by utilizing a Latin hypercube sampling method according to a constraint condition, uniformly distributing individuals in a solution space, calculating individual fitness values, constructing a fitness distribution histogram, and performing optimal solution search. Genotype and phenotype diversity indexes are monitored in real time, when the diversity indexes reach a specific threshold value or meet early warning conditions, gradient descent local search is performed on the optimal individual, a dynamic step length adjustment strategy is adopted to optimize the search process, validity verification is performed on an optimization vector, and when local search is not triggered, the optimal individual is subjected to gradient descent local search. According to the method, the hierarchical selection, single-point crossover and Gaussian mutation operations are performed on the population, and the boundary of a variation individual is repaired, so that the problems of insufficient population diversity control and easy local optimum in a complex solution space in a traditional method are solved, and the search efficiency and the result quality are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of optimal solution search, in particular to an artificial intelligence optimal solution search method based on a genetic model. BACKGROUND

[0002] Optimal solution search is an important technology, and it is crucial to accurately and efficiently obtain the optimal solution. Traditional optimal solution search methods have serious defects when dealing with complex solution spaces. The main reason is the lack of effective control over population diversity. In the search process, traditional methods often use fixed search strategies and cannot dynamically adjust according to the distribution of the population in the solution space. In the genetic algorithm, the traditional method often selects individuals completely randomly in the solution space when generating the initial population, which leads to uneven distribution of the initial population, over-sampling of some areas, and neglect of some areas, making it difficult to cover the entire solution space at the beginning of the search and reducing the probability of finding the global optimal solution.

[0003] As the search progresses, the traditional method also lacks a reasonable mechanism to monitor and maintain the diversity of the population. When the population diversity rapidly decreases, it is easy to fall into a local optimal solution. At this time, even if the search is continued, it is difficult to jump out of the current local optimal area, resulting in the solution obtained not being the global optimal solution, which seriously affects the quality and efficiency of the search result. In order to solve this technical problem, we provide an artificial intelligence optimal solution search method and system based on a genetic model. SUMMARY

[0004] The purpose of the present application is to provide an artificial intelligence optimal solution search method and system based on a genetic model to solve the problems raised in the background art.

[0005] Because the traditional method generates an initial population with uneven distribution, reducing the probability of finding the global optimal solution, the present case uses the Latin hypercube sampling method in step S1 to divide the solution space into N non-overlapping sub-regions, and randomly selects points in each sub-region as individual gene coding vectors, which can make the initial population more evenly distributed in the solution space and improve the likelihood of searching for the global optimal solution.

[0006] Because the traditional method lacks a reasonable mechanism to monitor and maintain the diversity of the population, it is easy to fall into a local optimal solution. Therefore, the present case calculates the genotype and phenotype diversity indicators, sets up a diversity warning mechanism, and performs gradient descent local search under certain conditions, which can timely detect changes in population diversity, avoid falling into a local optimum, and improve the quality and efficiency of the search result.

[0007] To achieve the above purpose, one of the purposes of the present application is to provide an artificial intelligence optimal solution search method based on a genetic model, comprising the following steps: S1, randomly generate an initial population containing N individuals according to the constraint condition, and each individual gene code is represented by a floating-point vector, and the vector dimension is consistent with the dimension of the solution space; S2, calculate the fitness value of each individual by a pre-set loss function, establish a population fitness distribution histogram, and calculate the genotype diversity index and phenotype diversity index of the current population in real time; S3, when the genotype diversity index is less than 0.15 or the phenotype diversity index is greater than 0.85, perform gradient descent local search on the individual with the optimal fitness of the current generation, including extracting the individual gene vector as the initial point, iterating 5 times along the negative gradient direction of the loss function with a fixed step size, and adding the optimized vector to the population as a new individual; S4, perform tournament selection, single-point crossover and Gaussian mutation operation on the population that does not trigger the S3 step, and the mutation probability is fixed at 0.02 until the maximum iteration number is reached.

[0008] As a further improvement of the technical solution, in the step S1 of randomly generating an initial population, a Latin hypercube sampling method is used to divide the solution space into N non-overlapping sub-regions, and a point is randomly selected in each sub-region as a floating-point vector of individual gene code.

[0009] As a further improvement of the technical solution, in the step S2 of establishing a population fitness distribution histogram, the fitness value range is divided into 20 equal intervals, the number of individuals in each interval is counted, and the population fitness distribution characteristics are intuitively presented through the histogram.

[0010] As a further improvement of the technical solution, in the step S2 of calculating the genotype diversity index, the Hamming distance is calculated for the gene code floating-point vectors of each two individuals in the population in turn, and the average value of all Hamming distances is taken as the genotype diversity index.

[0011] As a further improvement of the technical solution, in the step S2 of calculating the phenotype diversity index, the population individuals are first sorted according to the fitness value, and the top 20% and bottom 20% individuals are selected to form a comparison subset, the Manhattan distance sum of the gene code floating-point vectors between the two subsets is calculated as the phenotype diversity index.

[0012] As a further improvement of the technical solution, between steps S2 and S3, a diversity warning mechanism is set: When the genotype diversity index decreases by more than 10% for 3 consecutive iterations, and the phenotype diversity index increases by more than 15%, immediately trigger the gradient descent local search on the individual with the optimal fitness of the current generation.

[0013] As a further improvement of the technical solution, in the step S3 of performing gradient descent local search, a dynamic step size adjustment strategy is adopted: The first iteration step is set to 0.1, and the step is adjusted according to the loss function change rate in each subsequent iteration, if the loss function decrease rate is greater than 20%, the step is increased by 0.05, if it is less than 5%, the step is halved.

[0014] As a further improvement of the technical solution, before the optimized vector in step S3 is added to the population, effectiveness verification is performed: The cosine similarity of the new individual and the gene encoding of all individuals in the population is calculated, if there is an individual with a cosine similarity greater than 0.95, the gradient descent local search is re-executed.

[0015] As a further improvement of the technical solution, the step S4 tournament selection operation adopts a hierarchical selection strategy, the population is divided into 5 levels according to the fitness value, each level performs tournament selection, and the top 20% individuals in each layer are selected to form a new population.

[0016] As a further improvement of the technical solution, in the Gaussian mutation operation in step S4, boundary repair is performed on the mutated individual, if there is a value in the gene encoding floating point number vector that exceeds the solution space range, replace the value with the boundary value closer to the original value.

[0017] Compared with the prior art, the beneficial effects of the present application are: In the artificial intelligence optimal solution search method based on the genetic model, in the initial population generation aspect, the Latin hypercube sampling method is adopted, so that the population is uniformly distributed in the solution space, fully covers the potential solution area, greatly improves the probability of finding the global optimal solution, avoids the optimal solution omission problem caused by sampling deviation in the early search, through real-time calculation of the genotype and phenotype diversity index, combined with the diversity early warning mechanism, the population diversity change can be captured sensitively, when the diversity appears abnormal fluctuation, the gradient descent local search of the optimal individual is triggered immediately, which effectively prevents the algorithm from falling into local optimal solution, ensures that the search direction always advances towards the global optimum, in the search process, the dynamic step adjustment strategy changes the step according to the loss function change, accelerates the convergence speed while avoiding excessive search, so that the algorithm runs stably and efficiently in the complex solution space, and finally improves the quality of the search result. BRIEF DESCRIPTION OF DRAWINGS

[0018] Figure 1 The overall workflow diagram of the present application. DETAILED DESCRIPTION

[0019] With reference to the drawings of the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work are within the protection scope of the present application.

[0020] Please refer to Figure 1 As shown in the drawings, the embodiment provides an artificial intelligence optimal solution search method based on a genetic model, including the following steps: S1, randomly generating an initial population containing N individuals according to a constraint condition, and using a floating-point number vector to represent the gene coding of each individual, and the vector dimension is consistent with the solution space dimension; According to a specific artificial intelligence problem, the upper and lower bounds of each dimension of the solution space are determined, so that the subsequent sampling and searching are carried out within a reasonable range. In step S1, the initial population is randomly generated, and the Latin hypercube sampling method is used. For each dimension, the solution space interval of the dimension is divided into N non-overlapping sub-regions according to the equal probability principle, and a point in each sub-region is randomly selected as the floating-point number vector of the individual gene coding. For each sub-region, a value is randomly selected in each corresponding dimension interval, and these values are combined into a floating-point number vector as the sampling point of the sub-region, that is, the gene coding of the individual. For example, in a two-dimensional solution space, the interval of the first dimension of a sub-region is [2, 4), and the interval of the second dimension is [5, 7). Then a number, such as 2.5, is randomly selected in [2, 4), and a number, such as 6, is randomly selected in [5, 7). The vector [2.5, 6] is combined as the sampling point of the sub-region, avoiding the genetic algorithm from falling into local optimum, and improving the probability of finding the global optimal solution. The above sampling step in the sub-region is repeated until a sampling point is generated for each sub-region. Combining these sampling points together, the initial population containing N individuals is obtained.

[0021] S2, calculating the fitness value of each individual through a preset loss function, establishing a population fitness distribution histogram, and calculating the genotype diversity index and phenotype diversity index of the current population in real time; All individuals in the population are traversed, the fitness value of each individual is calculated, the maximum and minimum values are found, in step S2, the population fitness distribution histogram is established, the fitness value range is divided into 20 equal intervals, the width of each interval is calculated, then the boundaries of each interval are determined in turn from the minimum value, the number of individuals in each interval is counted, all individuals in the population are traversed, for the fitness value of each individual, determine which interval it belongs to, and add 1 to the number of individuals in that interval, take the fitness interval as the horizontal coordinate, the number of individuals in each interval as the vertical coordinate, draw a histogram, the histogram intuitively presents the population fitness distribution characteristics, the intuitive graphical display can enable researchers to quickly grasp the population fitness distribution characteristics, such as whether there is a peak value, whether the distribution is uniform, etc., which helps to adjust the parameters or strategies of the genetic algorithm in time.

[0022] All individuals in the population are obtained and the number of individuals is recorded, two nested loops are used to traverse all individual pairs, the outer loop starts from the first individual, and the inner loop starts from the next individual of the current individual in the outer loop, which can avoid repeated calculation of the same individual pair, in step S2, when calculating the genotype diversity index, the gene encoding float number vector of each two individuals in the population is converted into a binary string according to a fixed precision, the Hamming distance is calculated for each pair of individuals, for each pair of individual binary codes, their binary bits are compared bit by bit, the number of different bits is counted, which is the Hamming distance of the two individuals, the average of all Hamming distances is taken as the genotype diversity index, all the Hamming distances of the individual pairs are added up, and then divided by the total number of individual pairs to obtain the average Hamming distance, which is taken as the genotype diversity index, which provides an important basis for judging the evolution state of the population and adjusting the strategy in the genetic algorithm.

[0023] A diversity warning mechanism is set between steps S2 and S3: After the genotype diversity index and the phenotype diversity index are calculated in each step S, they are stored in the corresponding list. At the end of each iteration, the length of the list is checked to see if it has reached more than 3 iterations. When the recorded index values reach 3 iterations, the current genotype diversity index is calculated relative to the decline in the previous 3 iterations, and the current phenotype diversity index is calculated relative to the increase in the previous 3 iterations. The calculated genotype diversity index decline is checked to see if it is greater than 0.1 and the phenotype diversity index is greater than 0.15. If both conditions are met, the pre-warning mechanism is triggered. When the genotype diversity index has a continuous decline of more than 10% for 3 iterations and the phenotype diversity index has an increase of more than 15%, the gradient descent local search is triggered for the current optimal individual. The individual with the optimal fitness is found from the current population, and its gene vector is extracted as the initial point. According to the method described in step S3, the vector is iterated 5 times in the negative gradient direction of the loss function with a fixed step size. The optimized vector is added to the population as a new individual. When the population diversity is insufficient, the local search and the introduction of new individuals improve the possibility of finding the global optimal solution by the genetic algorithm and improve the performance of the algorithm.

[0024] S3, when the genotype diversity index is less than 0.15 or the phenotype diversity index is greater than 0.85, perform gradient descent local search on the current optimal individual, including extracting the individual's gene vector as the initial point, iterating 5 times in the negative gradient direction of the loss function with a fixed step size, and adding the optimized vector to the population as a new individual; When performing gradient descent local search in step S3, a dynamic step size adjustment strategy is used: The first iteration step size is set to 0.1. The gene vector of the individual with the optimal fitness in the current population is extracted as the initial point for the gradient descent local search. In each iteration, the loss function value of the current iteration and the loss function value of the previous iteration are recorded, and the loss function change rate is calculated to provide a quantitative index for step size adjustment, making the step size adjustment strategy more scientific and targeted. In subsequent iterations, the step size is adjusted according to the loss function change rate. If the loss function decrease rate is greater than 20%, the step size increases by 0.05. If it is less than 5%, the step size is halved. If the change rate is between 5% and 20%, the step size remains unchanged. This allows the gradient descent local search to maintain high efficiency and accuracy at different search stages, and to find better solutions more quickly. The gradient of the loss function at the current individual gene vector is calculated, and the gene vector is updated to obtain the gene vector for the next iteration. By continuously iterating and updating, the local optimal solution is gradually approached, enhancing the optimization effect of the current optimal individual. When the number of iterations reaches 5, the gradient descent local search is stopped, and the gene vector obtained in the last iteration is added to the population as a new individual. The optimization of the optimal individual is completed in a limited time, and the evolutionary potential of the population is enhanced by the new individual, promoting the genetic algorithm to search for optimal solutions better.

[0025] The optimized vector in step S3 is added to the population before effectiveness verification: After completing the gradient descent local search, the optimized new individual gene coding vector is obtained, and the gene coding vectors of all individuals in the current population are obtained. For each individual gene coding vector in the population, the cosine similarity between the new individual and all individuals in the population is calculated using the cosine similarity formula. By quantifying the similarity value, the similarity between the new individual and other individuals in the population can be intuitively evaluated, providing a basis for subsequent decision-making. By traversing all the calculated cosine similarity values, it is checked whether there is a cosine similarity greater than 0.95. If there is an individual with a cosine similarity greater than 0.95, the new individual is determined to be invalid, and the gradient descent local search is re-executed. If all similarity values are less than or equal to 0.95, the new individual is determined to be valid, accurately selecting a new individual with large differences from individuals in the population, ensuring that the new individual brings new genetic characteristics to the population. If the new individual is determined to be invalid, the gene vector of the individual with the optimal fitness in the current generation is taken as the initial point, and the gradient descent local search method is followed to perform 5 iterations again to obtain a new optimized vector. Then the effectiveness verification process is repeated until an effective new individual is obtained. The gene coding vector of the verified effective new individual is added to the population, and the composition of the population is updated.

[0026] S4, tournament selection, single-point crossover and Gaussian mutation operations are performed on the population that does not trigger step S3, and the mutation probability is fixed at 0.02 until the maximum number of iterations is reached.

[0027] All individuals in the current population are sorted in descending order of fitness value. The number of individuals that each level should contain is calculated based on the total number of population individuals. In step S4, the tournament selection operation adopts a hierarchical selection strategy, and the population is divided into 5 levels according to the fitness value, with n individuals in each level. Tournament selection is performed for each level, and for each level, the tournament selection operation is repeated, with k individuals randomly selected from the level each time, and the individual with the highest fitness value is selected as the winner. This process is repeated until the top 20% of individuals in the level are selected to form a new population, and the number of new population individuals is obtained. The original population is replaced by the newly formed population, providing a new operation object for subsequent single-point crossover and Gaussian mutation operations, ensuring the continuity and evolution of the algorithm, and enabling the algorithm to continuously develop in a better direction.

[0028] In step S4, boundary repair is performed on the mutated individual. If there is a value in the gene coding float number vector that exceeds the range of the solution space, replace it with the boundary value closer to the original value; For each individual in the population, it is determined whether to perform mutation operation on it with a mutation probability of 0.02, if it is determined to perform mutation, for each dimension in the floating point number vector coded by the individual gene, a random number obeying Gaussian distribution is generated, the original value of the dimension is added to the random number to obtain the mutated value, for each individual gene coded floating point number vector after mutation, the value of each dimension is traversed, at the same time, the upper and lower bounds of the dimension solution space are obtained, and it is checked whether the value of each dimension is less than the lower bound or greater than the upper bound, so that the algorithm can focus more on the optimal solution in the feasible solution space, if the value of each dimension is less than the lower bound, the value of the dimension is repaired to the lower bound value, if the value of each dimension is greater than the upper bound, the value of the dimension is repaired to the upper bound, so that the individual after mutation is still a feasible solution, avoiding the situation that the algorithm falls into error or cannot converge due to the existence of invalid individual, improving the stability and reliability of the algorithm, the repaired individual gene coding vector is put back to the corresponding position in the original population, the update of the population is completed, and it is ensured that all individuals in the population are feasible solutions, which provides a reliable basis for subsequent genetic operations such as crossover and selection, ensures the continuity and effectiveness of the algorithm, enables the algorithm to continuously evolve in the feasible solution space, gradually approaches the optimal solution, and improves the performance and solution quality of the algorithm.

[0029] The application firstly generates an initial population by using Latin hypercube sampling method according to constraint conditions, so that the individuals are uniformly distributed in the solution space, then calculates the individual fitness value, constructs a fitness distribution histogram, and monitors the genotype and phenotype diversity indexes in real time, when the diversity indexes reach a specific threshold or meet the early warning conditions, performs gradient descent local search on the optimal individual, adopts a dynamic step adjustment strategy to optimize the search process, and verifies the effectiveness of the optimization vector, when the local search is not triggered, performs tournament stratified selection, single-point crossover and Gaussian mutation operation on the population, and repairs the boundary of the mutated individual, so that the population diversity control in the complex solution space is insufficient in the traditional method, and the problem of falling into local optimum is solved, and the search efficiency and result quality are improved.

[0030] The basic principles, main features and advantages of the application are shown and described above. Those skilled in the art should understand that the application is not limited by the above examples, the above examples and descriptions in the specification are only preferred examples of the application, and are not intended to limit the application, various changes and improvements can be made to the application without departing from the spirit and scope of the application, and these changes and improvements all fall within the scope of the claimed application. The scope of protection of the application is defined by the appended claims and their equivalents.

Claims

1. A genetic model-based artificial intelligence optimal solution search method, characterized in that, Includes the following steps: S1. Randomly generate an initial population containing N individuals according to the constraints. The gene encoding of each individual is represented by a floating-point vector, and the vector dimension is consistent with the solution space dimension. S2. Calculate the fitness value of each individual using a preset loss function, establish a population fitness distribution histogram, and calculate the genotypic diversity index and phenotypic diversity index of the current population in real time. S3. When the genotype diversity index is less than 0.15 or the phenotypic diversity index is greater than 0.85, perform gradient descent local search on the individual with the best fitness in the current generation, including extracting the gene vector of the individual as the initial point, iterating 5 times along the negative gradient direction of the loss function with a fixed step size, and adding the optimized vector as a new individual to the population. S4. Perform tournament selection, single-point crossover, and Gaussian mutation operations on the population that has not triggered step S3, with the mutation probability fixed at 0.02, until the maximum number of iterations is reached.

2. The method for searching for optimal solutions using artificial intelligence based on a genetic model according to claim 1, characterized in that, In step S1, when randomly generating the initial population, the Latin hypercube sampling method is used to divide the solution space into N non-overlapping sub-regions. In each sub-region, a point is randomly selected as the floating-point vector encoding the individual gene.

3. The method for searching for optimal solutions using artificial intelligence based on a genetic model according to claim 1, characterized in that, In step S2, when establishing the population fitness distribution histogram, the fitness value range is divided into 20 equally spaced intervals, and the number of individuals in each interval is counted. The histogram visually presents the population fitness distribution characteristics.

4. The method for searching for optimal solutions based on genetic models using artificial intelligence, as described in claim 1, is characterized in that... In step S2, when calculating the genotype diversity index, the Hamming distance is calculated sequentially for the gene encoding floating-point vectors of every two individuals in the population, and the average value of all Hamming distances is taken as the genotype diversity index.

5. The method for searching for optimal solutions using artificial intelligence based on a genetic model according to claim 1, characterized in that, In step S2, when calculating the phenotypic diversity index, the individuals in the population are first sorted according to their fitness values, and the top 20% and bottom 20% of individuals are selected to form a comparison subset. The sum of the Manhattan distances between the gene coding floating-point vectors of the two subsets is calculated as the phenotypic diversity index.

6. The method for searching for optimal solutions using artificial intelligence based on a genetic model according to claim 1, characterized in that, Between steps S2 and S3, a diversity early warning mechanism is set up: When the genotype diversity index decreases by more than 10% for three consecutive iterations and the phenotypic diversity index increases by more than 15%, a gradient descent local search for the best-fit individual in the current generation is immediately triggered.

7. The method for searching for optimal solutions using artificial intelligence based on a genetic model according to claim 1, characterized in that, In step S3, when performing the gradient descent local search, a dynamic step size adjustment strategy is adopted: The initial iteration step size is set to 0.

1. In subsequent iterations, the step size is adjusted according to the rate of change of the loss function. If the rate of decrease of the loss function is greater than 20%, the step size is increased by 0.05; if it is less than 5%, the step size is halved.

8. The method for searching for optimal solutions using artificial intelligence based on a genetic model according to claim 1, characterized in that, Before adding the optimized vector to the population in step S3, its effectiveness is verified. Calculate the cosine similarity between the new individual and the gene codes of all individuals in the population. If there is an individual with a cosine similarity greater than 0.95, then re-execute the gradient descent local search.

9. The method for searching for optimal solutions using artificial intelligence based on a genetic model according to claim 1, characterized in that, In step S4, the tournament selection operation adopts a hierarchical selection strategy, dividing the population into 5 levels according to fitness values, and conducting tournament selection for each level, selecting the top 20% of individuals in each level to form a new population.

10. The method for searching for optimal solutions using artificial intelligence based on a genetic model according to claim 1, characterized in that, In step S4, during the Gaussian mutation operation, boundary repair is performed on the mutated individuals. If there is a value in the gene-encoded floating-point vector that exceeds the solution space range, the value is replaced with a boundary value in the solution space that is closer to the original value.