Genetic Algorithm - Your fitness function must return a scalar value solution?
Mostrar comentarios más antiguos
Hello everyone,
I have been working on my GA code for some time. Have been getting some weird results with my code so I tried to implement it with example from documentation (https://www.mathworks.com/help/gads/constrained-minimization-using-ga.html). It seems that my fitness function is badly coded and is not returning scalar value. Therefore, the algorithm is unable to compare solutions and the code stops. I have pinpointed the problem - loading data inside function. Data are, among other, drive cycle (speed and acceleration - both 1x661 matrix). So my fitness function returns 1x661 matrix.
So my GA is not for optimizing a function of two variables, but optimizing a function of two variables at every instant of drive cycle (661 instances).
How can I load my drive cycle data (podaci_matlab.mat) in "one-by-one" manner so I can get a scalar value?
I have attached all necessary files.
Thanks in advance !
1 comentario
Ste_M
el 12 de Jun. de 2022
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Get Started with Optimization Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!