1. Basic concepts of Genetic Algorithm (GA) and Evolutionary Algorithm EA

Evolutionary algorithm, also known as evolutionary algorithm (evolutionary algorithms, referred to as EAs), it is not a specific algorithm, but an "algorithm cluster", genetic algorithm (GA) is a class of evolutionary algorithms

Detailed explanation of four types of evolutionary algorithms in machine learning: genetic algorithm, differential evolutionary algorithm, coevolutionary algorithm, distribution estimation algorithm

Basic concept:

fitness

The so-called fitness can be understood as a cost function or a rule in essence. By calculating the fitness of the individuals in the initial population, a measure of whether the individuals in the initial population are good or bad can be obtained.

External fitness, internal fitness

Extrinsic fitness and intrinsic fitness are two concepts in the field of evolutionary biology.

Exogenous fitness (exogenous fitness) refers to the selective pressure on individuals or groups due to adaptation to the environment (all abiotic factors, such as climate, temperature, food, etc.). In other words, it refers to survival, reproductive or other success due to the fitness of individuals or groups.

Intrinsic fitness (endogenous fitness) refers to the pros and cons of genetic information , that is, the contribution of an individual or group genome. Intrinsic fitness depends on various genes and genotypes in the individual or population genome, including their expression, function and interaction.

High external fitness, high internal fitness

High extrinsic fitness and high intrinsic fitness refer to the higher fitness of individuals or groups in adapting to the environment and genetic information, respectively, so that they have higher survival and reproductive success rates.

High external fitness means that individuals or groups can better adapt to the current environmental conditions according to their morphology, behavior and other characteristics, and obtain higher chances of survival and reproductive success. This means they adapt more effectively and are better able to respond to environmental changes and risk factors.

High intrinsic fitness refers to the excellent genes and genotypes contained in the individual or population genome, which may make them have better survival and reproductive ability. For example, under certain environmental conditions, it shows a stronger immune system, faster growth rate, higher intelligence and so on.

choose

The selection operation is to determine whether it will be eliminated or inherited in the next generation according to the degree of superiority or inferiority measured by the fitness function value of the individual in the population.

cross

The crossover operation is to use the selected two individuals p1 and p2 as parent nodes, and exchange part of the code values ​​of the two. Assume the following binary coded representations of the two nodes:

Write picture description here

 Randomly generate a random number between 1 and 7, assuming it is 3, then swap the last three bits of p1 and p2, as shown in the figure below, and the crossover operation is completed:

Write picture description here

Of course, this is just a very simple crossover method, and the commonly used crossover method in the industry is analog binary crossover.

Mutations

The mutation operation is to change the value of some unknown upper positions of the binary code of node p2, as follows:

1    1    0    1    1    1    1

Randomly generate a random number between 1 and 8, assuming it is 6, then mutate the 6th bit of the code to change 1 to 0, as shown in the figure below, the crossover operation is completed:

1    1    0    1    1    0    1

This is still a simple mutation operation. Commonly used mutation operations in the industry include Gaussian mutation and Cauchy mutation.

Algorithm Convergence

Through the above operations, we have introduced the general flow of the genetic algorithm, so now there is still a question, whether the algorithm converges, this is the most critical of the algorithm.

Radolph proved in the literature [Radolph G. Convergence Analysis of Canonical Genetic Algorithms. IEEE Transactions on Neural Network, 1994,5(1): 96-101.] that the general genetic algorithm does not necessarily converge, only the optimal Converge only when individual .

Write picture description here
Genetic Algorithm Framework

evolutionary algorithm

Evolutionary algorithms include genetic algorithms, evolutionary programming, evolutionary programming, and evolutionary strategies, etc. The basic framework of evolutionary algorithms is still the framework described by simple genetic algorithms, but there are large differences in evolutionary methods (selection, crossover, mutation, Population control, etc.) There are many changes, and the general block diagram of the evolutionary algorithm can be described as shown in the figure below:

Write picture description here

Like the genetic algorithm, the convergence of the evolutionary algorithm is also that the general evolutionary calculation is convergent when the optimal individual is preserved. However, many results of evolutionary algorithms are derived from genetic algorithms.

The genetic algorithm pays more attention to the crossover operation, and believes that the mutation operation is an auxiliary operation of the algorithm; while the evolutionary programming and evolutionary strategy believe that in a general sense, the crossover is not better than the mutation, and even the crossover operation may not be required.

Code: https://github.com/MorvanZhou/Evolutionary-Algorithm

Introduction: Evolutionary-Algorithm | Don't bother with Python

Guess you like

Origin blog.csdn.net/weixin_43135178/article/details/130724856