问题遇到的现象和发生背景
使用遗传算法ga报错
问题相关代码,请勿粘贴截图
% 编码和生成初始种群,个体数目取30
bounds=[17 35;2 10;0.25 0.30]; % 变量上下限
startPop=initializega(30,bounds,'GA_yzcl',[]);
% 遗传优化算法搜索
[xf,endP,beestS,trace]=ga(bounds,'GA_yzcl',[],[],[],'maxGenTerm',100);
运行结果及报错内容
GA_yzcl_2
错误使用 ga (line 310)
Fitness function must be a function handle.
出错 GA_yzcl_2 (line 7)
[xf,endP,beestS,trace]=ga(bounds,@GA_yzcl,[],[],[],'maxGenTerm',100);