Self-adaptive program generation method based on artificial intelligence, intelligent agent and electronic equipment

By dynamically adjusting temperature parameters and selecting pressure, and combining feature extraction and fusion of large models, the problem of imbalance between exploration and utilization in evolutionary algorithms is solved, generating efficient and diverse programs and improving the effect of program generation.

CN120909564AActive Publication Date: 2025-11-07BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Application Number
CN202511430734.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-09
Publication Date
2025-11-07
Estimated Expiration
2045-10-09

AI Technical Summary

Technical Problem

Existing evolutionary algorithms struggle to effectively balance exploration and utilization capabilities during program generation, leading to premature convergence or insufficient diversity, which affects the efficiency and quality of program generation.

Method used

By determining the diversity information of the target population, dynamically adjusting the temperature parameters, selecting the first parent program and its corresponding second parent program, and performing evolutionary iterations to generate the target program, the large model is used to extract and fuse features of pseudocode and structured representations to optimize the selection pressure.

Benefits of technology

It has improved the ability to balance exploration and utilization during the evolution process, generated diverse and high-performance programs, and improved the efficiency and quality of program generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909564A_ABST
    Figure CN120909564A_ABST
Patent Text Reader

Abstract

The invention discloses an adaptive program generation method based on artificial intelligence, an intelligent agent and electronic equipment, and relates to the technical field of computers, in particular to the artificial intelligence fields of deep learning, large models, intelligent agents, coding agents, auxiliary programming and the like. According to the specific implementation scheme, diversity information of a target population is determined; wherein the diversity information is used for indicating the program diversity of the target population; determining temperature parameters according to the diversity information; wherein the temperature parameter is used for adjusting and selecting pressure; selecting a first parent program and a second parent program corresponding to the first parent program from the target population according to the temperature parameter; and performing evolution iteration according to the first parent program and the second parent program to obtain a target program.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, especially to the field of artificial intelligence such as deep learning, large models, agents, coding agents, and auxiliary programming, and specifically relates to an adaptive program generation method based on artificial intelligence, an agent, an electronic device, and a storage medium. BACKGROUND

[0002] Evolutionary algorithms are a class of optimization algorithms inspired by biological evolution theory, which search for optimal or approximate optimal solutions in the solution space by simulating mechanisms such as natural selection, genetic, and mutation. Evolutionary algorithms have been widely applied in fields such as engineering design, bioinformatics, artificial intelligence, etc. For example, in the field of artificial intelligence, they can be applied to program generation, scientific computing model optimization, etc. SUMMARY

[0003] The present application provides an adaptive program generation method based on artificial intelligence, an agent, an electronic device, and a storage medium. The specific solutions are as follows: According to an aspect of the present application, an adaptive program generation method based on artificial intelligence is provided, comprising: determining diversity information of a target population; wherein the diversity information is used to indicate program diversity of the target population; determining a temperature parameter according to the diversity information; wherein the temperature parameter is used to adjust selection pressure; selecting a first parent program and a second parent program corresponding to the first parent program from the target population according to the temperature parameter; performing evolutionary iteration according to the first parent program and the second parent program to obtain a target program.

[0004] According to another aspect of the present application, an agent is provided, comprising: a first determination module configured to determine diversity information of a target population; wherein the diversity information is used to indicate program diversity of the target population; a second determination module configured to determine a temperature parameter according to the diversity information; wherein the temperature parameter is used to adjust selection pressure; a selection module configured to select a first parent program and a second parent program corresponding to the first parent program from the target population according to the temperature parameter; a generation module configured to perform evolutionary iteration according to the first parent program and the second parent program to obtain a target program.

[0005] According to another aspect of the present application, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected with the at least one processor; wherein The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the above embodiments.

[0006] According to another aspect of the present application, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method according to the above embodiments.

[0007] According to another aspect of the present application, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method according to the above embodiments.

[0008] The artificial intelligence-based adaptive program generation method, agent, electronic device and storage medium provided by the embodiments of the present application can determine the diversity information of the target population, determine the temperature parameter according to the diversity information, select the first parent program and the corresponding second parent program from the target population according to the temperature parameter, and evolve and iterate the target population according to the first parent program and the second parent program to obtain the target program. Therefore, in the process of evolution and iteration, the temperature parameter can be dynamically adjusted according to the diversity information of the population, the matching degree of the temperature parameter and the program diversity of the population can be improved, the parent program can be adaptively selected based on the temperature parameter, the balance ability of exploration and utilization in the evolution process can be improved, and then the diversified and high-performance program can be efficiently generated.

[0009] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0010] The accompanying drawings are used to better understand the present application, and do not constitute a limitation of the present application. Among them: Figure 1 A flowchart of an artificial intelligence-based adaptive program generation method provided by an embodiment of the present application is shown; Figure 2 A flowchart of an artificial intelligence-based adaptive program generation method provided by another embodiment of the present application is shown; Figure 3 A flowchart of an artificial intelligence-based adaptive program generation method provided by another embodiment of the present application is shown; Figure 4 A flowchart of an artificial intelligence-based adaptive program generation method provided by another embodiment of the present application is shown; Figure 5 A structural schematic diagram of an intelligent agent provided by an embodiment of the present application is shown in FIG. 1. Figure 6 A block diagram of an electronic device for implementing the artificial intelligence-based adaptive program generation method of the embodiments of the present application is shown in FIG. 2. DETAILED DESCRIPTION

[0011] Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to assist in understanding them. These should be considered in their context only. Thus, those of ordinary skill in the art will recognize the various changes and modifications of the embodiments described herein, without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and structures are omitted in the following description for clarity and conciseness.

[0012] It should be noted that the acquisition, storage, use, processing, etc. of data in the technical solutions of the present application comply with relevant provisions of national laws and regulations, and do not violate public order and good customs.

[0013] The artificial intelligence-based adaptive program generation method, intelligent agent, electronic device and storage medium of the embodiments of the present application are described below with reference to the accompanying drawings.

[0014] Figure 1 A flowchart of the artificial intelligence-based adaptive program generation method provided by an embodiment of the present application is shown in FIG. 3.

[0015] The artificial intelligence-based adaptive program generation method of the embodiments of the present application can be executed by the intelligent agent of the embodiments of the present application, which can be configured in an electronic device.

