关于matlab优化fmincon函数出现的问题,悬赏20豆+发自内心的感谢! 20
运行错误提示:[x,fval,exitflag]=beta_fminconWarning:Trust-region-reflectivealgorithmdoesnots...
运行错误提示:[x,fval,exitflag]=beta_fmincon
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. You could also try the interior-point or sqp algorithms: set the Algorithm option to 'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the documentation.
源程序:主函数function [x,fval,exitflag]=beta_fmincon(x)
beta_savedata;
load matlab_beta_savedata;
A=[];b=[];
Aeq=[];beq=[];
lb=[0.15;0.1959;0];
ub=[0.3;1;1];
x0=[0.2;0.38;0.5];
[x,fval,exitflag]=fmincon('beta_myfun',x0,A,b,Aeq,beq,lb,ub,'beta_consfun');
非线性约束函数:function [c,ceq]=beta_consfun(x)
load matlab_beta_savedata;
z=x(1);
beta=x(2);
w=x(3);
phi1=L*beta*z./(L-a+z*hg);
phi2=L*(1-beta)*z./(a-z*hg);
phi10=L0*beta*z./(L0-a0+z*hg0);
phi20=L0*(1-beta)*z./(a0-z*hg0);
c(1)=z-0.08-phi1;
c(2)=z-0.08-phi10;
c(3)=phi2-z-0.08;
c(4)=phi20-z-0.08;
ceq=[];
目标函数:
function feval=beta_myfun(x)
load matlab_beta_savedata;
z=x(1);
beta=x(2);
w=x(3);
phi1=L*beta*z./(L-a+z*hg);
phi2=L*(1-beta)*z./(a-z*hg);
phi10=L0*beta*z./(L0-a0+z*hg0);
phi20=L0*(1-beta)*z./(a0-z*hg0);
%s=w*((phi1-z).^2+(phi2-z).^2)+(1-w)*((phi10-z).^2+(phi20-z).^2);
s=(1371405506619851936417579888010528706056243686017728951188373489401529416109400048747601358259513690570655491924886615850078490780021*beta*w) /63149207867011768781116479139777167778542037247991011933002506944168320257406580010719829707212507123838628861742709517710941680000 - (8581613228458098358189309330572860859935964842977066658635427766323459157068424764122972015860115219*w)
/931744758318013517655989474154361839781136623119793032567365593205420033708126101367711808787290000
- (40053375012028643980607264885853125597874318196798051534317474549*beta)...
/630212317799176478271366229451893773655698421306368970863774080 - (349064408116970078885489997674889567889742704803998997739405039653968272292732735967407603816320452884693316921701821561763675818420494854851216379246415149142466502921*beta^2*w)
/30199338376584211562032109005505384149460411621007638954209851833368873718407402688403766863717490026988308490393091625486187536231759501514611487955226742768527360000+ (3529108998866355886957568293463269402162674998098686314690430588998504551996948987*beta^2) /76264220638283685002621150794085718107549150979936253842555546119661048163123200 + 68425837487626855783974878989545906654594496593921/3124670222931016688412943854964356810350458176200;
feval=s;
初始数据:function beta_savedata
hg=0.83;
hg0=0.72;
a=1.56;
a0=1.28;
L=2.6;
L0=2.6;
G=36.5;%kN
G0=20;%kN
save matlab_beta_savedata; 展开
Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. You could also try the interior-point or sqp algorithms: set the Algorithm option to 'interior-point' or 'sqp' and rerun. For more help, see Choosing the Algorithm in the documentation.
源程序:主函数function [x,fval,exitflag]=beta_fmincon(x)
beta_savedata;
load matlab_beta_savedata;
A=[];b=[];
Aeq=[];beq=[];
lb=[0.15;0.1959;0];
ub=[0.3;1;1];
x0=[0.2;0.38;0.5];
[x,fval,exitflag]=fmincon('beta_myfun',x0,A,b,Aeq,beq,lb,ub,'beta_consfun');
非线性约束函数:function [c,ceq]=beta_consfun(x)
load matlab_beta_savedata;
z=x(1);
beta=x(2);
w=x(3);
phi1=L*beta*z./(L-a+z*hg);
phi2=L*(1-beta)*z./(a-z*hg);
phi10=L0*beta*z./(L0-a0+z*hg0);
phi20=L0*(1-beta)*z./(a0-z*hg0);
c(1)=z-0.08-phi1;
c(2)=z-0.08-phi10;
c(3)=phi2-z-0.08;
c(4)=phi20-z-0.08;
ceq=[];
目标函数:
function feval=beta_myfun(x)
load matlab_beta_savedata;
z=x(1);
beta=x(2);
w=x(3);
phi1=L*beta*z./(L-a+z*hg);
phi2=L*(1-beta)*z./(a-z*hg);
phi10=L0*beta*z./(L0-a0+z*hg0);
phi20=L0*(1-beta)*z./(a0-z*hg0);
%s=w*((phi1-z).^2+(phi2-z).^2)+(1-w)*((phi10-z).^2+(phi20-z).^2);
s=(1371405506619851936417579888010528706056243686017728951188373489401529416109400048747601358259513690570655491924886615850078490780021*beta*w) /63149207867011768781116479139777167778542037247991011933002506944168320257406580010719829707212507123838628861742709517710941680000 - (8581613228458098358189309330572860859935964842977066658635427766323459157068424764122972015860115219*w)
/931744758318013517655989474154361839781136623119793032567365593205420033708126101367711808787290000
- (40053375012028643980607264885853125597874318196798051534317474549*beta)...
/630212317799176478271366229451893773655698421306368970863774080 - (349064408116970078885489997674889567889742704803998997739405039653968272292732735967407603816320452884693316921701821561763675818420494854851216379246415149142466502921*beta^2*w)
/30199338376584211562032109005505384149460411621007638954209851833368873718407402688403766863717490026988308490393091625486187536231759501514611487955226742768527360000+ (3529108998866355886957568293463269402162674998098686314690430588998504551996948987*beta^2) /76264220638283685002621150794085718107549150979936253842555546119661048163123200 + 68425837487626855783974878989545906654594496593921/3124670222931016688412943854964356810350458176200;
feval=s;
初始数据:function beta_savedata
hg=0.83;
hg0=0.72;
a=1.56;
a0=1.28;
L=2.6;
L0=2.6;
G=36.5;%kN
G0=20;%kN
save matlab_beta_savedata; 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询