#### Genetic Algorithm Fitting

What is genetic algorithm fitting?

Genetic Algorithm (Genetic Algorithm, GA) is a global optimization algorithm, which is based on the evolutionary theory of natural selection and genetics to find the optimal solution to the function problem. It is not only suitable for general fitting problems, but also can solve the traditional fitting methods. Deal with non-linear and highly complex data fitting problems.

Therefore, this paper uses genetic algorithm to fit the test data obtained from the lithium-ion power battery cycle life test, and obtain the optimal coefficient and equation between the capacity retention rate and the number of cycles.

Genetic algorithm (GA) simulates the evolutionary process of gene recombination and mutation in the process of biological reproduction. When solving actual problems, the potential solution of the problem (randomly generated) is used as the initial population of the algorithm. The population is used as an individual after binary coding by a computer. These individuals perform operations similar to natural selection, crossover, and mutation in biological evolution, and reproduce according to the rule of survival of the fittest, and finally obtain the optimal individual that meets the convergence condition is the optimization result of the problem.

When the genetic algorithm is used for curve fitting, the algorithm uses group evolution to process multiple individuals at the same time. It does not need to know the derivative of the problem to be sought, does not depend on the complexity of the problem, and the initial population, recombination, mutation and other operations in the genetic algorithm It is performed randomly, which can avoid the local optimum in the optimization process and achieve the global optimum effect, and can effectively solve the optimal estimation problems such as polynomial coefficients.

The main calculation steps of genetic algorithm are:

① Randomly generate an initial population based on actual problems.

②Use the designed fitness function to calculate the fitness of the individual.

③ Perform operations such as selection, crossover, and mutation.

Selection refers to the use of certain methods to select individuals with high adaptability to inherit to the next generation according to the fitness of the individual.
Crossover refers to selecting two individuals with higher probability from the group, and exchanging part of the genes in each pair of individuals.
Commonly used methods such as single-point crossover and multi-point crossover. Variation refers to changing the value of part of the gene position of the individual in the population after crossover with a small probability.

④ Determine whether the convergence conditions are met.

When the set convergence conditions are met, the individual with the greatest fitness is the optimal solution to the problem, otherwise, proceed to steps ③ and ④.

The fitness function is used to measure the fitness of an individual, which is equivalent to the objective function in actual problems. It can only find the minimum value in the Matlab genetic algorithm toolbox. The genetic algorithm controls the operation of the algorithm through the fitness function, uses the size of the individual fitness to determine the probability of an individual being inherited to the next generation, and then changes the group structure. It is the basis for the algorithm’s natural selection and the driving force of evolution. When the genetic algorithm is used to fit the function, the fitness function f(x) that can be selected is as shown in the formula (formula diagram), where Cmax is a sufficiently large positive number, and ER is the objective function.