Genetic Algorithm - Your fitness function must return a scalar value solution?
Ältere Kommentare anzeigen
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 Kommentar
Ste_M
am 12 Jun. 2022
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!