how can i work with two variables with genetic algorithm

I've created a file with a two variable function, but when i call it at my genetic algorithm script or at the optimization tool it didn't work.
The error menssage said i didn't have enough arguments, so I've tried to use the meshgrid to creat a matrix but it didn't work too.

 Respuesta aceptada

It would be helpful to know what your fitness function is doing.
If there are independent variables, you can combine them as:
x = [invar1(:) invar2(:)]
Then refer to them in your objective function as: ‘x(:,1)’ and ‘x(:,2)’.
To fit two (or more) dependent variables, the objective function must produce a matrix output so they are the same dimensions.

Más respuestas (0)

Preguntada:

el 24 de En. de 2020

Respondida:

el 24 de En. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by