Current location - Education and Training Encyclopedia - Graduation thesis - What is genetic algorithm? Give two examples.
What is genetic algorithm? Give two examples.
Classification: Education/Science >> Science and Technology

Problem description:

It is better to introduce immune algorithm.

Analysis:

Geic algorithm (GA) is a new global optimization algorithm developed in recent years.

From the point of view of biogenetics, the adaptability of each individual is realized through the mechanism of natural selection, inheritance and variation.

Improvement of. This reflects the evolution process of "natural selection, survival of the fittest" in nature. 1962 Dutch professor for the first time

After the idea of genetic algorithm was put forward, it attracted a large number of researchers and quickly extended to optimization, search, machine learning and other fields.

Surface, laid a solid theoretical foundation. When using genetic algorithm to solve problems, we must first treat the model structure of the problem.

And the problem is symbolized and discretized in this process. There are also continuous

Ga (Geic algorithm in continuous space, GACs) of space definition will not be discussed for the time being.

Genetic algorithm (SGA) for serial operation is executed as follows:

(1) coding to solve the problem;

(2) Randomly initialize population x (0): = (x 1, x2, … xn);

(3) Calculate the fitness F(xi) of each individual Xi in the current population X(t), and the fitness indicates that the individual has a good performance.

Not good;

(4) applying a selection operator to generate an intermediate generation xr (t);

(5) Apply other operators to Xr(t) to generate a new generation of population X(t+ 1). The purpose of these operators is finite expansion.

Covering individuals embodies the idea of global search;

(6)t:= t+ 1; If the termination condition is not met, continue to (3).

The most commonly used operators in GA are as follows:

(1) Selection/Breeding: The selection operator selects one from the population in pairs according to a certain probability.

The probability Pi of individual xi being selected is directly proportional to its fitness value. The most common implementation method is roulett.

E-wheel) model.

(2) crossover operator: crossover operator will cross the gene chains of two selected individuals according to the probability pc.

, two new individuals are generated, and the crossing positions are random. Where Pc is the system parameter.

(3) Mutation: The mutation operator mutates every bit of the new individual gene chain according to the probability pm, which is correct.

Binary gene chain (0, 1 code) is the opposite.

The implementation of the above operators is various, and many new operators are proposed to improve GA.

Certain attributes. Convergence rate of system parameters (number of individuals n, length of gene chain l, crossover probability Pc, mutation probability Pm, etc.). ) to the algorithm.

And choose different values according to specific problems.

The programming of genetic algorithm should consider universality and have strong ability to adapt to new operators. Class inheritance in object-oriented programming

Commitment provides us with this possibility.

Two basic structures are defined: allele and individual, and the individual's * * * is the population class TP.

Population data members, and TSGA class is derived from population, and defines the basic operation of genetic algorithm. For any real application

For example, you can derive from TSGA class and define new operations.

The TPopulation class contains two important processes:

FillFitness: Evaluate the function, decode each individual and calculate its fitness value. The specific operation is as follows

Implemented in the user class.

Statistics: Statistics of current population, such as sumfitness, average fitness and best fitness.

Individual fmax, worst individual fmin, etc.

The TSGA class is derived from the TPopulation class, which takes the system parameters of GA as the parameters of the constructor. There are four TSGA classes.

Important member functions:

Select: Select the operator. The basic selection strategy is roulette model (as shown in Figure 2). Roulette The roulette wheel stops by rotating at will.

The area pointed by the reverse pointer is selected, so the probability of being selected with a large fi value is high.

Crossover: crossover operator, which exchanges substrings at random positions of probability Pc on two gene chains.

Mutation: mutation operator, which randomly interferes (negates) each gene in the gene chain with probability Pm.

Generation: Generation of the next generation, including the whole process of evaluation, statistics, selection, crossover and variation. , every time it runs.

Second, produce a new generation.

The structure and class definition of SGA are as follows (written in C++):

Typedef char allele;

Gene type

Typedef structure

{ ...

Allele chrom

Floating fitness;

Chromosome fitness

} individuals;

Personal definition

Category filling

{ ...

Group class definition

public:int size;

Population size: n

int lchrom

Chromosome length: l

Floating-point sumfitness, average;

Personal *fmin, * fmax

Personal * pop

TPopulation (int popsize,int strlength);

~ t population();

Online personal &. Individual (int i)

{ ...

return pop[I];

}

;

void fill fitness();

evaluation function

Virtual void statistics ();

Statistical function

};

