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
  1 个评论
vinay
vinay 2013-8-22
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.

请先登录,再进行评论。

回答(2 个)

Geert
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...
  1 个评论
vinay
vinay 2013-8-23
编辑:vinay 2013-8-23
No of Variables : 3
Pop Size: 8
Crossover: CrossoverIntermediate
Mutation: MutationUniform
Fitness Function: I calculate the Peak Gain of Antenna Array Distribution.
No Linear constraints.
The solver works well when I do not include the nonlinear constraint.

请先登录,再进行评论。


Alan Weiss
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
  1 个评论
vinay
vinay 2013-8-23
Dear Alan,
I also tried Pattern Search. I face the same problem. Without including the non linear constraints solver I get expected answer. However on including the constraints the PS solver doesnt proceed over 1 poll. I does 2-3 Iterations. (Number of Variables in Problem is N = 3, and I use GPS2N solver)
I read that both GA and Pattern Search use the same Nonlinear Constraints Solver Algorithm.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Genetic Algorithm 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by