[0016] The electronic device can be any device with computing capability, such as a personal computer, a mobile terminal, a server, etc. The mobile terminal can be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, etc. hardware device with various operating systems, touch screens and / or display screens.

[0017] As shown in FIG. 2, the artificial intelligence-based adaptive program generation method includes: Figure 1 Step 101, determining the diversity information of the target population.

[0018] In the present application, a batch of programs can be randomly or using a large model to generate a batch of programs distributed to at least one initial population for each initial population to be evolved iteratively to select programs for solving the target problem from the population at the end of evolution.

[0019] ​Exemplarily, the target field can be the field of automatic algorithm discovery, or the field of scientific computing model optimization, or the field of automatic driving strategy optimization, or the field of generative AI (Artificial Intelligence), or can be other fields, which are not limited herein.

[0020] The target problem can be a problem in the target field that can be solved by a program.

[0021] For example, the target field is automatic algorithm discovery, and a researcher wants to automatically discover a new and efficient algorithm for a specific problem (such as community discovery on large-scale graph data).

[0022] In this application, the diversity information of the current target population can be determined in each evolutionary iteration.

[0023] Exemplarily, the target population can be any population corresponding to the target problem, and the target population can include at least one program, and the diversity information can be used to indicate the diversity of the programs in the target population. In addition, for the convenience of distinction, the programs belonging to the target population can be referred to as first candidate programs.

[0024] Exemplarily, the diversity information can include a diversity index, a diversity level, etc. The diversity index can be a numerical value, and the diversity index of the target population can be used to indicate the diversity of the programs in the target population. For example, the greater the diversity index, the higher the diversity of the programs in the target population; the diversity level of the target population can also be used to indicate the diversity of the programs in the target population. For example, the higher the diversity level, the higher the diversity of the programs in the target population.

[0025] Exemplarily, the diversity information of the programs in the target population can be determined according to the similarity between the first candidate programs in the target population.

[0026] Exemplarily, if the target population is multiple, the diversity information of each target population can be determined separately.

[0027] It can be understood that the target population can be one or more, which are not limited herein.

[0028] Step 102, determining a temperature parameter according to the diversity information.

[0029] The temperature parameter can be used to adjust the selection pressure. Exemplarily, the greater the temperature parameter, the more inclined to explore (Exploration), and the smaller the temperature parameter, the more inclined to exploit (Exploitation).

[0030] In this application, the temperature parameter can be determined according to the diversity information and the current number of evolutionary iterations.

[0031] Exemplarily, the annealing mechanism can be introduced by using the current evolution iteration number, and the current temperature parameter can be determined according to the diversity information and the annealing mechanism.

[0032] Exemplarily, the temperature parameter decreases with the increase of the evolution iteration number, and the temperature parameter is biased to be used in the later evolution iteration period. When the program diversity of the target population is high, the temperature parameter can be reduced according to the diversity information to promote the use, and when the program diversity is low, the temperature parameter can be increased according to the diversity information to enhance randomness and encourage exploration.

[0033] In step 103, the first parent program and the second parent program corresponding to the first parent program are selected from the target population according to the temperature parameter.

[0034] In this application, the selection probability of the first candidate program in the target population can be determined according to the temperature parameter, and the first parent program is selected from the first candidate program according to the selection probability, and the second parent program is selected for the first parent program from the first candidate program.

[0035] Exemplarily, the selection probability of the first candidate program can be determined according to the fitness of the first candidate program and the temperature parameter. The fitness of the first candidate program can be calculated by using the target function defined for the target problem.

[0036] For example, the target field is automatic driving strategy optimization, and a logical program for controlling the vehicle to avoid obstacles and path planning is to be generated. The target function can be safety, stability, and traffic efficiency in the automatic driving simulation environment.

[0037] In step 104, the first parent program and the second parent program are evolved to obtain the target program.

[0038] In this application, the first parent program and the second parent program can be subjected to cross mutation operation to generate offspring programs, the offspring programs can be used to replace the first candidate programs with low fitness in the target population to obtain a new population. If the evolution iteration stop condition is not met, the new population can be used as the target population for the next evolution iteration until the evolution iteration stop condition is met, and the final population is obtained. The target program is selected from the final population.

[0039] Exemplarily, if the offspring program is one, the offspring program can be used to replace the first candidate program with the lowest fitness in the target population, and if the offspring program is multiple, the multiple offspring programs can be used to replace the first candidate programs with the same number of offspring programs and the lowest fitness in the target population. It can be seen that the number of programs in the new population can be the same as the number of programs in the target program.

[0040] For example, the evolution iteration stopping condition can be reaching a preset iteration number, or finding a solution meeting a performance requirement, or other conditions, which are not limited in the present application.

[0041] For example, the number of target populations is 5, evolution iterations are performed for each target population, and when the evolution iteration stopping condition is met, 5 populations are finally obtained. The target program can be selected from the 5 final populations, or the program with the highest fitness can be selected from each population, so that the 5 selected programs are used as target programs, and the like.

[0042] It should be noted that the above method of selecting a target program is only an example, and can be selected according to actual needs, which is not limited in the present application.

[0043] As an application example, the self-adaptive program generation method based on artificial intelligence can be applied to AI-driven research agents, such as automated algorithm discovery, scientific computing model optimization, etc., can be applied to automated software development, such as code generation, code optimization and automatic program repair, can be applied to generative AI fields, such as AI-generated art, complex system design, etc., or other scenarios that require evolution iterations to seek innovative solutions.

[0044] In the embodiment of the present application, the diversity information of the target population is determined, the temperature parameter is determined according to the diversity information, the first parent program and the corresponding second parent program are selected from the target population according to the temperature parameter, and the target population is evolved according to the first parent program and the second parent program to obtain the target program. Therefore, during the evolution iteration process, the temperature parameter can be dynamically adjusted according to the diversity information of the population, the matching degree of the temperature parameter and the program diversity of the population can be improved, so that the parent program can be adaptively selected based on the temperature parameter, the balance between exploration and utilization of the evolution process can be improved, and thus the diversified and high-performance program can be efficiently generated.

[0045] Figure 2 The flowchart of the self-adaptive program generation method based on artificial intelligence provided by another embodiment of the present application is shown.

