# How to put weight on two objective functions using MATLAB Genetic Algorithm?

7 ビュー (過去 30 日間)
Phoenix 2019 年 10 月 15 日

Hi,
Say I have to minimize two objective functions -- how can I put weights on each objective function, say for example objective function #1 is 40% and objective function #2 is 60%.
Tried researching and the closest question I got similar to this one was this one (https://uk.mathworks.com/matlabcentral/answers/436951-how-to-choose-weight-for-one-of-functions-in-multi-objective-genetic-algorithm-tool-box) but it did not really answer the question.
Thanks for the help.

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

### 回答 (1 件)

Barnaby Pine 2022 年 3 月 1 日
Hello Phoenix,
By the way you worded the question I assume you are trying to achieve a Pareto front.
Where the objective functins have weights associated to them, satisfying a range of values. These values can then be plotted, on objective function axes. where the x-axis is objective function 1 and the y-axis is objective function 2.
MATLAB has a useful Pareto function which does most of the work for you!
options = optimoptions('gamultiobj','PopulationSize',60,...
'ParetoFraction',0.7,'PlotFcn',@gaplotpareto);
lb = [0 0]; %lower bound of objective functions
ub = [180 360]; %upper bound of objective functions
[solution,ObjectiveValue] = gamultiobj(@MultiObjectiveFunction,2,[],[],[],[],lb,ub,options);
function f = MultiObjectiveFunction(X)
% x is the input of the objective function as a vector
% f is the output of the objective functions in a vector
f(2) = x(1)^4 + x(2)^4 + x(1)*x(2) - (x(1)*x(2))^2;
f(1) = f(2) - 10*x(1)^2;
end
More detail on this example can be found through this link: https://uk.mathworks.com/help/gads/pareto-front-for-two-objectives.html
This Requires the Global optimisation toolbox found here: https://uk.mathworks.com/products/global-optimization.html
I know this question was posted in 2019, but I hope that while it may not help you it can help somebody else.
Kind regards,
Barnaby Pine

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

### Community Treasure Hunt

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

Start Hunting!