2.1 Basic concept of genetic algorithm
In the process of social practice, people need to find the optimal solution in the complex system in order to solve the problem efficiently. However, because the solution space is relatively large, the correlation between the parameters and the target value is difficult to determine, and there are relatively many factors to be considered, so how to deal with the optimization problem must be highly valued. In many cases, people determine the approximate optimal solution by comparing and analyzing the random effective solution [8]. The essence of this method is to randomly extract the parameters of the domain of definition to obtain the optimal solution. This method is simple and easy, but it is only suitable for the field with small search space, but for the field with large search space, it can't solve the problem simply by exhaustive method More advanced optimization techniques are needed to solve the problem [9]. In contrast, the genetic algorithm with ‘survival of the fittest’ as the core has great advantages. By introducing competition mechanism into the algorithm, the search efficiency can be improved. The basic process of genetic algorithm is to determine a group of initial solutions in a random way, and then conduct individual search to obtain an independent solution, which is defined as a ‘chromosome’. Through the ‘fitness value’ index, the adaptability of chromosomes in the population can be effectively evaluated, and then whether to select them to enter the next stage can be judged [10]. According to the principle of survival of the fittest, on the basis of continuous crossing, selection and variation, the evolution selection of chromosomes forms a chromosome group with higher adaptability. After reaching a certain number of iterations, the chromosome convergence is completed and the optimal solution of genetic algorithm is obtained [11]. By analyzing the process, we can find that the whole process of genetic algorithm is essentially similar to the genetic principle in biological sense [12].
2.2 Running process of genetic algorithm
At the operational level, genetic algorithm is not complex. According to the above discussion, it is essentially an iterative process, that is, it starts from the initial group of individuals, and obtains the approximate optimal solution through continuous cross selection and mutation operation [13]. Overall, the basic elements of genetic algorithm are as follows:
(1) Chromosome coding. In the construction of genetic algorithm model, the first step is to determine the coding method, which is also the key and core problem of genetic algorithm. In the early stage of the development of genetic algorithm, binary coding is the most widely used coding method, which is the first choice of algorithm designers. Compared with other types of chromosome coding methods, binary long coding greatly reduces the difficulty of coding and decoding, and is conducive to the completion of cross selection, mutation genetic and other operations [14].
(2) Individual fitness evaluation. First of all, through comparative analysis, to understand the fitness of different individuals, so as to determine the individuals to be selected into the next generation, and gradually complete the construction of the next generation group; secondly, the algorithm designer needs to determine the fitness function of this paper according to the genetic selection needs, and use this as a tool to complete the local guidance search; finally, according to the fitness function determined previously Number, analyze the differences of different individuals, and evaluate their fitness [15]. Generally speaking, the nature of the problem to be solved is different, and the field is different. The criteria to be referred to in the selection of fitness function should also reflect differences.
(3) Select the operator. In the process of building genetic algorithm model, operator selection is the key link, which is closely related to the effectiveness of genetic algorithm [16]. The designers of genetic algorithm model need to select the operators that meet the requirements scientifically and reasonably, so as to improve the performance of genetic algorithm to the greatest extent. Fundamentally speaking, probability rule is the core attribute of operators, aiming to select individuals with strong adaptability, and it is an effective tool to determine the next generation of population.
(4) Crossover operator. In the construction of genetic algorithm model, we need to choose a reasonable cross algorithm in order to produce new individuals different from the existing ones [17]. In many kinds of crossover algorithms, the single point crossover operator has the highest application rate and is also one of the basic operators.
(5) Mutation operator. In the process of building genetic algorithm model, in order to reflect the complexity and uncertainty of the environment, the principle of gene mutation in biology is used for reference [18]. Therefore, mutation operators will appear, but the probability of occurrence is relatively low, it can greatly improve the comprehensiveness of the genetic algorithm model and avoid falling into the problem of local search. In conclusion, it is necessary to introduce mutation operator into genetic algorithm model.
(6) Select the control parameters. Because genetic algorithm is a new science, and it has probability attribute, it emphasizes the experience of designers in parameter selection, or through some experiments to determine the parameters [19]. Among them, whether the genetic algorithm can be implemented efficiently depends on the population size to a large extent. If the population size is insufficient, the genetic algorithm lacks regularity, and the problem of local solution is relatively prominent, which has a negative impact on the final performance; on the contrary, if the population size is large, it will reduce the convergence speed, and have a greater negative impact on the efficiency of the algorithm. In the initial stage of genetic algorithm, individuals have significant randomness, and the applicable mutation rate should be large, so as to improve the diversity of population and create conditions for global search [20]. In the process of evolution, in order to maintain the stability of some high-quality characteristics, it is necessary to reduce the variation rate appropriately, but in the final stage of evolution, in order to avoid individual convergence, it is necessary to improve the variation rate again to ensure that individual diversity meets the requirements. Generally speaking, the crossing rate is between 0.2–0.95.
The operation flow of the basic genetic algorithm is as follows:
(1) In initialization, the evolutionary algebra is set to the maximum, and the initial population is determined according to the acquired random individuals;
(2) Individual evaluation, on the basis of determining groups, calculates the fitness of different individuals;
(3) According to the group characteristics, the optimal operator is determined;
(4) Cross operation is introduced in the operation process;
(5) In the application process of genetic algorithm, mutation operator is introduced into population to select individuals with different attributes from existing individuals to enter the next generation of population;
By cycling the above steps, if the condition of t ≤ T is reached, then continue to the second step cycle, the optimal solution of genetic algorithm model selects the individual with the largest fitness in the population, so as to get the best solution to the problem and achieve the final calculation goal.