MATLAB 怎么在优化中得到PARETO 解?
如果使用的是遗传算法,怎么才能得到问题的PARETO 解?
好像遗传算法出来的都是收敛到一个单一的点 无论遗传算法,还是一般的优化解法,都是单个解。
多目标的时候,需要一组非劣解,需要进行相应的程序来求解
下面是matlab的一个简单的遗传算法对两个目标优化求解过程,
怎么得到pareto解应该很清楚
GA Multiobjective
This example optimizes two objectives defined by Schaffer'ssecond function: a vector-valued function of two components and oneinput argument. The Pareto front is disconnected. Define this functionin an M-file:
function y = schaffer2(x) % y has two columns
% Initialize y for two objectives and for all x
y = zeros(length(x),2);
% 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;First, plot the two objectives:
x = -1:0.1:8;
y = schaffer2(x);
plot(x,y(:,1),'.r'); hold on
plot(x,y(:,2),'.b');The two component functions compete in the range and. But the Pareto-optimal front consists of only two disconnectedregions: and . This is because the region is inferiorto .
Next, impose a bound constraint on x,
-5<x<10,setting
lb = -5;
ub = 10;The best way to view the results of the genetic algorithm isto visualize the Pareto front directly using the @gaplotpareto option. To optimize Schaffer's function, a larger population sizethan the default (15) is needed, because of the disconnected front.This example uses 60. Set the optimization options as:
options = gaoptimset('PopulationSize',60,'PlotFcns',...
@gaplotpareto);
Now call gamultiobj, specifying one independentvariable and only the bound constraints:
= gamultiobj(@schaffer2,1,[],[],[],[],...
lb,ub,options);
Optimization terminated: average change in the spread of
Pareto solutions less than options.TolFun.
exitflag
exitflag = 1The vectors x, f(:,1),and f(:,2) respectively contain the Pareto setand both objectives evaluated on the Pareto set. 上面程序加了说明,有点乱,为了方便,可以下载附件,里面有这两个m文件直接运行
多谢 akjuan ! 多谢指点,受益匪浅 谢谢,学到不少东西~ 多谢多谢,学习一下 正用到,感谢啊,论坛就是学习的地方 可以到MATLAB官网去下载 正在学习,好东西
页:
[1]