Number of variables (nvars) is dependent on the value of one variable when using genetic algorithm (GA)

9 visualizaciones (últimos 30 días)
I have two kinds of variables: x and y, and y includes y1, y2, y3, y4, ...
The total number of y's is dependent on the value of x.
For example, if x = 4, then my variables are vars=[x, y1, y2, y3, y4];
if x = 6, then my variables are vars=[x, y1, y2, y3, y4, y5, y6];
In addition, both x and y's are discrete integers, and I have both upper and lower bounds for them.
For example, the options for x is [4, 6, 8, 10];
the options for all the y's (are the same) is [4, 5, 6, 7, 8];
Could GA deal with this problem?
I was thinking to make nvars the potential maximum value.
That is to say, based on the above example, I could make nvars = 1(this is x)+10 (these are 10 y's)=11.
However, I still have issues.
For example, during the optimization process, the value of x could be 6, then there will be only 6 y's, which means the last four variables will be useless (by "useless" I mean there is no need to optimize), then I think I need to set the upper bounds to be same as the lower bounds for these four variables.
But how? Actually, I don't know the value of x when I set the lower and upper bounds, yes?
Thanks in advance!

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de En. de 2019
Run the system multiple times, one for each of the discrete values of x. Take the best of the solutions.
  5 comentarios
Walter Roberson
Walter Roberson el 30 de En. de 2019
Yes and Yes.
ga() does not care how you compute the objective function. But it cannot detect that it is working on a case in which one of the variables is unused, and will waste time trying to find values of that variable that lead to a better result. This waste of time can easily lead to it not converging in the number of iterations you give it.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Genetic Algorithm en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by