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 次查看(过去 30 天)
显示 更早的评论
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
回答(2 个)
Geert
2013-8-22
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
2013-8-22
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Genetic Algorithm 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!