Update: The solver did proceed to the second generation, but after 40,000 calls to the fitness function! The constraint is very trivial. I do not understand why it evaluated the fitness so many times.
Problem with Genetic Algorithm using the global optimization toolbox
2 views (last 30 days)
Show older comments
Hi,
I am implementing an optimization problem using GA in Matlab. I use the Matlab Global optimization toolkit. It gives fine results when I use it without non linear constraints.
However when I add even a trivial nonlinear constraint (such as c = -1, in the i.e. in reality this constraint is always satisfied.), the GA does not proceed over 1 generation.
Below is an example of output from the Solver, which I manually terminated:
1 504 -64.5333 0 0
As you see, the solver has computed the fitness function 504 times and is still stuck in the 1 st generation.
My nonlinear function is as follows:
***************************************
function [c, ceq] = nonlcon(ae)
c = -1; ceq = [];
end
***************************************
As you can see, the nonlinear constraint is always satisfied. I must emphasis that the solver gives the expected result when I run without using the nonlinear constraint function option.
Vinay
Why is this so? I
Answers (2)
Geert
on 22 Aug 2013
Can you give some more details about your genetic algorithm? How many variables, crossover/mutation operator, ... Maybe a code snippet or something?
Since your nonlinear contraint is of the form
function [c, ceq] = nonlcon(ae)
c = -1; ceq = [];
end
I assume that you optimize over a singly variable (i.e. length(ae) = 1)?
Please provide us with more details, if you want us to solve your problem...
Alan Weiss
on 22 Aug 2013
The inclusion of a nonlinear constraint function causes ga to perform a very different algorithm. See Nonlinear Constraint Solver Algorithm.
Alan Weiss
MATLAB mathematical toolbox documentation
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!