asga.m
来自「自适应变步长定向变异遗传算法解函数优化问题 需要调用GAOT5.」· M 代码 · 共 20 行
M
20 行
%自适应变步长定向变异遗传算法 软件工程国家重点实验室 林志毅 2006.10.18
%The main program for adaptive step-changing directional mutation genetic
%algorithm
clf;
figure(gcf);
echo on
clc
initPop=initializega(30,[-3.0 12.1;4.1 5.8],'function1');
[x endPop bpop trace]=ga([-3.0 12.1;4.1 5.8],'function1',[],initPop,[1e-6 1 1],'maxGenTerm',300,'roulette',[0.08],'arithXover',[0.8 0],'GradMutation1',[0.7 100 2]);
x%the best found
%Let's take a look at the performance of the ga during the run
plot(trace(:,1),trace(:,3),'y-')
hold on
plot(trace(:,1),trace(:,2),'r-')
xlabel('t');
ylabel('f1 mean/f1m max');
%End of program
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?