[0046] As Figure 2 shown, the self-adaptive program generation method based on artificial intelligence comprises: Step 201, performing feature extraction on the first candidate program in the target population to obtain a first embedding vector.

[0047] The first embedding vector can be used to represent the syntax and semantic structure of the first candidate program.

[0048] In the present application, for any first candidate program in the target population, a large model can be used to extract key features of the first candidate program code itself to generate a first embedding vector representing its syntax and semantic structure.

[0049] At step 202, the first candidate program is subjected to formal transformation processing to obtain a transformation result.

[0050] For example, the formal transformation processing can include but is not limited to pseudo code conversion, structured formal transformation, etc. The pseudo code conversion is used to convert the program code into pseudo code, and the structured formal transformation is used to convert the program into a structured representation.

[0051] To further improve the accuracy of program representation, in some embodiments, the first candidate program can be parsed to obtain code feature information of the first candidate program, and the first candidate program can be converted into pseudo code describing the functional intent of the first candidate program according to the code feature information, and the conversion result can be obtained according to the pseudo code.

[0052] For example, the code feature information can include but is not limited to the functional intent, target, structure, control flow, etc. of the code of the first candidate program.

[0053] For example, the pseudo code of the first candidate program can be generated according to the code feature information using a large model.

[0054] For example, the conversion result can include the pseudo code of the first candidate program, or other forms of conversion results, which are not limited.

[0055] Thus, by parsing the first candidate program, converting the first candidate program into pseudo code based on the code feature information obtained by parsing, and extracting features from the conversion result containing the pseudo code, the program characteristics can be captured from the abstract logical level.

[0056] In some embodiments, the first candidate program can be parsed to obtain a structured representation of the first candidate program, and the conversion result can be obtained according to the structured representation.

[0057] For example, the structured representation can include but is not limited to an abstract syntax tree, a control flow graph, etc.

[0058] For example, the conversion result can include the structured representation of the first candidate program, or other forms of conversion results, which are not limited.

[0059] Thus, by parsing the first candidate program into a structured representation, the program characteristics can be captured from the structure level.

[0060] Optionally, the first candidate program can be subjected to form conversion processing in either of the two form conversion processing methods.

[0061] Optionally, the first candidate program can be subjected to form conversion processing in either of the two form conversion processing methods.

[0062] Step 203: feature extraction is performed on the conversion result to obtain a second embedding vector.

[0063] In this application, the corresponding feature extraction method can be used to extract features from the conversion result according to the type of the conversion result to obtain the second embedding vector.

[0064] In some embodiments, if the conversion result includes the pseudo code of the first candidate program, the pseudo code can be subjected to feature extraction to obtain the second embedding vector. The second embedding vector can be used to represent the program characteristics of the first candidate program at the abstract logic level.

[0065] In some embodiments, if the conversion result includes the structured representation of the first candidate program, the structured representation can be subjected to feature extraction using a GNN (Graph Neural Network) to obtain the second embedding vector. The second embedding vector can be used to represent the program characteristics of the first candidate program at the structure level.

[0066] In some embodiments, if the conversion result includes the pseudo code, the structured representation, etc. of the first candidate program, the pseudo code and the structured representation can be subjected to feature extraction respectively, and the extracted feature vectors can be fused to obtain the second embedding vector.

[0067] Step 204: the first embedding vector and the second embedding vector are fused to obtain a fused representation vector.

[0068] In this application, the first embedding vector and the second embedding vector can be fused by splicing or weighted averaging to obtain the fused representation vector of the first candidate program.

[0069] For example, the second embedding vector is obtained by feature extraction on the pseudo code of the first candidate program. The first embedding vector and the second embedding vector can be fused to obtain a fused representation vector that can reflect the program code level and the functional intent level.

[0070] Step 205: diversity information is obtained according to the fused representation vector.

[0071] In the present application, the cosine distance of each pair of first candidate programs can be determined according to the fusion feature vectors of each pair of first candidate programs in the target population, the average cosine distance between the first candidate programs in the target population can be determined according to the average of the cosine distances of all pairs of first candidate programs in the target population, and the diversity information of the target population can be obtained according to the average cosine distance. Thus, based on the fusion feature vectors of the first candidate programs, the average cosine distance between the first candidate programs is calculated, which can improve the accuracy of the calculation and thus improve the accuracy of the diversity information.

[0072] The greater the average cosine distance, the higher the diversity of the programs in the target population can be considered.

[0073] Exemplarily, the average cosine distance can be used as a diversity index, and the diversity information can be obtained according to the diversity index. The diversity index can be a numerical value, and the diversity index can be used to represent the diversity of the programs in the target population.

[0074] In order to further enhance the robustness of the measurement, exemplarily, the auxiliary features of the target population can be obtained, the average cosine distance and the auxiliary features can be fused to obtain the diversity index. Here, the diversity index can be a comprehensive function of the core measurement and the auxiliary measurement reflecting the distribution, such as a weighted combination, so as to obtain a multi-dimensional and high-fidelity diversity index.

[0075] Exemplarily, the auxiliary features can include but are not limited to the code length of the first candidate program, the fitness of the first candidate program, and the average edit distance between the first candidate programs.

[0076] Exemplarily, the edit distance between each pair of first candidate programs in the target population can be calculated, and the average edit distance between the first candidate programs in the target population can be determined according to the average of the edit distances between all pairs of first candidate programs in the target population.

[0077] The edit distance between each pair of first candidate programs can be used to measure the difference between the codes of two first candidate programs.

[0078] Thus, according to the average cosine distance, the code length of the program, the fitness of the program, and the average edit distance of the population are combined to characterize the program in multiple dimensions, which can improve the accuracy and robustness of the diversity measurement.

[0079] Step 206, determining the temperature parameter according to the diversity information.

[0080] Step 207, selecting the first parent program and the second parent program corresponding to the first parent program from the target population according to the temperature parameter.

[0081] In the present application, steps 206-207 can refer to any of the implementation manners of the embodiments of the present application, and thus will not be described here again.

[0082] In step 208, evolutionary iteration is performed according to the first parent program and the second parent program to obtain the target program.

