用MATLAB解二次型规划和一般非线性规划问题

2020-04-17 05:40

实验报告11

实验名称:用MATLAB解二次型规划和一般非线性规划问题

实验目的:学会如何运用MATLAB解二次型规划和一般非线性规划问题; 实验内容:

书P211

11、试求解下面的二次型规划问题。

min2x1?4x1x2?4x2?6x1?3x2

?x1?x2?3?xs.t.?4x1?x2?9

?x?0?1,2解:

>> f=[-6,-3];H=[4,-4;-4,8];

>> A=[1,1;4,1];B=[3,9];Aeq=[];Beq=[];xm=zeros(2,1); >> [x,f_opt]=quadprog(H,f,A,B,Aeq,Beq,xm,[],[])

Warning: Your Hessian is not symmetric. Resetting H=(H+H')/2. > In quadprog at 232

Warning: Large-scale method does not currently solve this problem formulation, using medium-scale method instead. > In quadprog at 263 Optimization terminated. x =

1.9500 1.0500

f_opt =

-11.0250

12、试求解下面的非线性规划问题。

22minex14x1?2x2?4x1x2?2x2?1

?22?

x1?x2?0???xx?x?x?1.5?xs.t.?1212

x1x2??10????10?x1,x2?10解:

function [c,ceq]=cdd01(x)

c=[x(1)+x(2);x(1)*x(2)-x(1)-x(2)+1.5;-x(1)*x(2)-10];ceq=[];

>> y=@(x)exp(x(1))*(4*x(1)*x(1)+2*x(2)*x(2)+4*x(1)*x(2)+2*x(2)+1); x0=[1;1];xm=[-10;-10];xM=[10;10];A=[];B=[];Aeq=[];Beq=[]; [x,f_opt,c,d]=fmincon(y,x0,A,B,Aeq,Beq,xm,xM,@cdd01)

Warning: Trust-region-reflective method does not currently solve this type of problem, using active-set (line search) instead. > In fmincon at 422

Maximum number of function evaluations exceeded; increase OPTIONS.MaxFunEvals. x =

3.1740 -7.9967

f_opt =

1.2351e+003 c =

0 d =

iterations: 54 funcCount: 201 lssteplength: 1

stepsize: 5.6428

algorithm: 'medium-scale: SQP, Quasi-Newton, line-search' firstorderopt: 390.0759 constrviolation: 1.7857e-008 message: [1x79 char]

15、试求解下面的0-1线性规划问题

>> f=[5,7,10,3,1]

>> A=[-1,1,-5,-1,4;2,-6,3,2,-2;0,-2,2,-1,-1] >> B=[-2;0;1]

>> x_m=[0,0,0,0,0] >> x_M=[1,1,1,1,1]

>> x=bintprog(f,A,B,[],[],x_m,x_M) x =

0 1 1 0 0


用MATLAB解二次型规划和一般非线性规划问题.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:(2019新人教版)统编版一年级上册道德与法治15《快乐过新年》第

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: