如何提取非支配解(帕累托前沿)

编程入门 行业动态 更新时间:2024-10-23 07:27:21
本文介绍了如何提取非支配解(帕累托前沿)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我曾多次尝试使用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>

为您提供了主导解决方案的 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')

导致:

这正是它应该看起来的样子。否则,您需要澄清您的问题。

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:

% 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;

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 x of dominating solutions.

Then you just have to use it like this:

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')

leads to:

which is exactly how it is supposed to look like. Otherwise you need to clarify your question.

更多推荐

如何提取非支配解(帕累托前沿)

本文发布于:2023-11-30 20:12:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651340.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:帕累托

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!