[0083] In some embodiments, the first parent program and the second parent program are subjected to crossover and mutation operations by using a large model to generate a child program, and then evolutionary iteration is performed according to the child program to obtain the target program. The process of performing evolutionary iteration according to the child program can refer to the above embodiments, and thus will not be described here again.

[0084] For example, a prompt template can be obtained, wherein the prompt template can include program generation task information, and the prompt template is filled according to the first parent program and the second parent program to obtain prompt information, and then the large model is used to perform crossover and mutation operations according to the prompt information to generate a child program.

[0085] The program generation task information is used to instruct the large model to perform a program generation task.

[0086] For example, the program generation task information can include but is not limited to a program generation task, a program generation requirement, etc.

[0087] For example, the prompt template can also include program output requirements, program generation examples, etc. The program output requirements can include output format requirements, program quantity requirements, etc.

[0088] For example, the prompt information can be "analyze the advantages and disadvantages of the two programs, and create a new program with better performance in combination with them".

[0089] Therefore, by using the large model to perform crossover and mutation operations on the selected parent programs to generate new child programs, the mutation direction can be controlled, the quality of the child programs can be improved, and the evolutionary iteration efficiency can be improved.

[0090] In the embodiments of the present application, by performing feature extraction on the first candidate program in the target population to obtain an embedding vector for representing the syntax and semantic structure of the program, and performing form conversion processing on the first candidate program, and performing feature extraction on the converted result to obtain an embedding vector corresponding to other program forms, and fusing the two embedding vectors, a multi-dimensional representation vector can be obtained, and the accuracy of program representation is improved. Figure 3 The flowchart of the self-adaptive program generation method based on artificial intelligence provided by another embodiment of the present application is shown.

[0091] As Figure 3As shown, the artificial intelligence based adaptive procedural generation method comprises: In step 301, the diversity information of the target population is determined.

[0092] In this application, step 301 can refer to any one of the implementation modes in the embodiments of the present application, and therefore will not be described here.

[0093] In step 302, the first value is taken modulo according to the current evolution iteration number to obtain a second value.

[0094] The difference between the first value and the total evolution iteration number can be greater than a preset threshold, and the first value can be considered to be a hyperparameter much greater than the total evolution iteration number.

[0095] In step 303, the temperature parameter is determined according to the ratio between the second value and the first value and the diversity index.

[0096] In the related art, the temperature parameter is usually determined only according to the evolution iteration number, but when the population diversity is relatively low, the search effort may not be increased in time, and when the diversity is high, the current high fitness individual cannot be fully utilized, so that the balance between exploration and utilization is poor.

[0097] Therefore, in this application, the diversity information of the target population can include a diversity index of the target population, and the temperature parameter can be determined according to the ratio between the second value and the first value in combination with the diversity index.

[0098] In some embodiments, a first difference between the target value and the diversity index can be determined, a fourth value with a base of a third value and an exponent of the first difference can be determined, a second difference between the target value and the ratio can be determined, and the temperature parameter can be determined according to the product of the second difference and the fourth value.

[0099] For example, the target value can be equal to 1, or it can also be other values, which are not limited.

[0100] For example, the target value can be subtracted from the diversity index to obtain the first difference.

[0101] For example, the third value can be a value greater than 1.

[0102] For example, the product of the second difference and the fourth value can be used as the temperature parameter.

[0103] In order to further improve the accuracy of the temperature parameter, for example, a temperature initial value for controlling randomness can be set, and the product of the temperature initial value for controlling randomness, the second difference and the fourth value can be used as the temperature parameter.

[0104] As an example, taking the target value as 1 and the base third value as For example, the temperature parameter of the target population can be calculated by using the following formula (1) : (1) wherein, is the temperature parameter; is the temperature initial value of the control selection randomness; n is the current evolution iteration number; is the first value, used for smoothing the evolution process; represents the modulo operation of the first value n according to the current evolution iteration number ; and is the diversity index of the target population.

[0105] In the above formula (1), the term simulates the simulated annealing process, and as the evolution iteration number n increases, the value gradually trends to 0 from 1, and in the later evolution stage, it is naturally inclined to exploitation; for the term , when the population diversity is high, the value decreases, and the temperature parameter is reduced to promote exploitation; when the diversity is low, the value increases, and the temperature parameter is increased to enhance randomness and encourage exploration, thereby effectively breaking the premature convergence.

[0106] Thus, while the temperature parameter is attenuated with the increase of the evolution iteration number, according to the diversity index, the temperature parameter is dynamically adjusted by using the exponential function, so that when the diversity is high, the temperature parameter is reduced to promote exploitation, and when the diversity is low, the temperature parameter is increased to encourage exploration, thereby realizing the dynamic balance between exploration and exploitation in the evolution process.

[0107] In step 304, the first parent program and the second parent program corresponding to the first parent program are selected from the target population according to the temperature parameter.

[0108] In step 305, the evolution iteration is performed according to the first parent program and the second parent program, so as to obtain the target program.

[0109] In the present application, steps 304-305 can refer to any one of the implementation manners in the embodiments of the present application, and thus will not be described herein again.

[0110] In the embodiments of the present application, the temperature parameter is determined according to the ratio between the second value obtained by taking the modulus of the first value according to the current evolution iteration number and the first value much larger than the total number of evolution iterations, and the diversity index of the target population. Thus, by determining the temperature parameter according to the ratio and the diversity index of the target population, the temperature parameter can not only decay with the increase of the evolution iteration number, so that the selection in the later stage is biased towards exploitation, but also the adaptability of the temperature parameter is improved by adjusting the temperature parameter according to the diversity index of the target population, so that the balance between exploration and exploitation in the evolution process can be improved.

[0111] Figure 4 A flowchart of an adaptive program generation method based on artificial intelligence provided by another embodiment of the present application is shown.

[0112] As shown in Figure 4 , the adaptive program generation method based on artificial intelligence comprises: Step 401, determining the diversity information of the target population.

[0113] Step 402, determining the temperature parameter according to the diversity information.

[0114] In the present application, steps 401-402 can refer to any one of the implementation modes in the embodiments of the present application, and therefore will not be described here.

[0115] Step 403, determining the target cluster from at least one cluster of the target population according to the temperature parameter.

