Mathematical modeling genetic algorithm Matlab

overview

Insert image description here
These algorithms are all looking for a linear and nonlinear relationship between an input and an output.
The following optimization problem.
The three major non-classical algorithms of optimization theory :
simulated annealing, neural network, and genetic algorithm
(these are algorithms used to solve some more difficult optimization problems. They are very helpful for some problems, but the implementation of the algorithm is more difficult. Use with caution)

1. Overview of Genetic Algorithm

Genetic Algorithm (GA) is a part of evolutionary computing. It is a computational model that simulates the biological evolution process of Darwin's genetic selection and natural elimination. It is a method of searching for optimal solutions by simulating the natural evolution process. The algorithm is simple, versatile, robust and suitable for parallel processing.

The basic idea is to start from the set of possible potential solutions.
Insert image description here
●Basic steps of genetic algorithm:
1) Coding: GA first represents the solution data of the solution space into genotype string structure data of the genetic space before searching. Different combinations of these string structure data constitute different points.
2) Generation of initial group: N initial string structure data are randomly generated. Each string structure data is called an individual, and N individuals constitute a group. GA starts evolving with these N string structure data as the initial point.
3) Fitness evaluation: Fitness indicates the quality of an individual or solution. Different problems require different definitions of the fitness function.

If the number is too small, the calculation efficiency will decrease.
To determine this parameter N, to determine this parameter, this is originally a problem of finding the optimal, but in this model, there is a need to find the optimal parameters, so the coupling of the program The line is very high. So we will adjust and set based on our experience.

Genetic Algorithm Toolbox

The toolbox can only handle a single target, so multiple targets must be quantized into a single target for calculation.

The first step is to bring up the toolbox

Type: optimtool' on the command line
and this interface will appear:
Insert image description here
select the ga toolbox above

Then fill in these places:
funtnes function: @ga_demo3fit (Note: the fitness function must be in the current directory)
Number of variables: 2 (fitness function variable)
Population Size: 10 (population size)
Elite Count: 10 (number of elites)
CrossoverFraction: 0.75 (proportion of cross offspring)
Generations: 500 (number of evolutionary generations)
Stall generations: 500 (number of stopping generations)
Function tolerance: 1e-100 (deviation value of fitness function)
In plot functions, select the fitness function value of the optimal individual (Best fitness) and optimal individual (Best individual).
Select the default options for the rest.

Guess you like

Origin blog.csdn.net/qq_52626583/article/details/126435630