MATLAB: The 20 variables nonlinear constraint Genetic Algorithm runs for only 5~6 generations

genetic algorithmnonlinear optimizationoptimization

I want to optimize the one siderostat array, according to the Cornwell's fitness function. This is the background of my program.
There are 20 variables in my GA, and nonlinear constraint. It is supposed that the algorithm may run for hundreds of generations. But it runs for only 5~6 generations.
Is there any wrong in my code?
clear
clc
global d_aperture; d_aperture = 0.1;
global d_max; d_max = 10;
global N; N = 10;
object_function = @cornwell;
nvars = 2 * N;
LB = ones(1, nvars).* d_max / 2 * -1;
UB = ones(1, nvars).* d_max / 2;
constraint_function = @d_constraint;
options = gaoptimset(@ga);
options = gaoptimset(options, ...
'PlotFcn', {@gaplotbestf, @gaplotstopping}, ...
'Display', 'iter', ...
'MutationFcn', @mutationadaptfeasible, ...
'Tolcon', 1e-8);
[x,val] = ga(object_function, nvars, [], [], [], [], ...
LB, UB, ...
constraint_function, ...
options);
here is what printed in the command line window:
Best max Stall
Generation f-count f(x) constraint Generations
1 10600 -17688.4 0 0
2 21000 -17722.4 0 0
3 31400 -17724.8 0 0
4 41800 -17725 0 0
5 52200 -17725 0 0
Optimization terminated: average change in the fitness value less than options.TolFun
and constraint violation is less than options.TolCon.
can anyone explain it?

Best Answer

The reason you get so few "iterations" and so many function evaluations is that you have nonlinear constraints. See the description of nonlinear constraint solver algorithms. For an example, see constrained minimization using ga.
Alan Weiss
MATLAB mathematical toolbox documentation