第一范文网 - 专业文章范例文档资料分享平台

管理运筹实验报告

来源:用户分享 时间:2025/8/6 9:02:43 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

实验五:用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文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c6rbb58t36s4oweg0pisn_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top