Failure in initial nonlinear constraint function evaluation. FMINCON cannot continue.
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have write the main program, an objective function and the non-linear constraint. My objective was to minimise V value in COST.m function by passing three decision variables , x0(1), x0(2) and x0(3). Could anyone please advice me?
The main program
clear
clc
data = xlsread("RCbeamdata.xls");
c = data(1,1) % Nominal cover (mm)
mainD = data(2,1) % Main rebar diameter (mm)
mainLink = data(3,1) % Link diameter (mm)
fck = data(4,1) % Characteristic strength of concrete (MPa)
fyk = data(5,1) % Characterisc strength of steel (MPa)
Rc = data(6,1) % Rate for concrete (RM/m3)
Rs = data(7,1) % Rate for steel (RM/kg)
rhos = data(8,1) % Density of steel (kg/m3)
L = data(9,1) % Span of beam (m)
M = data(10,1) % Maximum moment (kNm)
V = data(11,1) % Maximum shear force (kN)
% Starting point for optimization (decision variables)
x0(1) = data(12,1) % starting beam width (mm)
x0(2) = data(13,1) % starting beam height (mm)
x0(3) = data(14,1) % starting tensile reinforcement areas (mm2)
%x0(4) = data(15,1) % starting compression reinforcement areas (mm2)
% Min and max ratio of reinforcement
fctm = 0.3*fck^(2/3);
rho_min = max(0.26*fctm/fyk, 0.0013); %Asmin requirement
rho_max = 0.04; %As max requirement
d = x0(2)- c- mainLink-0.5*mainD; %Effective depth
Mult = 0.167*fck*x0(1)*d^2; % Ultimate moment of resistance for a singly reinforced beam
% Constraint
A = [];
b = [];
Aeq = [];
beq = [];
lb = [ 0.3*x0(2),x0(2),0.5*pi*mainD^2 ];
ub = [ 0.6*x0(2),x0(2),0.04*x0(1)*x0(2) ];
% Nonlinear constraint
% nonlincon =@(x) SinglyRCBeamConstraint(x0,fyk,fck,d,M,V,rho_min);
% options = optimoptions(@fmincon,'algorithm','sqp','Display','final-detailed',...
% 'ConstraintTolerance',1e-8,'MaxFunctionEvaluations',5000,...
% 'MaxIterations',2000,'OptimalityTolerance',1e-6);
%[c,ceq] = nonlincon(x0);
%Define problem
% problem =createOptimProblem('fmincon','x0',x0,'objective',RCCOST,'lb',lb,'ub',ub,...
% 'nonlcon',SinglyRCBeamConstraint,'options',options);
%
% %fmincon SOLVER
% % [x,fval,eflag,output] = fmincon(problem);
%
% %Global search solver
% gs = GlobalSearch('Display','final','FunctionTolerance',0,'NumTrialPoints',400000,...
% 'NumStageOnePoints',8000)
%
% rng default
% [xg,fg,exitflag,output,solutions] = run(gs,problem)
fun = @(x0) COST(x0,Rc,Rs,rhos,L);
x0 = lb;
[x,fval] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,@SinglyRCBeamConstraint)
The OBJECTIVE FUNCTION
function V = COST(x,Rc,Rs,rhos,L)
% Objective function
V = (Rc*(x(1)*x(2) -x(3)) + Rs*x(3)*rhos)*L;
end
The NONLINEAR CONSTRAINT
function [c,ceq] = SinglyRCBeamConstraint(x0,fyk,fck,d,M,V,rho_min)
gamma_s = 1.15;
gamma_c = 1.5;
y= (5000/1173)*(fyk/fck);
x= y*(x0(3)/(x0(1)*d))-1; % Neutral axis depth for singly reinforced concrete
c(1) = (5000/1173)*(fyk/fck)*(x0(3)/(x0(1)*x0(2)))-1; % x <=0.45d (Avoid Brittle Failure)
c(2) = M*1e6/(17/(258*gamma_c)*fck*x0(1)*x*(d-0.4*x))-1; % Mmax <=Mult due to compression force in concrete
c(3) = M*1e6/((fyk/gamma_s)*x0(3)*(d-0.4*x))-1; % Mmax <= Mult due to tension force in steel
c(4) = V*1e3/((0.18*(1-fck/250)*fck)*x0(1)*d)-1; % Vmax <= Vrdc(45)
c(5) = 1-(x0(3)/(rho_min*x0(1)*d)); % As >=Asmin
ceq = [];
end
0 commentaires
Réponses (1)
Torsten
le 25 Déc 2023
Modifié(e) : Torsten
le 25 Déc 2023
You forgot to include "RCbeamdata.xls".
And you know that you fix x(2) to x0(2) if you set lb(2) = ub(2) = x0(2) ?
And you must parametrize "SinglyRCBeamConstraint" in the same way as you did for "COST":
obj = @(x) COST(x,Rc,Rs,rhos,L);
nonlcon = @(x)SinglyRCBeamConstraint(x,fyk,fck,d,M,V,rho_min);
[x,fval] = fmincon(obj,x0,A,b,Aeq,beq,lb,ub,nonlcon)
0 commentaires
Voir également
Catégories
En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!