matlab 函数 fmincon求解非线性规划,求这个函数的最小值 function f = myfun(x)f = (pi*(x(3)+2)*x(2)*x(1)^2)/4;运行后返回(约束在最后面有写)Warning:Trust-region-reflective method does not currently solve this type of prob
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/05 13:09:04
![matlab 函数 fmincon求解非线性规划,求这个函数的最小值 function f = myfun(x)f = (pi*(x(3)+2)*x(2)*x(1)^2)/4;运行后返回(约束在最后面有写)Warning:Trust-region-reflective method does not currently solve this type of prob](/uploads/image/z/6851751-15-1.jpg?t=matlab+%E5%87%BD%E6%95%B0+fmincon%E6%B1%82%E8%A7%A3%E9%9D%9E%E7%BA%BF%E6%80%A7%E8%A7%84%E5%88%92%2C%E6%B1%82%E8%BF%99%E4%B8%AA%E5%87%BD%E6%95%B0%E7%9A%84%E6%9C%80%E5%B0%8F%E5%80%BC+function+f+%3D+myfun%28x%29f+%3D+%28pi%2A%28x%283%29%2B2%29%2Ax%282%29%2Ax%281%29%5E2%29%2F4%3B%E8%BF%90%E8%A1%8C%E5%90%8E%E8%BF%94%E5%9B%9E%EF%BC%88%E7%BA%A6%E6%9D%9F%E5%9C%A8%E6%9C%80%E5%90%8E%E9%9D%A2%E6%9C%89%E5%86%99%EF%BC%89Warning%3ATrust-region-reflective+method+does+not+currently+solve+this+type+of+prob)
matlab 函数 fmincon求解非线性规划,求这个函数的最小值 function f = myfun(x)f = (pi*(x(3)+2)*x(2)*x(1)^2)/4;运行后返回(约束在最后面有写)Warning:Trust-region-reflective method does not currently solve this type of prob
matlab 函数 fmincon求解非线性规划,
求这个函数的最小值 function f = myfun(x)
f = (pi*(x(3)+2)*x(2)*x(1)^2)/4;
运行后返回(约束在最后面有写)
Warning:Trust-region-reflective method does not currently solve this type of problem,
using active-set (line search) instead.
> In fmincon at 439
Solver stopped prematurely.
fmincon stopped because it exceeded the function evaluation limit,
options.MaxFunEvals = 300 (the default value).
x =
4.0499
14.0013
1.0013
FVAL =
541.3289
说是这个trust……解不了这个问题,那么该怎么改一下?help过没发现怎么改……
非线性约束 function [c,ceq] = mycon(x)
k=1.6*(x(1)/x(2))^0.14; %曲度系数
F=13; %最大力
f=20.2416; %气门最大升程
G=8100; %切变模量
w=1500; %凸轮轴转速
c(1) =8*k*F*x(2)/(pi*x(1)^3)-51; %切应力
c(2) =((x(3)+2-0.5)+1.2*f)/x(2)-5.3 ; %稳定性约束
c(3) =((G*x(1)^4*1.2*f/(8*x(2)^3*x(3)))*8*k*x(2))/(pi*x(1)^3); %极限切应力?
c(4) =10*w-3.56*10^5*x(1)/(x(2)^2*x(3)) ; %无共振
ceq = [];
主函数 [x,FVAL] = fmincon(@myfun,[2.5; 21; 7],[4 -1 0;-18 1 0],[0;0],[],[],[2.2;16;3],[3.5;28;Inf],@mycon(x))
matlab 函数 fmincon求解非线性规划,求这个函数的最小值 function f = myfun(x)f = (pi*(x(3)+2)*x(2)*x(1)^2)/4;运行后返回(约束在最后面有写)Warning:Trust-region-reflective method does not currently solve this type of prob
主要问题:
1、关于Trust-region-reflective算法的警告
该类方法不适用于存在非线性约束的情况,所以用警告的方式提示你使用别的方法.如果不介意看到警告信息,直接忽略无妨;如果不想看到警告,主程序可以这样调用:
opt=optimset('Algorithm','active-set',);
x0=[2.5 21 7];
[x,FVAL] = fmincon(@myfun,x0,[4 -1 0;-18 1 0],[0;0],[],[],[2.2;16;3],[3.5;28;Inf],@mycon,opt)
2、程序现在最大的问题是,你给出的初始解不在可行域内,也就是说,不满足你的所有约束条件(很容易验证,不满足非线性不等式约束c(x)
关于信任域那个,见matlab帮助
use 'trust-region-reflective' when
applicable. Your problem must have: objective function includes gradient,
only bounds, or only linear equality constraints (but not bot...
全部展开
关于信任域那个,见matlab帮助
use 'trust-region-reflective' when
applicable. Your problem must have: objective function includes gradient,
only bounds, or only linear equality constraints (but not both).
在matlab help的Choosing a Solver部分。
有推荐使用。
你后面的程序好似也有不少问题。
收起