Multiobjective optimisation with 2D (empirical) distributions - am I doing this right?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Jyotsna Talluri
am 8 Aug. 2019
I noticed that the points in pareto front are changing when run at different times
Antworten (1)
Jyotsna Talluri
am 8 Aug. 2019
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 Kommentare
Jyotsna Talluri
am 12 Aug. 2019
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]);
Siehe auch
Kategorien
Mehr zu Multiobjective Optimization finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!