📄 example5_17.m
字号:
%维数n=3
%设置参数边界
bounds =[1 4;1 7;1 7];
%遗传算法优化
%二进制编码
options=[1e-6 2];
%initPop=initializega(10,bounds,'f553',[],options);
%[m endPop] = ga(bounds,'f553',[],initPop,[1e-6 1 1],'maxGenTerm',100,'normGeomSelect',…
[0.08],['arithXover'],[2], 'nonUnifMutation',[2 5 3]);
[p,endPop,bestSols,trace]=ga(bounds,'f553');
%性能跟踪
plot(trace(:,1),trace(:,3),'b-');
hold on
plot(trace(:,1),trace(:,2),'r-');
xlabel('Generation');
ylabel('Fittness');
legend('解的变化','种群平均值的变化');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -