Using genetic algorithms and setting initial conditions

3 views (last 30 days)
Hi,
I am trying to use genetic algorithms to optimize a given problem. Howeever in the constraints file , one of the constraints has a term like y(1)*y(2)^0.5. The genetic algorithms is setting the initial values of y to a negative value and this is returning a complex value and the program is not running. How do I set the initial values of the y since there does not seem to be an option for doing this when I call the ga function. There is nvars , but no initial condition.

Accepted Answer

Walter Roberson
Walter Roberson on 27 Jun 2015
It would seem appropriate to use a LB (lower bound) condition.
  3 Comments
Souad AKKADER
Souad AKKADER on 24 Jan 2022
Hi,
I wanna optimize 2 complex functions (that have an imaginary part and a real part) using multiobjective genetic algorithm (MOGA). However one of the constraints has a term like : (z+(x^2/3y))=5
How do I set the matrix Aeq knowing that there is only one equation?
NB: variables are all scalars
thanks in advance :)
Alan Weiss
Alan Weiss on 24 Jan 2022
If you are trying to use gamultiobj, then you must do two things:
  1. Convert your multiple scalar variables into indices of a single variable, usually called x. For example, you might have x = x(1), y = x(2), z = x(3). Then it is clear how to write your scalar equation in the form Aeq*x = beq.
  2. Separate your complex variables into real and imaginary parts. This means you will have more variables, twice as many if all variables can be complex. For example, you might have x(1) = real(x), x(2) = im(x), x(3) = real(y), x(4) = im(y), x(5) = reall(z), x(6) = im(z).
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!