[0116] In the present application, the target population can include at least one cluster, and each cluster can include at least one program. In addition, in order to facilitate distinction, the programs belonging to one cluster can be referred to as second candidate programs.

[0117] In some embodiments, for any cluster in the at least one cluster, the performance score of any cluster can be determined, and then the target cluster is selected from the at least one cluster of the target cluster according to the performance score of the at least one cluster.

[0118] The performance score of any cluster can be used to measure the relationship between the program quality and the cluster size of any cluster.

[0119] For example, the performance score of any cluster can be determined according to the fitness of the second candidate program in any cluster and the number of second candidate programs in any cluster, and the selection probability of any cluster can be determined according to the temperature parameter and the performance score, and then the target cluster is selected from the at least one cluster of the target population according to the selection probability of the at least one cluster.

[0120] For example, the average fitness of the second candidate programs in any cluster can be calculated based on the fitness of the second candidate programs in that cluster, and the ratio between the average fitness and the number of second candidate programs in that cluster can be determined as the performance score.

[0121] For example, the fitness of the second candidate program can be determined, and the performance score can be determined based on the ratio between the maximum fitness and the number of second candidate programs. For instance, the ratio between the maximum fitness and the number of second candidate programs can be used to determine the performance score.

[0122] As an example, the performance score for each cluster can be calculated using the following formula (2): (2) in, It is a cluster Performance score; It is a cluster Second Candidate Program p The fitness of; Represents a cluster The size of the cluster. The number of second-choice programs.

[0123] Therefore, we can encourage the selection of clusters containing high-performance programs by using the numerator, i.e., the maximum fitness, and suppress the monopoly of large clusters by using the denominator, i.e., the number of second candidate programs, thus providing opportunities for small clusters representing novel directions. This can achieve the goal of selecting clusters that have been explored less and have high performance scores.

[0124] For example, the selection probability of any cluster can be determined using an exponential function based on temperature parameters and performance scores.

[0125] As an example, the selection probability of each cluster can be calculated using the following formula (3): (3) in, It is a cluster The probability of choosing; It is a cluster Performance score; It is a cluster Performance score; This is a temperature parameter used to adjust the selected pressure. In formula (3)... When the T value is high, the probability distribution tends to be uniform, which encourages exploration; when the T value is low, the probability distribution tends to be concentrated, which encourages utilization.

[0126] Thus, by determining the performance score of the cluster according to the fitness of the second candidate program in any cluster and the number of the second candidate programs in the cluster, and determining the selection probability of the cluster according to the temperature parameter and the performance score, the cluster selection pressure can be dynamically adjusted according to the temperature parameter, and adaptive selection of the cluster is realized.

[0127] Step 404, selecting a first parent program from the target cluster.

[0128] In the present application, the second candidate programs in the target cluster can be sorted in descending order of their fitness, and the first parent program can be determined as the second candidate program with the highest fitness. Thus, a program with relatively high quality can be selected to generate a child program, and the quality of the programs in the population can be continuously improved through evolution iteration.

[0129] For example, the second candidate program with the highest fitness in the target cluster can be selected as the first parent program.

[0130] For example, the number of target clusters can be one or more. If the number of target clusters is more than one, a first parent program can be selected from each target cluster. Thus, the number of first parent programs can be one or more, which is not limited.

[0131] Step 405, selecting a second parent program from the target population according to the first parent program.

[0132] In order to continuously improve the quality of the programs in the population, for any first parent program, the target population to which the first parent program belongs can be used as a candidate pool, and a program suitable for crossover or mutation with the first parent program can be selected from the target population.

[0133] In some embodiments, for any first candidate program in the target population, the cosine distance can be calculated according to the fusion feature vector of the first parent program and the fusion feature vector of the first candidate program, the difference degree between the first parent program and the first candidate program can be determined according to the cosine distance, and the first candidate program with the largest difference degree from the first parent program in the target population can be selected as the second parent program. The greater the cosine distance between the programs, the greater the difference degree between the programs.

[0134] In addition, the method for obtaining the fusion feature vector of the first parent program can refer to the method for obtaining the fusion feature vector of the first candidate program in the above embodiments, which will not be described here.

[0135] In some embodiments, the diversity information of the target population may include diversity indices. For any first candidate program in the target population, the degree of difference between the first parent program and the first candidate program may be determined based on the fusion representation vector of the first parent program and the fusion representation vector of the first candidate program. Based on the diversity indices of the target population, a first weight for the fitness of the first candidate program and a second weight for the degree of difference may be determined. Based on the first weight and the second weight, the fitness and degree of difference of the first candidate program are weighted to obtain a comprehensive score for the first candidate program. Then, based on the comprehensive score, a second parent program is selected from the target population.

[0136] The overall score of the first candidate program can be used to characterize the overall information of the first candidate program in terms of quality and the degree of difference from the first parent program.

[0137] For example, the diversity index can be normalized to obtain a normalized index, which is then determined as the first weight, and the difference between the target value and the normalized index is determined as the second weight.

[0138] For example, the diversity index can be normalized by determining the ratio between the diversity index and the score threshold, and using the minimum of this ratio and the target value as the normalization index.

[0139] For example, the score threshold is t If the target value is 1, then the normalized index is... .

[0140] As an example, the overall score of the first candidate program can be calculated using the following formula (4): (4) in, It is the first candidate program The overall score; It is a normalized indicator; It is the first candidate program The fitness of; It is the first candidate program With the first parent program The degree of difference between them.

[0141] Therefore, when the population diversity is high, the weight of fitness is relatively large, and the population tends to select high-performance individuals for utilization. When the diversity is low, the weight of difference is relatively large, and the population tends to select the first candidate program that is very different from the first parent program to introduce new genes, thereby strengthening exploration and improving the balance between exploration and utilization.

[0142] For example, the second parent program can be selected from the target population according to the comprehensive score in the following manner: the selection probability of any first candidate program can be determined according to the comprehensive score of the first candidate program and the sum of the comprehensive scores of the first candidate programs in the target population, and the second parent program can be selected from the target population according to the selection probability of the first candidate program.

[0143] For example, if there are multiple first parent programs, the above method can be used to select a second parent program for each first parent program.

