请问怎么把其余的pareto front 图画出来?
我在做多目标优化(目标函数6个),用的遗传算法在运行的时候好像只是显示目标函数1和目标函数2的pareto front图(如下图所示),其余的显示不出来、请问有什么办法把其余的图画出来? 当你求出一组pareto解f时
默认是画出f1和f2的pareto解
需要画出其它的解,可以用
figure ()
scatter(f(:,fa)',f(:,fb)')
grid on
其中fa、fb分别为你需要的objective 下面是3个目标优化的例子
%首先将下面存为一个m文件
function y = schaffer2(x) % y has two columns
% Initialize y for two objectives and for all x
y = zeros(length(x),3);
% Evaluate first objective.
% This objective is piecewise continuous.
for i = 1:length(x)
if x(i) <= 1
y(i,1) = -x(i);
elseif x(i) <=3
y(i,1) = x(i) -2;
elseif x(i) <=4
y(i,1) = 4 - x(i);
else
y(i,1) = x(i) - 4;
end
end
% Evaluate second objective
y(:,2) = (x -5).^2;
y(:,3)=x+3;
%下面存为一个m文件和上面的同一个文件夹下,或者将下面直接命令窗口运行
x = -1:0.1:8;
y = schaffer2(x);
plot(x,y(:,1),'.r'); hold on
plot(x,y(:,2),'.b');
lb = -5;
ub = 10;
options = gaoptimset('PopulationSize',60,'PlotFcns',@gaplotpareto);
= gamultiobj(@schaffer2,1,[],[],[],[],lb,ub,options);
%第一个目标和第二个目标的pareto曲线
figure (1)
scatter(f(:,1)',f(:,2)')
grid on
%第二个目标和第三个目标的pareto曲线
figure (2)
scatter(f(:,2)',f(:,3)')
grid on
%第一个目标和第三个目标的pareto曲线
figure (3)
scatter(f(:,1)',f(:,3)')
grid on 谢谢akjuan的解答,受益匪浅 3xs, l learn a lot
页:
[1]