Define a regression equation that can be recalled as a fitness function in optimization toolbox
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Matt J
2022-1-11
编辑:Matt J
2022-1-11
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
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!