[0144] Therefore, by determining the weight of the fitness of the first candidate program and the weight of the difference between the first parent program and the first candidate program according to the diversity index, dynamically determining the comprehensive score by weighting, and selecting the second parent program based on the comprehensive score, a second parent program with appropriate crossover and mutation can be selected for the first parent program.

[0145] At step 406, evolution iteration is performed according to the first parent program and the second parent program to obtain the target program.

[0146] In this application, step 406 can be implemented in any of the embodiments of the present application, and therefore will not be described here.

[0147] In some embodiments, the first parent program and the second parent program can be subjected to crossover and mutation operations to generate a child program, and the child program can be determined to belong to a cluster in the target population. The child program can be placed in the cluster to replace a program with low fitness in the target population, thereby completing population updating to obtain a new population. If the evolution iteration stop condition is not met, the new population can be used as the target population for the next evolution iteration until the evolution iteration stop condition is met, and a final population is obtained. The target program can be selected from the final population. The method of generating the child program can be referred to other embodiments, and therefore will not be described here.

[0148] For example, after generating the child program each time, it is determined whether a re-clustering condition is met. If the re-clustering condition is not met, the child program is determined to be closest to a cluster in the target population, and the child program is placed in the cluster to replace a program with low fitness in the target population to obtain a new population. If the re-clustering condition is met, the program with low fitness in the target population is removed, and the child program and the remaining programs in the target population are re-clustered to obtain at least one new cluster, thereby completing population updating to obtain a new population.

[0149] For example, the re-clustering condition can be that the number of child programs generated from the last re-clustering to the current time reaches a preset number, or the number of evolution iterations reaches a preset number, or other conditions, which are not limited herein.

[0150] In the embodiments of the present application, by adaptively selecting a target cluster from at least one cluster of the target population according to the temperature parameter, the quality of the first parent program can be guaranteed, and by selecting the second parent program according to the first parent program, the quality of the second parent program can be improved, so that the quality of the new offspring program generated according to the first parent program and the second parent program can be improved.

[0151] The artificial intelligence-based adaptive program generation method of the embodiments of the present application can be widely applied to fields that need to generate solutions through evolution, and the following will be described by taking automatic algorithm discovery as an example: Scenario description: A researcher wants to automatically discover a new and efficient algorithm for a specific problem (such as community discovery on large-scale graph data).

[0152] Application process: Initialization: The researcher defines the objective function of the problem, that is, the score function, for example, scores according to the modularity Q value and computational efficiency of the algorithm. First, randomly generate or use a large model to generate a batch of initial community discovery algorithm programs as the initial population.

[0153] Evolution iteration starts: Evaluation and characterization: Calculate the score for each population, and generate a fusion feature vector for each program. At the same time, calculate the diversity index of each population.

[0154] Selection: Independently select the first parent program on each population, and select multiple pairs of (first parent program, second parent program).

[0155] Generation: Input the code and analysis of each pair of (first parent program, second parent program) into a large model, and use the prompt information to perform “crossing” and “mutation” to generate a new offspring program. For example, the prompt information can be: “analyze the advantages and disadvantages of the two programs, and create a new program with better performance by combining them”.

[0156] Replacement and migration: The newly generated offspring program is put back into the population to replace the low fitness programs in the population. In addition, periodically, individual migration can be performed between populations, that is, the individual with the highest fitness in one population is migrated to another population to promote gene exchange.

[0157] Termination: The evolution iteration is performed until the termination condition is met (such as reaching the predetermined number of generations, finding a solution that meets the performance requirements).

[0158] Final output: A series of high-performance and diversified community discovery algorithms can be selected from the final obtained population for the researcher to select and analyze.

[0159] In the field of automatic driving strategy optimization, the scheme of the present application can be applied to generate a logical program for controlling the vehicle to avoid obstacles and path planning through evolutionary iteration. The objective function can be safety, stability and traffic efficiency in a simulated environment.

[0160] In the field of game AI design, the scheme of the present application can be applied to generate a decision tree or state machine program for controlling the behavior of game NPCs (Non-Player Characters) through evolutionary iteration. The objective function can be the win rate in confrontation with players or other AI.

[0161] In addition, the scheme of the present application can also be extended to the field of drug molecule design, to generate a chemical formula or structure of a molecule through evolutionary iteration. The objective function can be the binding energy with the target point, etc.

[0162] The artificial intelligence-based adaptive program generation method of the embodiments of the present application has the following beneficial effects: (1) Improve the upper limit of problem solving: by effectively avoiding premature convergence, there is a greater chance to jump out of the local optimum and find truly breakthrough, novel solutions that human experts may not have thought of.

[0163] (2) Accelerate innovation efficiency: adaptive selection strategy allows computational resources to be intelligently allocated to the most promising evolutionary direction, whether exploring new areas or deepening advantage areas, more efficient than fixed strategies, shortening the R&D cycle of the above-mentioned second generation program.

[0164] (3) Enhance the diversity of results: precise diversity measurement and maintenance mechanism can ensure that the final output is of high quality and has different styles, providing users with more diverse selection space.

[0165] (4) Improve automation level: adaptive characteristics reduce the dependence on manual parameter tuning (such as temperature annealing rate), improve the robustness and automation of evolutionary iteration.

[0166] To achieve the above embodiments, the embodiments of the present application also propose an agent. Figure 5 The structure diagram of the agent provided by an embodiment of the present application is shown.

[0167] As shown in Figure 5 the agent 500 includes: a first determination module 510 configured to determine diversity information of a target population; wherein the diversity information is used to indicate program diversity of the target population; a second determination module 520 configured to determine a temperature parameter according to the diversity information; wherein the temperature parameter is used to adjust the selection pressure; The selection module 530 is configured to select a first parent program and a second parent program corresponding to the first parent program from the target population according to the temperature parameter. The generation module is configured to perform evolutionary iteration according to the first parent program and the second parent program to obtain a target program.

[0168] Optionally, the first determination module 510 is configured to: extract features of the first candidate programs in the target population to obtain first embedding vectors; wherein the first embedding vectors are used to represent the syntax and semantic structure of the first candidate programs; perform form conversion processing on the first candidate programs to obtain conversion results; extract features of the conversion results to obtain second embedding vectors; fuse the first embedding vectors and the second embedding vectors to obtain fusion representation vectors; obtain the diversity information according to the fusion representation vectors.

