管理运筹实验报告

2026/4/26 15:15:10

实验五:用MATLAB求解线性规划

2-10

c=[-3,-1,-4];

a = [6,3,5;3,4,5]; b=[45,30];

[x,fval]=linprog(c,a,b);

Exiting: One or more of the residuals, duality gap, or total relative error

has grown 100000 times greater than its minimum value so far:

the dual appears to be infeasible (and the primal unbounded). (The primal residual >x x =

1.0e+29 * -1.5497 -4.6492 4.6492

4-2

>> c=[-240,-1200,-700]; A=[1,1,1;0.5,0.5,0.5] B=[30000;20000]

[x,fval]=linprog(c,A,B) A =

1.0000 1.0000 1.0000 0.5000 0.5000 0.5000 B =

30000 20000

Exiting: One or more of the residuals, duality gap, or total relative error

has stalled:

the dual appears to be infeasible (and the primal unbounded). (The primal residual

1.0e+24 * -4.6326 4.6326 0.0000

fval =-4.4473e+27

实验六:非线性规划

5-4

>> f='2*x(1)^2+2*x(2)^2-4*x(1)+2*x(1)*x(2)-4*x(1)-6*x(2)'; x0=[1,1];

[x,f_min]=fminsearch(f,x0) x =

1.6667 0.6666 f_min =-8.6667

5-10

运用直接法编写程序:

h=[2,1,0;1,4,0;0,0,0]; f=[-6;-2;-12]; a=[-1,2,0]; b=[3];

aeq=[1,1,1]; beq=[2];

[x,value]=quadprog(h,f,a,b,aeq,beq,zeros(3,1))

结果即得:

Warning: Trust-region-reflective algorithm does not solve this type of problem, using active-set algorithm. For more help, see

Choosing the Algorithm in the documentation. > In quadprog at 371

Warning: Your current settings will run a different algorithm (interior-point-convex) in a future release. > In quadprog at 375 Optimization terminated. x =

0 0 2

value =

-24

5-12.

5-12

>> H=[2 0 0 0 ;0 1 0 0 ;0 0 0 0;0 0 0 0]; >> f=[0 0 0 0];

>>Aeq=[1 -1 1 0;-2 1 0 1]; >>beq=[2 1]; >>x0=[1;3;4;0]; >>lb=zeros(4,1); >>

[x,fval,exitflag,output,lambda]=quadprog(H,f,[],[],Aeq,beq,lb,[],x0)

The interior-point-convex algorithm does not accept an initial point. Ignoring X0.

Minimum found that satisfies the constraints.

Optimization completed because the objective function is non-decreasing in

feasible directions, to within the default value of the function tolerance,

and constraints are satisfied to within the default value of the constraint tolerance.

x =

0.0001 0.0002 2.0000 1.0001

fval =

2.4780e-08

exitflag =

1

output =

message: 'Minimum found that satisfies the constraints.

Optimization completed because the objective function is non-decrea...'

algorithm: 'interior-point-convex' firstorderopt: 2.5030e-08 constrviolation: 2.2204e-16 iterations: 9 cgiterations: []

lambda =

ineqlin: [0x1 double] eqlin: [2x1 double] lower: [4x1 double] upper: [4x1 double]

实验七:动态规划6-2


管理运筹实验报告.doc 将本文的Word文档下载到电脑
搜索更多关于: 管理运筹实验报告 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

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