如何提取非支配解(帕累托前沿) [英] How to extract the non-dominated solutions (Pareto front)
问题描述
我曾多次尝试使用MATLAB为两个目标函数编写提取非主导(或主导)的
解的代码。
我有两个简单的目标函数:
J1 = x。^ 2
J2 =(x-2)。^ 2
我有一个x值的范围,比如-5到5,例如,100个解决方案是在指定范围内随机生成的
。
我想提取非支配来自这些解决方案的解决方案。
我没有任何上述操作的问题。我到目前为止所做的是:
%在-5和5之间随机生成100个解决方案:
X = -5 + 10 *兰特(100,1);
%计算两个目标函数,每个解决方案的J1和J2:
J1 = x。^ 2;
J2 =(x-2)。^ 2;
现在,我面临如何将概念转化为书面代码的问题。
我知道如何提取非支配解和Pareto前沿的概念。
我可以手动完成,但是这个需要很长时间。
我尝试使用if语句,但结果不准确。
我认为最好提取主导解的指数,然后将它们从主矢量x中移除以获得非主导解。$ b $
预先感谢
你介意来自FEX的文件吗? 这个作品完美无缺:由Yi Cao创作的Pareto Front p> 为您提供了主导解决方案的 然后你只需要像这样使用它: 导致: 这正是它应该看起来的样子。否则,您需要澄清您的问题。 I have tried so many times to write the code of extracting the non-dominated (or dominated) solutions for two objective functions using MATLAB. I have two simple objective functions: J1=x.^2 J2=(x-2).^2 and I have a range for x values, say from -5 to 5 and there are, for example, 100 solutions to be generated randomly within the range specified. I want to extract the non-dominated solutions from these solutions. I have no problem of all above operations. What I have done so far is: Now, I faced the problem of how to translate the concept to a written code. I know the concept of how to extract the non-dominated solutions and Pareto front. I can do it manually but this will take very long time. I tried using if statements but the results were not accurate. I think it is better to extract the indices of the dominated solutions and then remove them from the main vector x to get the non-dominated solutions. Thanks in advance do you mind files from FEX? This one works perfectly: "Pareto Front" by Yi Cao giving you the indices of Then you just have to use it like this: leads to: which is exactly how it is supposed to look like. Otherwise you need to clarify your question. 这篇关于如何提取非支配解(帕累托前沿)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
x
指数。
x = -5 + 10 * rand(100,1);
J1 = x。^ 2;
J2 =(x-2)。^ 2;
idx = paretofront([J1,J2]);
xdi =〜ismember(idx,1:numel(x));
图(1)
持有
分散(J1,J2,10,'red');
scatter(J1(idx),J2(idx),50,'blue');
scatter(J1(xdi),J2(xdi),50,'green');
延期
legend('all solutions','dominating solutions','non dominating solutions')
% generating 100 solutions randomly between -5 and 5:
x=-5+10*rand(100,1);
% calculate both objective functions, J1 and J2 at each solution:
J1=x.^2;
J2=(x-2).^2;
x
of dominating solutions.x=-5+10*rand(100,1);
J1=x.^2;
J2=(x-2).^2;
idx = paretofront([J1,J2]);
xdi = ~ismember(idx,1:numel(x));
figure(1)
hold on
scatter(J1,J2,10,'red');
scatter(J1(idx),J2(idx),50,'blue');
scatter(J1(xdi),J2(xdi),50,'green');
hold off
legend('all solutions','dominating solutions','non dominating solutions')