MATLAB Answers

Multiobjective optimization with constraints

38 views (last 30 days)
Sabrina Chui
Sabrina Chui on 21 Jan 2021
Commented: Sabrina Chui on 28 Jan 2021
Hi All,
I am trying to solve a game theoretic scenario where I have two players that each have three decision variables. They each have their own individual utility functions with their payoffs depending on what the other one does. As a result, I have to optimize these two equations simulataneously. I've looked into using the gamultiobj tool, and I've tried to follow an example from the MATLAB website, but obviously my scenario is a little bit more complicated. They just had one variable, whereas I have six variables in total, with additional constraints of all variables being nonnegative, and x(5) and x(6) being <=24. I'm not exactly sure where I went wrong, especially since my situation differs quite a bit from the example, so i would greatly appreciate any and all help. I've included my code below (the example, then mine). Thanks in advance!
% Example version
fitnessfcn = @(x)[sin(x),cos(x)];
nvars = 1;
lb = 0;
ub = 2*pi;
rng default % for reproducibility
x = gamultiobj(fitnessfcn,nvars,[],[],[],[],lb,ub)
plot(sin(x),cos(x),'r*')
xlabel('sin(x)')
ylabel('cos(x)')
title('Pareto Front')
legend('Pareto front')
%My version
funx=-0.5*x(1)^2+100*log(x(1)+x(2)-14)-x(5)/2+0.9*(-0.5*(1-x(5)/40)*x(3)^2+100*log(x(3)+x(4)-14))
funy=-0.5*x(2)^2+100*log(x(1)+x(2)-14)-x(6)/2+0.9*(-0.5*(1-x(5)/40)*x(4)^2+100*log(x(3)+x(4)-14))
fitnessfcn = @(x)[funx,funy];
nvars = 2;
lb = [0,0,0,0,0,0];
ub = [Inf,Inf,Inf,Inf,24,24];
rng default % for reproducibility
x = gamultiobj(fitnessfcn,nvars,[],[],[],[],lb,ub)
plot(funx,funy,'r*')
xlabel('funx')
ylabel('funy')
title('Pareto Front')
legend('Pareto front')

  0 Comments

Sign in to comment.

Accepted Answer

Alan Weiss
Alan Weiss on 21 Jan 2021
Edited: Alan Weiss on 21 Jan 2021
Your input data is inconsistent:
nvars = 2;
lb = [0,0,0,0,0,0];
ub = [Inf,Inf,Inf,Inf,24,24];
Your bounds are on your decision variables, not your objective functions. The nvars argument refers to exactly this, so you should have nvars = 6.
Your other errors relate to how to call functions and use ther resulting data. Your fitness functions need initial @x arguments:
funx = @(x)-0.5*x(1)^2+100*log(x(1)+x(2)-14)-x(5)/2+0.9*(-0.5*(1-x(5)/40)*x(3)^2+100*log(x(3)+x(4)-14));
funy = @(x)-0.5*x(2)^2+100*log(x(1)+x(2)-14)-x(6)/2+0.9*(-0.5*(1-x(5)/40)*x(4)^2+100*log(x(3)+x(4)-14));
fitnessfcn = @(x)[funx(x),funy(x)];
Your plot needs to pass the data to the objective functions:
plot(funx(x),funy(x),'r*')
When I ran this code I got other errors relating to the function being complex-valued. You also need to include linear constraints that keep the function from having complex values. But this should get you started.
Alan Weiss
MATLAB mathematical toolbox documentation

  7 Comments

Show 4 older comments
Sabrina Chui
Sabrina Chui on 27 Jan 2021
Hi Alan, I changed all the options back to default, changed the upper boundaries and that seemed to work. When I look through my set of solutions for e1 and e2, none of them even get close to the solutions that I worked out by hand. For the two objective functions I provided, f1 and f2, the nash equilibrium should be e1=3.3333 and e2=3.3333. When I ran this example, I think I was only expecting one solution on the pareto front, but it was confusing to see a long set of solutions. Is it because of the way the algorithm works, if I increase the iterations will I get closer to what I expected? Thank you!
Alan Weiss
Alan Weiss on 27 Jan 2021
For the problem as you have defined it, the solution has e1 going from 0 to 5, and e2 going from 5 to 0 as follows (in one run, these numbers are stochastic):
solution =
0.0001 4.9999
0.0001 4.9999
0.0825 4.9803
0.1373 4.5127
0.0062 5.0064
5.0000 0
4.3021 0.0542
4.9261 0.0507
0.8771 3.0301
3.8961 0.1244
0.5075 3.3599
0.9395 3.9216
4.4089 0.3093
0.5050 4.5467
4.4039 0.6124
2.2507 2.8033
4.9980 0.0012
0.3360 4.0666
There is a tradeoff between the objective functions; here are the associated values:
objectiveValue =
-1.7589 -3.4199
-1.7589 -3.4199
-2.1381 -3.4105
-2.2649 -3.4015
-1.8919 -3.4192
-3.4200 -1.7100
-3.4068 -2.1589
-3.4141 -2.0828
-2.7837 -3.2735
-3.3886 -2.3142
-2.6281 -3.3282
-2.7051 -3.3026
-3.3813 -2.4178
-2.5004 -3.3607
-3.3472 -2.5573
-3.0143 -3.1138
-3.4198 -1.8165
-2.4708 -3.3717
So I think that it is your interpretation of the solution that is at fault, not the solution.
Note that your expected solution is not even on the Pareto curve (there are better points). Your expected solution has value (-2.9876,-2.9876), but there are points (such as the third to last) with both values smaller than -3.
Alan Weiss
MATLAB mathematical toolbox documentation
Sabrina Chui
Sabrina Chui on 28 Jan 2021
Thanks for clariying this Alan! I'll have to do a little bit more reading on the matter, but this is a great start!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!