フィルターのクリア

Pareto frontier plot error

4 ビュー (過去 30 日間)
Briana Canet
Briana Canet 2023 年 9 月 18 日
コメント済み: Torsten 2023 年 9 月 18 日
I am trying to plot the Pareto frontiers for...
Problem A
Minimize f1(x1,x2)=x2*sin(x1)
Minimize f2(x1,x2)=x1+x2
and
Problem B
Minimize f1(x1,x2)=x1^4+(4*x1*x2)
Minimize f2(x1,x2)=x1+(2*x2^2)
I am not sure when a dot/period is needed in f1 and f2 in Lines 2 and 3 for Problem A and B. I am only getting one point on (0,0) for each problem now.
Problem A:
% Functions
f1 = @(x1, x2) x2.*sin(x1);
f2 = @(x1, x2) x1+x2;
% Grid of values
[x1, x2] = meshgrid(0:0.01:1, 0:0.01:1);
% Calculate the objective functions
F1 = f1(x1, x2);
F2 = f2(x1, x2);
% Weighted average method
weights = 0:0.01:1;
paretoFronts = zeros(length(weights), 2);
for i = 1:length(weights)
l = weights(i);
% Weighted sum
F = l*F1 + (1-l)*F2;
[minF, idx] = min(F(:));
paretoFronts(i, :) = [x1(idx), x2(idx)];
end
figure;
plot(paretoFronts(:,1), paretoFronts(:,2), 'o-');
xlabel('x1');
ylabel('x2');
title('Problem 1ii');
grid on;
Problem B:
% Functions
f1 = @(x1, x2) x1.^4+(4*x1.*x2);
f2 = @(x1, x2) x1+(2*x2.^2);
% Grid of values
[x1, x2] = meshgrid(0:0.01:1, 0:0.01:1);
% Calculate the objective functions
F1 = f1(x1, x2);
F2 = f2(x1, x2);
% Weighted average method
weights = -1:0.01:1;
paretoFronts = zeros(length(weights), 2);
for i = 1:length(weights)
l = weights(i);
% Weighted sum
F = l*F1 + (1-l)*F2;
[minF, idx] = min(F(:));
paretoFronts(i, :) = [x1(idx), x2(idx)];
end
figure;
plot(paretoFronts(:,1), paretoFronts(:,2), 'o-');
xlabel('x1');
ylabel('x2');
title('Problem 1ii');
grid on;

回答 (1 件)

Torsten
Torsten 2023 年 9 月 18 日
移動済み: Torsten 2023 年 9 月 18 日
In both examples, the two objective functions are not "competitive" since both have (0/0) as optimum combination for x1 and x2 in the range 0 <= x1 <= 1 and 0 <= x2 <= 1. These are bad examples for pareto optimum problems.
  2 件のコメント
Briana Canet
Briana Canet 2023 年 9 月 18 日
Although it's not the best example, are the functions f1 anf f2 written correctly with appropriate placement of "."?
Torsten
Torsten 2023 年 9 月 18 日
Yes. As long as x1 and x2 have the same size (which is guaranteed since you generate them using "meshgrid"), the "."'s are appropriately placed.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultiobjective Optimization についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by