Graphing a Multi-Objective Optimization problem
7 views (last 30 days)
Show older comments
I am attempting to plot the pareto graph of a bi-objective problem(self learning) which goes: ie maximize
f1 = x1
f2 = x2
such that
𝑥1^2 + 𝑥2^2 - 1 ≤ 0
2𝑥1 + 𝑥2 - 2 ≤ 0
I have confirmed the correct sketch of the graph theoretically but I have spent days trying to read up on various ways to use matlab to plot it and I never could do it since my handle of matlab is mediocre at best. My final attempt was using gamultiobj in the toolbox but the graph is totally wrong (followed video on youtube). For the toolbox app, I used two scripts:
function Output = multi_objective_function(Input)
x1 = Input(1);
x2 = Input(2);
f1 = x1;
f2 = x2;
Output = [f1 f2];
and
function [C Ceq] = nonlinear_constraints(Input)
x1 = Input(1);
x2 = Input(2);
C = x1^2 + x2^2 - 1;
Ceq = [];
and entered A = [2 1] and beq = [2] in the linear inequality constraints section of the toolbox app window. But the graph came out totally different than expected. I tried several variants of the scripts including negating f1 and f2 (ie f1 = -x1 & f2 = -x2) in case the app only did minimizations. So
(1) any sort of help on the best approach will be appreciated and
(2) For the toolbox, did I do it right? Thanks and happy holidays.
0 Comments
Accepted Answer
Alan Weiss
on 29 Dec 2020
Using your functions (edited versions below), I called gamultiobj as follows:
A = [2 1];
b = 2;
options = optimoptions('gamultiobj','PlotFcn','gaplotpareto','PopulationSize',200);
[x,fval] = gamultiobj(@multi_objective_function,2,A,b,[],[],[-1 -1],[1 1],@nonlinear_constraints,options);
Then, to plot the resulting points:
figure
plot(x(:,1),x(:,2),'ko')
Does that look like what you expect?
Here are the functions I used:
function Output = multi_objective_function(Input)
x1 = Input(1);
x2 = Input(2);
f1 = -x1;
f2 = -x2;
Output = [f1 f2]; % Coould have reduced to Output = -Input;
end
function [C,Ceq] = nonlinear_constraints(Input)
x1 = Input(1);
x2 = Input(2);
C = x1^2 + x2^2 - 1;
Ceq = [];
end
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
More Answers (1)
See Also
Categories
Find more on Multiobjective Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!