How to optimize only 2 variables in an objective function with 3 variables?
13 views (last 30 days)
Show older comments
Answered: Fabio Freschi on 9 Jun 2020
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);
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.
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
More Answers (1)
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)
Find more on Genetic Algorithm 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!