Define a regression equation that can be recalled as a fitness function in optimization toolbox

1 vue (au cours des 30 derniers jours)
clc
clear all
function j = alt_j(x)
load 'alternate_tubes_input_excel.xlsx';
x = alternate_tubes_input_excel.xlsx
%r = input('Radius of tube'); x(:,1)
%theta = input('Angle subtended on tubes'); x(:,2)
%h1 = input('Height of front edge'); x(:,3)
%h2 = input('Height of trailing edge'); x(:,4)
r = x(:,1);
theta = x(:,2);
h1 = x(:,3);
h2 = x(:,4);
j = 14.1456+0.484726*r-0.0771519*theta-1.06379*h1-2.24645*h2+0.0125672*r*theta+0.13915*r*h1+0.299992*r*h2-0.000582963*theta^2+0.0200475*theta*h1+0.0207946*theta*h2-0.145469*h1^2-0.213711*h1*h2;
f = 407.697-49.932*r-2.7565*theta-41.4562*h1-54.7269*h2+0.257928*r*theta+3.12083*r*h1+4.72761*r*h2-0.00244316*theta*theta+0.287108*theta*h1+0.271458*theta*h2+0.697391*h1*h1+0.950713*h1*h2;
end
I have written a code for the regression equation and now i want to call it in the optimization toolbox for multiobjective optimization and it is giving me errors there. the regression equation has four input variables and two objective function. where j has to be maximized and f is to be minimized.

Réponses (1)

Matt J
Matt J le 11 Jan 2022
Modifié(e) : Matt J le 11 Jan 2022
function out = multiObjective(x)
r = x(:,1);
theta = x(:,2);
h1 = x(:,3);
h2 = x(:,4);
j = 14.1456+0.484726*r-0.0771519*theta-1.06379*h1-2.24645*h2+0.0125672*r*theta+0.13915*r*h1+0.299992*r*h2-0.000582963*theta^2+0.0200475*theta*h1+0.0207946*theta*h2-0.145469*h1^2-0.213711*h1*h2;
f = 407.697-49.932*r-2.7565*theta-41.4562*h1-54.7269*h2+0.257928*r*theta+3.12083*r*h1+4.72761*r*h2-0.00244316*theta*theta+0.287108*theta*h1+0.271458*theta*h2+0.697391*h1*h1+0.950713*h1*h2;
out=[-j,f];
end

Catégories

En savoir plus sur Nonlinear Optimization dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by