TSGA level: public population

{ ...

The TSGA class is derived from the population class.

public:float pcross;

Cross probability

Floating-point operation;

Catastrophe probability

int gen

Generation counter

TSGA (int size,int strlength,float pm =0.03,float pc =0.6 ): TPopulation (size,strlength)

{ ...

gen = 0;

pcross = pc

pmutation = pm

} ;

Virtual individual & ampselect ();

Virtual null intersection (individual & parent1,individual & parent 2, individual and. Children 1, individuals & child2);

& children 1, individual & child2);

Virtual allelic mutation (allelic variation);

Virtual void generate ();

Produce a new generation

};

User GA class is defined as follows: class TSGAfit: public TSGA.

{ ...

public : TSGAfit (int size,float pm =0.0333,float pc =0.6 ) :TSGA (size,24,pm,pc)

{ ...

}

;

Void print ();

};

Because GA is a probabilistic process, the situation of each iteration is different. Different system parameters, iterative situation

It's also different. In the experiment, the parameters are generally selected as follows: the number of individuals n=50-200, the mutation probability Pm=0.03, and the crossover probability Pc=

0.6。 The probability of mutation is too high, which will lead to instability.

refer to

● Goldberg D E. Geic algorithm in search, optimization and machine.

study Eddison Wesley Company, Reading, MA 1989.

Chen Genshe, Chen Xinhai, "Research and progress of genetic algorithm", information and control, vol. 23,

No.4, 1994, PP2 15-222

Vittorio Maniezzo, "Geic Evolution of Topology and Weight Distribution"

The distribution of neural networks. Neurology, Vol.5, No.1

. 1, 1994,PP39-53

● Qi Xiaofeng and Francisco Palmiri, "Theoretical analysis of evolution.

An algorithm for infinite population size in continuous space. first part

L Neorks, Volume 5,No. 1, 1994, PP102-19.

● Qi Xiaofeng and Francisco Palmiri, "Theoretical analysis of evolution.

An algorithm for infinite population size in continuous space. the second part

Al Neorks, Volume 5,No. 1, 1994, PP102-19.

Gunter Rudolph, convergence analysis of canonical Geic algorithm, I.

EEE,Trans。 Neurological Research, Vol.5,No. 1, pp. 1994, pp. 96-10/.

● Ben, Art, Fanxi. Global convergence of geic algorithm

Algorithm: Markov chain analysis. Solving parallel problems from Nat

Yes H.-P.Schwefel, R.Manner, edited by Berlin and Heidelberg: springer, 199 1

,PP4- 12

Wirtammar, "Notes on Evolutionary Simulation", IEEE, Trans. At northeastern university

Ral Neorks, Volume 5,No. 1, 1994, PP 130- 147.

● Anthony V. Sebald, Jennifer Schlenzig, "Minimax Design of Neural Network Company"

Controller for highly uncertain equipment. On neural networks, v.

Ol.5,No. 1, 1994, PP73-8 1

Fang Jianan and Shao Shihuang, "Self-learning model control rules with genetic algorithm", automation theory, technology and application.

Use, Proceedings of the 9th Annual Youth Academic Conference of China Automation Society, 1993, PP233-238.

Fang Jianan, Shao Shihuang, "Neural Network Controller for Genetic Algorithm Learning", Control and Decision-making, 199.

3,8(3),PP208-2 12

Su He and Zhu Gu, "Maze Learning with Genetic Algorithm", Robot, Vol. 16, No.5, 199.

4. Pages 286-289

M. srinivas, L.M.Patnaik, "Adaptive probability of crossover and mutation.

Ions ",IEEE Trans. On the intersection and mutation of S.M.C, Volume 24, No.4, 1994 ",

IEEE Trans。 Stockholm Convention, vol. 24, No.4, 1994

● Daixi Park, Abraham kandel, Gideon Langholtz, "The new ambiguity based on Geic.

Reasoning model and its application in fuzzy control. sm C,

Vol. 24,No. 1, pp. 39-47, 1994

● Alen Wasek, Tania urban, Bodgen Filipic, "Geic algorithm in the conference"

Controller design and tuning ",IEEE Trans. Stockholm Convention, vol. 23, No.5, p. 1330- 13.

39, 1993