Relation between population size and function count for genetic algorithm

10 views (last 30 days)
Yohei
Yohei on 8 Oct 2021
Commented: Yohei on 12 Oct 2021
I am working on an integer parameter optimization with nonlinear constraints by genetic algorithm. I would like to know the relation between population size and function count.
Specifically, my problem has 36 variables and I set the population size 100. When I ran ga, the first generation has 200 func-count and it adds 95 after second generation.
I wonder why it does not increase by 100 in each generation.
Best Mean Stall
Generation Func-count Penalty Penalty Generations
1 200 -1.166e+06 -1.166e+06 0
2 295 -1.166e+06 -5.83e+04 1
3 390 -1.166e+06 -5.83e+04 2
4 485 -1.166e+06 -5.83e+04 3
5 580 -1.166e+06 -5.83e+04 4
6 675 -1.166e+06 -5.83e+04 5
7 770 -1.166e+06 -5.83e+04 6
8 865 -1.166e+06 -5.83e+04 7
9 960 -1.166e+06 -5.83e+04 8
10 1055 -1.166e+06 -5.83e+04 9
11 1150 -1.166e+06 -5.83e+04 10
Optimization terminated: average change in the penalty fitness value less than options.FunctionTolerance
and constraint violation is less than options.ConstraintTolerance.
I tired to set population size to 200 and the result was as follows. The first generation has 400 and it adds up 195 by generations.
Best Mean Stall
Generation Func-count Penalty Penalty Generations
1 400 -1.166e+06 -1.166e+06 0
2 595 -1.166e+06 -2.915e+04 1
3 790 -1.166e+06 -2.915e+04 2
4 985 -1.166e+06 -2.915e+04 3
5 1180 -1.166e+06 -2.915e+04 4
6 1375 -1.166e+06 -1.166e+06 5
7 1570 -1.166e+06 -2.915e+04 6
8 1765 -1.166e+06 -1.166e+06 7
9 1960 -1.166e+06 -2.915e+04 8
10 2155 -1.166e+06 -2.915e+04 9
11 2350 -1.166e+06 -2.915e+04 10
Here is the options for my problem.
options =
ga オプション:
設定されているプロパティ:
ConstraintTolerance: 0.5000
CreationFcn: []
Display: 'iter'
InitialPopulationMatrix: [1×36 double]
MaxGenerations: 10000
MaxStallGenerations: 10
PlotFcn: {@gaplotbestf}
UseParallel: 1
既定のプロパティ:
CrossoverFcn: @crossoverscattered
CrossoverFraction: 0.8000
EliteCount: '0.05*PopulationSize'
FitnessLimit: -Inf
FitnessScalingFcn: @fitscalingrank
FunctionTolerance: 1.0000e-06
HybridFcn: []
InitialPopulationRange: []
InitialScoresMatrix: []
MaxStallTime: Inf
MaxTime: Inf
MutationFcn: {@mutationgaussian [1] [1]}
NonlinearConstraintAlgorithm: 'auglag'
OutputFcn: []
PopulationSize: '50 when numberOfVariables <= 5, else 200'
PopulationType: 'doubleVector'
SelectionFcn: @selectionstochunif
UseVectorized: 0
Could you tell me why func-count does not add up the size of population size by generation?
And why is the first generation has twice size of the population size?
It would be very helpful for me if you could give me some advice.
Thank you.

Accepted Answer

Alan Weiss
Alan Weiss on 8 Oct 2021
The answer is that some population members are "elite," and they do not have to be evaluated again. See How the Genetic Algorithm Works.
Alan Weiss
MATLAB mathematical toolbox documentation
  3 Comments
Yohei
Yohei on 12 Oct 2021
Thank you for the explanation. It is conducive to my understanding.
I will also try some trials with different number of population size.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!