how can i work with two variables with genetic algorithm
2 views (last 30 days)
Show older comments
anacarol9918
on 24 Jan 2020
Answered: Star Strider
on 24 Jan 2020
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.
0 Comments
Accepted Answer
Star Strider
on 24 Jan 2020
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.
For an example of that, see: Is it possible to use Simulated Annealing or Genetic Algorithm for parameter estimation of a parametric System of ODEs?
0 Comments
More Answers (0)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!