Azzera filtri
Azzera filtri

Problem with Genetic Algorithm using the global optimization toolbox

4 visualizzazioni (ultimi 30 giorni)
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 Commento
vinay
vinay il 22 Ago 2013
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.

Accedi per commentare.

Risposte (2)

Geert
Geert il 22 Ago 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...
  1 Commento
vinay
vinay il 23 Ago 2013
Modificato: vinay il 23 Ago 2013
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.

Accedi per commentare.


Alan Weiss
Alan Weiss il 22 Ago 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
  1 Commento
vinay
vinay il 23 Ago 2013
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.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by