Error using makeState (line 56) Your fitness function must return a scalar value.
3 views (last 30 days)
Show older comments
Hello Matlab users I'm getting started with GA and trying to apply it to maximization problem I have. Running the Genetic Algorithm gives the following error:
Error using makeState (line 56) Your fitness function must return a scalar value. Error in galincon (line 17) state = makeState(GenomeLength,FitnessFcn,Iterate,output.problemtype,options);
Error in ga (line 359) [x,fval,exitFlag,output,population,scores] = galincon(FitnessFcn,nvars, ...
Error in GA (line 24) [x,fval,reason,output,population,scores]=ga(@MyCost,24,[],[],[],[],lb,up,[],option);
Error in galincon (line 17) state = makeState(GenomeLength,FitnessFcn,Iterate,output.problemtype,options);
Error in ga (line 359) [x,fval,exitFlag,output,population,scores] = galincon(FitnessFcn,nvars, ...
Error in GA (line 25) [x,fval,reason,output,population,scores]=ga(@MyCost,24,[],[],[],[],lb,up,[],option);
I attached my code,I would be grateful if you help me.
Thanks
0 Comments
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!