用matlab,这个怎么优化呀Optimization terminated: magnitude of search direction less than 2*options.TolX and maximum constraint violation is less than options.TolCon.Active inequalities (to within options.TolCon = 1e-006): lower upper
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/23 06:13:07
用matlab,这个怎么优化呀Optimization terminated: magnitude of search direction less than 2*options.TolX and maximum constraint violation is less than options.TolCon.Active inequalities (to within options.TolCon = 1e-006): lower upper
用matlab,
这个怎么优化呀
Optimization terminated: magnitude of search direction less than 2*options.TolX
and maximum constraint violation is less than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
3
我运行了程序,怎么有这个错误,不能得到想要的结果呢?
用matlab,这个怎么优化呀Optimization terminated: magnitude of search direction less than 2*options.TolX and maximum constraint violation is less than options.TolCon.Active inequalities (to within options.TolCon = 1e-006): lower upper
目标函数M文件
function f=fun(x)
f=x(1)^2+x(2)^2+x(3)^2+x(4)^2;
非线性约束M文件
function [c ceq]=fun1(x)
c=[];
ceq=x(1)*x(4)+2*x(2)*x(4)-2*x(3)*x(4)^2;
命令窗口
>> x0=rand(1,4);
>> lb=[54 27 1.6 15.8];
>> ub=[66 33 2.4 16.2];
>> [x,fval]=fmincon('fun',x0,[],[],[],[],lb,ub,'fun1')
Warning:Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon at 260
Optimization terminated:no feasible solution found.Magnitude of search
direction less than 2*options.TolX but constraints are not satisfied.
x =
53.2740 26.2740 3.1260 16.9260
fval =
3.8247e+003
其实此题无解