Use sfit object for multiobjective optimization
Hello everybody,
I want to solve an optimization problem regarding 3 objectives and 2 variables. The data that needs to be optimized may differ dependant on the users input.
My approach was to first generate arrays or vectors that hold the in- and output data. I can now generate 3 surface fit (sfit) objects for every objective that needs to be optimized. The gamultibj algorithm now suggests that I use these functions to create a fitness function, which then will be optimized. However I dont understand how I can create a useable fitness function out of the previously generated sfit objects. To me it seems the gamultiobj algorithm only wirks with a "hard coded" fitness function.
Relevant Code:
% v_n_ges / v_n_P holds all variables
% v_EW / v_T_med and v_K_med holds all objectives
% generate functions to optimize
EW_fit = fit([v_n_ges, v_n_P], v_EW, ‘poly22’);
T_med_fit = fit([v_n_ges, v_n_P], v_T_med, ‘poly22’);
K_med_fit = fit([v_n_ges, v_n_P], v_K_med, ‘poly22’);
% Multiobjective Optimization via fitness function
fitnessfcn = @Fitnessfcn;
numberOfVariables = 3;
[x, fval] = gamultiobj(fitnessfcn, numberOfVariables);
%% Generate fitness function (in progress)
function f = Fitnessfcn (x) % The fitness function would need an input row vector size 2 containing n_ges and n_P
% but also the sfit objects
% Allocate output
f = zeros(1,3);
f(1) = @EW_fit;
f(2) = @T_med_fit;
f(3) = @K_med_fit;
end
Also I was wondering if there is any way to skip the "sfit-step" and just directly work with the vectors/arrays.
Thanks in advance for your support and with best regardsHello everybody,
I want to solve an optimization problem regarding 3 objectives and 2 variables. The data that needs to be optimized may differ dependant on the users input.
My approach was to first generate arrays or vectors that hold the in- and output data. I can now generate 3 surface fit (sfit) objects for every objective that needs to be optimized. The gamultibj algorithm now suggests that I use these functions to create a fitness function, which then will be optimized. However I dont understand how I can create a useable fitness function out of the previously generated sfit objects. To me it seems the gamultiobj algorithm only wirks with a "hard coded" fitness function.
Relevant Code:
% v_n_ges / v_n_P holds all variables
% v_EW / v_T_med and v_K_med holds all objectives
% generate functions to optimize
EW_fit = fit([v_n_ges, v_n_P], v_EW, ‘poly22’);
T_med_fit = fit([v_n_ges, v_n_P], v_T_med, ‘poly22’);
K_med_fit = fit([v_n_ges, v_n_P], v_K_med, ‘poly22’);
% Multiobjective Optimization via fitness function
fitnessfcn = @Fitnessfcn;
numberOfVariables = 3;
[x, fval] = gamultiobj(fitnessfcn, numberOfVariables);
%% Generate fitness function (in progress)
function f = Fitnessfcn (x) % The fitness function would need an input row vector size 2 containing n_ges and n_P
% but also the sfit objects
% Allocate output
f = zeros(1,3);
f(1) = @EW_fit;
f(2) = @T_med_fit;
f(3) = @K_med_fit;
end
Also I was wondering if there is any way to skip the "sfit-step" and just directly work with the vectors/arrays.
Thanks in advance for your support and with best regards Hello everybody,
I want to solve an optimization problem regarding 3 objectives and 2 variables. The data that needs to be optimized may differ dependant on the users input.
My approach was to first generate arrays or vectors that hold the in- and output data. I can now generate 3 surface fit (sfit) objects for every objective that needs to be optimized. The gamultibj algorithm now suggests that I use these functions to create a fitness function, which then will be optimized. However I dont understand how I can create a useable fitness function out of the previously generated sfit objects. To me it seems the gamultiobj algorithm only wirks with a "hard coded" fitness function.
Relevant Code:
% v_n_ges / v_n_P holds all variables
% v_EW / v_T_med and v_K_med holds all objectives
% generate functions to optimize
EW_fit = fit([v_n_ges, v_n_P], v_EW, ‘poly22’);
T_med_fit = fit([v_n_ges, v_n_P], v_T_med, ‘poly22’);
K_med_fit = fit([v_n_ges, v_n_P], v_K_med, ‘poly22’);
% Multiobjective Optimization via fitness function
fitnessfcn = @Fitnessfcn;
numberOfVariables = 3;
[x, fval] = gamultiobj(fitnessfcn, numberOfVariables);
%% Generate fitness function (in progress)
function f = Fitnessfcn (x) % The fitness function would need an input row vector size 2 containing n_ges and n_P
% but also the sfit objects
% Allocate output
f = zeros(1,3);
f(1) = @EW_fit;
f(2) = @T_med_fit;
f(3) = @K_med_fit;
end
Also I was wondering if there is any way to skip the "sfit-step" and just directly work with the vectors/arrays.
Thanks in advance for your support and with best regards sfit, gamultiobj, multiobjective optimization MATLAB Answers — New Questions