Multiobjective optimisation with 2D (empirical) distributions - am I doing this right?

1 回表示 (過去 30 日間)
Neuropragmatist
Neuropragmatist 2019 年 8 月 4 日
コメント済み: Neuropragmatist 2019 年 8 月 12 日
Hi all,
I have two parameters that I can vary in order to get two outputs (i.e. for every combination of X and Y I get a result and the time taken to get that result).
For instance, these parameters might look like this:
a = ones(64,64).*(1:64); % values for output 1 at every parameter 1 x parameter 2 combination
b = ones(64,64).*(64:-1:1); % values for output 2 at every parameter 1 x parameter 2 combination
figure
subplot(1,3,1)
imagesc(a)
xlabel('parameter 1')
ylabel('parameter 2')
title('output 1')
daspect([1 1 1])
subplot(1,3,2)
imagesc(b)
xlabel('parameter 1')
ylabel('parameter 2')
title('output 2')
daspect([1 1 1])
These examples could be approximated very accurately with a function f(x) which would make things easy, but my real data are more complex. This is somewhat similar to my real data though, when parameter 1 is low output 1 is low (which is good) but output 2 is high (which is bad).
I want to optimise parameter 1 and parameter 2 to simultaneously minimise output 1 and output 2. To do this I am trying this:
f1 = @(xy) interp2(a,xy(2),xy(1)); % function for collecting values from a(x,y)
f2 = @(xy) interp2(b,xy(2),xy(1)); % function for collecting values from b(x,y)
f3 = @(xy) [f1(xy) f2(xy)]; % function to combine these two results
nvar = 2;
[x, fval] = gamultiobj(f3, nvar, [],[],[],[],[1 1],[64 64]); % pareto optimisation
subplot(1,3,3)
plot(x(:,1),x(:,2),'ko')
xlabel('parameter 1')
ylabel('parameter 2')
title('pareto front')
axis ij square
axis([1 64 1 64])
Does this code look right at all or should I be doing something else?
Why in this example is the pareto set not a vertical line of points where the two outputs are balanced?
Thanks for any help,
M.
  2 件のコメント
Jyotsna Talluri
Jyotsna Talluri 2019 年 8 月 8 日
I noticed that the points in pareto front are changing when run at different times
Neuropragmatist
Neuropragmatist 2019 年 8 月 8 日
Yes... I'm guessing that's because gamultiobj starts with some random seed parameters?
By adding the line rng('default') before gamultiobj you can be sure to get the same result each time.

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

回答 (1 件)

Jyotsna Talluri
Jyotsna Talluri 2019 年 8 月 8 日
Hi,
gamultiobj is used to show the tradeoff between objectives which depends on the same parameters.
Specify ‘PlotFcn’ as gaplotpareto in options
options = optimoptions('gamultiobj','PopulationSize',64,'ParetoFraction',0.7,'PlotFcn',@gaplotpareto);
[x,fval,flag,output,population] = gamultiobj(f3,2, [],[],[],[],[1,1],[64,64],options);
This creates a pareto front which shows the tradeoff between the two objectives(straight line with one output high and one output low)
gamultiobj does not minimzes two objectives simultaneosly, Instead you can use fmincon optimizer
Refer to the below link
  3 件のコメント
Jyotsna Talluri
Jyotsna Talluri 2019 年 8 月 12 日
When both functions f1(xy) and f2(xy) are minimum then f3(xy) should be minimum .You can use fmincon optimzer for this function
f3=@(xy)(((f1(xy)-1)^2)+((f2(xy)-1)^2));
x=fmincon(f3,[1,1],[],[],[],[],[1,1],[64,64]);
Neuropragmatist
Neuropragmatist 2019 年 8 月 12 日
OK, that makes sense - I have some questions about your function f3 though:
1) Why do you subtract 1 from f1 and f2 and then square the result? Is that a standard way to combine these outputs?
2) Does this assume f1 and f2 are scaled the same? i.e. if the result from f1 can vary between 0 and 1000 but the result from f2 only varies between 0 and 1 is that a problem? Should the results be normalised so that they vary equally?
Sorry for what must seem like stupid questions but I would really like to understand the process.
At the moment I am using fgoalattain with the weights set to be equal, is that better/worse/the same as what you are suggesting?
Thanks for any help,
M.

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

カテゴリ

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

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by