Multiobjective optimisation with 2D (empirical) distributions - am I doing this right?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
2019년 8월 8일
I noticed that the points in pareto front are changing when run at different times
답변 (1개)
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
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]);
참고 항목
카테고리
Help Center 및 File Exchange에서 Multiobjective Optimization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!