Multi objective Bayesopt in MATLAB

Hello,
How can I use the BayesOpt of MATLAB for optimizing a multi objective problem? I mean when I have multiple cost functions rather than only one.
If it is not possible in the default version of BayesOpt of MATLAB, can I have some additional codes for this aim?
Thanks in advance

回答 (1 件)

Alan Weiss
Alan Weiss 2021 年 5 月 5 日

0 投票

There is no provision for using bayesopt for multiobjective problems. You have several choices:
Alan Weiss
MATLAB mathematical toolbox documentation

4 件のコメント

xu supeng
xu supeng 2021 年 7 月 13 日
Could you give an example that use bayesopt as the optimizer to find the pareto Front ?
Alan Weiss
Alan Weiss 2021 年 7 月 13 日
This code is essentially the same example as Generate and Plot Pareto Front. Using bayesopt is slow; I plot only 20 solution points, and limit bayesopt to 10 function evaluations per point.
x = optimizableVariable('x',[-2 2]);
N = 20;
xsol = zeros(N,1);
ysol = zeros(N,2);
alpha = linspace(0,1,N);
for i = 1:N
sol = bayesopt(@(x)myobj(x,alpha(i)),x,...
'IsObjectiveDeterministic',true,"Verbose",0,"PlotFcn",[],...
'MaxObjectiveEvaluations',10);
xsol(i) = sol.XAtMinObjective.x;
ysol(i,:) = objective(xsol(i));
end
figure
plot(ysol(:,1),ysol(:,2),'ko');
xlabel('f_1')
ylabel('f_2')
function mo = myobj(in,alpha)
x = in.x;
% mo = alpha*x^2 + (1 - alpha)*(1 - x)^2;
mo = dot(objective(x),[alpha 1-alpha]);
end
function objfun = objective(x)
objfun = zeros(1,2);
objfun(2) = (1 - x)^2;
objfun(1) = x^2;
end
Alan Weiss
MATLAB mathematical toolbox documentation
xu supeng
xu supeng 2021 年 7 月 14 日
Thanks for your quikc reply. It works, but I still have some questions to ask you. First, it seems the program calculate the objfun(1) and objfun(2) seperately and then use the weight to define an objective mo( = objective(1) * alpha + objective(2) * (1-alpha) ) that the bayesopt to optimize. My question is, whether this kind of method too simple? or is this resonable (common) in find the pareto Front?
My second question is if there are three or three more objectives, how to define the mo ? and how to find the pareto Front ? (Just curious)
Alan Weiss
Alan Weiss 2021 年 7 月 14 日
You are correct, I was just doing a sweep over alpha with objective mo = objective(1) * alpha + objective(2) * (1-alpha). If you have more objectives, you can have more nonnegative multipliers, and sweep over them with the sum of the multipliers equal to 1.
This is not always the best way to solve multiobjective problems, it might miss some things, but it enables you to get some sort of results using a single-objective minimizer.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

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

カテゴリ

質問済み:

Aep
2021 年 5 月 4 日

コメント済み:

2021 年 7 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by