How to optimize only 2 variables in an objective function with 3 variables?

조회 수: 27(최근 30일)
Suhas Raghavendra Kulkarni
Suhas Raghavendra Kulkarni 2020년 6월 9일
답변: Fabio Freschi 2020년 6월 9일
I am trying to solve a multiobjective optimization problem.
I have 4 objective functions each of which is a function in 3 variables. Among the 3 variables, 2 variables need to be optimized and are to be used to calculate the 3rd variable using a closed form equation. However, I am unable to figure out how to optimize only 2 of the 3 variables.
Description of overall problem
Each objective function is derived from different inputs which are known. Lets assume inputs as "input_1", "input_2", "input_3", "input_4"
Let's assume the variables to be optimized are "x", "y" and the variables to be calculated are "theta_i", where i=1,2,3,4.
objective function 1 = function (input_1, x,y, theta_1)
objective function 2 = function (input_2, x,y, theta_2)
objective function 3 = function (input_3, x,y, theta_3)
objective function 4 = function (input_4, x,y, theta_4)
optimization solution = gamultiobj([ob1, ob2, ob3, ob4],.....,options);
also
theta_1 = different_function(input_1,x,y)
theta_2 = different_function(input_2,x,y)
theta_3 = different_function(input_3,x,y)
theta_4 = different_function(input_4,x,y)
different_function is not known and needs to be calculated but is generally of the form as stated above.
Any advice on how to proceed with this problem is highly appreciated.

답변(2개)

Fabio Freschi
Fabio Freschi 2020년 6월 9일
Why don't you remove theta from your objective function definition and call different_function inside function?
function objective_function_1 = objfunction1(input_1, x,y)
theta_1 = different_function(input_1,x,y);
% interesting stuff with input_1, x,y, theta_1
...
end
  댓글 수: 1
Suhas Raghavendra Kulkarni
Suhas Raghavendra Kulkarni 2020년 6월 9일
Thank you for that suggestion, but unfortunately it doesn't work in this case as the different_function is a nonlinear equation containing trigometric ratios, which means when i solve for theta_i, i get multiple solutions in a vector form.
for example different_function is of the form (Please note, below function is just an example and is not the actual function I'm working with. The actual function is very long because of the large number of operations needed to be done to obtain it. This is just for simplified representation)
equation_1= x*sin(theta_1)+y*x*cos(theta_1)+y*sin(input_1)*cos(theta_1)-some_constants==0
different_function=solve(equation_1, theta_1)
ANS:
different_function=[function_a(x,y,input_1);function_b(x,y,input_1)];

댓글을 달려면 로그인하십시오.


Fabio Freschi
Fabio Freschi 2020년 6월 9일
In this case you can set the upper and lower bound for that specific variable to the same value. Maybe it is not efficient but it works. Look the code below
% objective functions
fun = @(x)[x(:,1).^2+x(:,2).^2; (x(:,1)-1).^2+x(:,2).^2];
% number of vars
nvars = 2;
% upper and lower bounds
lb = [-2; -2], ub = [2; 2];
% run optimization
x = gamultiobj(fun,nvars,[],[],[],[],lb,ub);
% set x(:,2) to 0 with same lower and upper bounds
lb = [-2; 0], ub = [2; 0];
% run optimization
x = gamultiobj(fun,nvars,[],[],[],[],lb,ub)

Community Treasure Hunt

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

Start Hunting!

Translated by