[0169] Optionally, the first determination module 510 is configured to: determine average cosine distances between the first candidate programs according to the fusion representation vectors; obtain the diversity information according to the average cosine distances.

[0170] Optionally, the diversity information includes a diversity index, and the first determination module 510 is configured to: obtain auxiliary features of the target population; wherein the auxiliary features include one or more of the following: code length of the first candidate programs, fitness of the first candidate programs, average edit distance between the first candidate programs; fuse the average cosine distances and the auxiliary features to obtain the diversity index.

[0171] Optionally, the first determination module 510 is configured to: parse the first candidate programs to obtain code feature information of the first candidate programs; obtain pseudo codes of the first candidate programs according to the code feature information; obtain the conversion results according to the pseudo codes.

[0172] Optionally, the first determination module 510 is configured to: parse the first candidate programs to obtain structured representations of the first candidate programs; obtain the conversion results according to the structured representations.

[0173] Optionally, the diversity information comprises a diversity index, and the second determining module 520 is configured to: performing modulo operation on the first value according to a current evolution iteration number to obtain a second value, wherein a difference between the first value and a total evolution iteration number is greater than a preset threshold; determining the temperature parameter according to a ratio between the second value and the first value and the diversity index.

[0174] Optionally, the second determining module 520 is configured to: determine a first difference between a target value and the diversity index; determine a third value as a base and a fourth value as an exponent of the first difference; determine a second difference between the target value and the ratio; determine the temperature parameter according to a product of the second difference and the fourth value.

[0175] Optionally, the selection module 530 is configured to: determine a target cluster from at least one cluster of the target population according to the temperature parameter; select the first parent program from the target cluster; select the second parent program from the target population according to the first parent program.

[0176] Optionally, the selection module 530 is configured to: for any cluster of the at least one cluster, determine a performance score of the any cluster according to fitness of a second candidate program in the any cluster and a number of the second candidate programs in the any cluster, wherein the performance score is used to measure a relationship between program quality and cluster size of the any cluster; determine a selection probability of the any cluster according to the temperature parameter and the performance score; select the target cluster from the at least one cluster according to the selection probability.

[0177] Optionally, the selection module 530 is configured to: determine a maximum fitness from the fitness of the second candidate programs; determine the performance score according to a ratio between the maximum fitness and the number of the second candidate programs.

[0178] Optionally, the diversity information comprises a diversity index, and the selection module 530 is configured to: determine a difference degree between the first parent program and the first candidate program according to the fusion feature vector of the first parent program and a fusion feature vector of the first candidate program in the target population; determine a first weight of the fitness of the first candidate program and a second weight of the difference degree according to the diversity index; weight the fitness of the first candidate program and the difference degree according to the first weight and the second weight to obtain a comprehensive score of the first candidate program; select the second parent program from the target population according to the comprehensive score.

[0179] Optionally, the selection module 530 is configured to normalize the diversity index to obtain a normalized index; determine the normalized index as the first weight; determine a difference value between a target value and the normalized index as the second weight.

[0180] Optionally, the generation module 540 is configured to: perform cross-over and mutation operations on the first parent program and the second parent program by using a large model to generate offspring programs; perform evolution iteration according to the offspring programs to obtain the target program.

[0181] It should be noted that the foregoing explanation and description of the program generation method embodiment also applies to the agent of the embodiment, and thus will not be described here.

[0182] In the embodiment of the application, the diversity information of the target population is determined, the temperature parameter is determined according to the diversity information, the first parent program and the corresponding second parent program are selected from the target population according to the temperature parameter, and the target program is obtained by performing evolution iteration on the target population according to the first parent program and the second parent program. Therefore, in the process of evolution iteration, the temperature parameter can be dynamically adjusted according to the diversity information of the population, the matching degree of the temperature parameter and the program diversity of the population can be improved, the parent program can be adaptively selected based on the temperature parameter, the balance ability of exploration and utilization in the evolution process can be improved, and thus the diversified and high-performance program can be efficiently generated.

[0183] According to the embodiments of the application, the application further provides an electronic device, a readable storage medium and a computer program product.

[0184] Figure 6A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the present application described and / or claimed in this document to the embodiments presented herein.

[0185] As shown in Figure 6 The device 600 includes a computing unit 601 that can perform various appropriate actions and processes in accordance with a computer program stored in a ROM (Read-Only Memory) 602 or a computer program loaded into a RAM (Random Access Memory) 603 from the storage unit 608. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An I / O (Input / Output) interface 605 is also connected to the bus 604.

[0186] A plurality of components in the device 600 are connected to the I / O interface 605, including an input unit 606, such as a keyboard, a mouse, and the like; an output unit 607, such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, an optical disk, and the like; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, and the like. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0187] The computing unit 601 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 performs various methods and processes described above, such as the AI-based adaptive program generation method. For example, in some embodiments, the AI-based adaptive program generation method can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded onto the RAM 603 and executed by the computing unit 601, one or more steps of the AI-based adaptive program generation method described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the AI-based adaptive program generation method by other any appropriate means, such as by means of firmware.

[0188] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a Field Programmable Gate Array (FPGA), an Application-Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a System on a Chip (SOC), a Complex Programmable Logic Device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0189] Program code for carrying out methods of the present application can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / acts specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine and partially on a remote machine or entirely on a remote machine or server.

[0190] In the context of this application, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include a linearly-programmed electrical connection, a portable computer diskette, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM) or flash memory, an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0191] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0192] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a LAN (local area network), a WAN (wide area network), the Internet, and a blockchain network.

[0193] The computer system can include clients and servers. This relationship can be remote or on-site. The servers can be cloud servers, also known as cloud computing servers or cloud hosts, which are mainframe products in the cloud computing service system to solve the defects of large management difficulty and weak business scalability in traditional physical hosts and VPS services (Virtual Private Server, Virtual Private Server). The server can also be a server of a distributed system or a server combined with a blockchain.

[0194] According to the embodiments of the present application, the present application also provides a computer program product, when the instruction processor in the computer program product executes, executes the artificial intelligence based adaptive program generation method provided by the above embodiments of the present application.

