MATLAB优化工具箱如何得到每次迭代的目标函数值
1、创建output function%%% 代码%state.Generation 当前代墙绅褡孛数%state.Score 种群的目标函数值function [state, options,optchanged] = outfun(options,state,flag)optchanged = false;switch flagcase 'init' disp('Starting the algorithm'); case {'iter','interrupt'} plot(state.Generation,min(state.Score(:,1)),'.'); hold on; disp('Iterating ...'); disp(state.Generation); case 'done' disp('Performing final task');end%%%
2、创建options在optimset中加入'OutputFcn', @outfun%%%options = optimset('OutputFcn', @outfun);%%%
3、运行程序[x,fval,flag,output,population] = gamultiobj(@objfun,nvars,... [],[]荑樊综鲶,[],[],lb,ub,options);
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:20
阅读量:44
阅读量:93
阅读量:86
阅读量:72