[0195] It should be understood that the steps shown above can be reordered, added or deleted. For example, the steps described in the present application can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, which is not limited herein.

[0196] The above specific embodiments do not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. An artificial intelligence based adaptive program generation method, comprising: determining diversity information of a target population; wherein the diversity information is used to indicate program diversity of the target population; determining a temperature parameter according to the diversity information; wherein the temperature parameter is used to adjust selection pressure; selecting a first parent program and a second parent program corresponding to the first parent program from the target population according to the temperature parameter; performing evolutionary iteration according to the first parent program and the second parent program to obtain a target program.

2. The method of claim 1, wherein, The determining of the diversity information of the target population comprises: performing feature extraction on a first candidate program in the target population to obtain a first embedding vector; wherein the first embedding vector is used to represent syntax and semantic structure of the first candidate program; performing formal conversion processing on the first candidate program to obtain a conversion result; performing feature extraction on the conversion result to obtain a second embedding vector; fusing the first embedding vector and the second embedding vector to obtain a fused representation vector; obtaining the diversity information according to the fused representation vector.

3. The method of claim 2, wherein, The obtaining of the diversity information according to the fused representation vector comprises: determining an average cosine distance between the first candidate programs according to the fused representation vector; obtaining the diversity information according to the average cosine distance.

4. The method of claim 3, wherein, The diversity information comprises a diversity index, and the obtaining of the diversity information according to the average cosine distance comprises: obtaining auxiliary features of the target population; wherein the auxiliary features comprise one or more of the following: code length of the first candidate program, fitness of the first candidate program, and average edit distance between the first candidate programs; fusing the average cosine distance and the auxiliary features to obtain the diversity index.

5. The method of claim 2, wherein, The formal conversion processing on the first candidate program to obtain a conversion result comprises: parsing the first candidate program to obtain code feature information of the first candidate program; obtaining pseudo code of the first candidate program according to the code feature information; obtaining the conversion result according to the pseudo code.

6. The method of claim 2, wherein, The formal conversion processing on the first candidate program to obtain a conversion result comprises: parsing the first candidate program to obtain a structured representation of the first candidate program; obtaining the conversion result according to the structured representation.

7. The method of claim 1, wherein, The diversity information comprises a diversity index, and the determining of the temperature parameter according to the diversity information comprises: performing modulo operation on a first value according to a current number of evolutionary iterations to obtain a second value; wherein a difference between the first value and a total number of evolutionary iterations is greater than a preset threshold; determining the temperature parameter according to a ratio between the second value and the first value and the diversity index.

8. The method of claim 7, wherein, The determining of the temperature parameter according to the ratio between the second value and the first value and the diversity index comprises: determining a first difference between a target value and the diversity index; determining a fourth value with a third value as a base and the first difference as an exponent; determining a second difference value between the target value and the ratio value; determining the temperature parameter according to a product of the second difference value and the fourth value.

9. The method of claim 1, wherein, The selecting, according to the temperature parameter, the first parent program and the second parent program corresponding to the first parent program from the target population, comprises: determining a target cluster from at least one cluster of the target population according to the temperature parameter; selecting the first parent program from the target cluster; selecting the second parent program from the target population according to the first parent program.

10. The method of claim 9, wherein, The determining, according to the temperature parameter, the target cluster from the at least one cluster of the target population, comprises: determining a performance score of any cluster of the at least one cluster according to fitness of a second candidate program in the any cluster and quantity of the second candidate program in the any cluster, wherein the performance score is used to measure a relationship between program quality and cluster size of the any cluster; determining a selection probability of the any cluster according to the temperature parameter and the performance score; selecting the target cluster from the at least one cluster according to the selection probability.

11. The method of claim 10, wherein, The determining, according to the fitness of the second candidate program and the quantity of the second candidate program, the performance score of the any cluster, comprises: determining a maximum fitness from the fitness of the second candidate program; determining the performance score according to a ratio between the maximum fitness and the quantity of the second candidate program.

12. The method of claim 9, wherein, The diversity information comprises a diversity index, and the selecting, according to the first parent program, the second parent program from the target population, comprises: determining a difference degree between the first parent program and a first candidate program in the target population according to a fusion feature vector of the first parent program and a fusion feature vector of the first candidate program; determining a first weight of fitness of the first candidate program and a second weight of the difference degree according to the diversity index; weighting the fitness of the first candidate program and the difference degree according to the first weight and the second weight to obtain a comprehensive score of the first candidate program; selecting the second parent program from the target population according to the comprehensive score.

13. The method of claim 12, wherein, The determining, according to the diversity index, the first weight of fitness of the first candidate program and the second weight of the difference degree, comprises: normalizing the diversity index to obtain a normalized index; determining the normalized index as the first weight; determining a difference value between a target value and the normalized index as the second weight.

14. The method of any one of claims 1-13, wherein, The performing evolution iteration according to the first parent program and the second parent program to obtain a target program, comprises: generating a child program by performing cross variation operation on the first parent program and the second parent program by using a large model; performing evolution iteration according to the child program to obtain the target program.

15. An agent, comprising: A first determining module configured to determine diversity information of a target population, wherein the diversity information is used to indicate procedural diversity of the target population; A second determining module configured to determine a temperature parameter according to the diversity information, wherein the temperature parameter is used to adjust selection pressure; A selecting module configured to select a first parent procedure and a second parent procedure corresponding to the first parent procedure from the target population according to the temperature parameter; A generating module configured to perform evolutionary iteration according to the first parent procedure and the second parent procedure to obtain a target procedure. 16.An electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication;wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-14.

17. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to make the computer execute the method according to any one of claims 1-14. 18.A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any one of claims 1-14.

Citation Information

Patent Citations

  • Multi-target computing migration method and device for intelligent campus workflow application

    CN116881000A

  • Integrated circuit design method through population optimization algorithm

    CN117764025A

  • Unmanned aerial vehicle target allocation method, device and equipment based on diversity enhancement genetic algorithm

    CN118607836A

  • Program generation method and device combining evolution calculation and deep learning, equipment and storage medium

    CN119292581A

  • Chip production logistics optimization method and system based on multi-objective genetic algorithm

    CN119378960A

Cited By

  • Program code updating method and device, agent, equipment, medium and product

    CN122470215A