《线性优化问题》word版.doc
《《线性优化问题》word版.doc》由会员分享,可在线阅读,更多相关《《线性优化问题》word版.doc(3页珍藏版)》请在装配图网上搜索。
调用函数 linprog 使用格式 [x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb,ub,x0,options) 求 min z=f x 限制条件 Ax<=b Aeq x= beq lb<=x<=ub x0 为开始运算的初始值 x 为最优解时x的值 fval 为 z 的最优值 exitflag 判断算法停止的原因 成功 1 找到约束条件下的最优解 失败 0 迭代次数达到最大,表示不能再继续寻找最优解 -2 可行解没有找到 -3 问题没有定义边界 -4 Nan的存在导致算法没法进 -5 原始对偶问题没有可行解 -7 算法搜索方向存在问题 output algorithm 采用的算法 cgiterations 设置变化梯度矩阵迭代次数(只用于大型算法) iterations 迭代次数 message 退出的信息 lambda f=[-2;-1;1]; A=[1 4 -1;2 -2 1]; b=[4,12]; Aeq=[1 1 2]; beq=6; lb=zeros(3,1); x0=[0;0;0]; options=optimset(largescale,on,display,iter,tolfun,1e-3); [x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb,[],x0,options) 结果 Warning: Large scale (interior point) algorithm uses a built-in starting point; ignoring user-supplied X0. > In linprog at 249 In xianxinyouhua at 9 Residuals: Primal Dual Duality Total Infeas Infeas Gap Rel A*x-b A*y+z-f x*z Error --------------------------------------------------- Iter 0: 6.61e+002 7.16e+000 1.35e+003 2.00e+002 Iter 1: 4.29e+001 7.02e-016 1.28e+002 3.06e+000 Iter 2: 5.10e-015 4.58e-016 2.27e+001 1.13e+000 Iter 3: 3.08e-015 8.48e-015 1.10e+001 1.06e+000 Iter 4: 9.89e-013 4.97e-016 2.62e+000 2.42e-001 Iter 5: 9.57e-015 6.84e-014 1.44e-001 1.65e-002 Iter 6: 5.10e-015 9.93e-016 1.20e-005 1.38e-006 Optimization terminated. x = 4.6667 0.0000 0.6667 fval = -8.6667 exitflag = 1 output = iterations: 6 algorithm: large-scale: interior point cgiterations: 0 message: Optimization terminated. constrviolation: 3.5527e-015 firstorderopt: 4.3452e-006 lambda = ineqlin: [2x1 double] eqlin: 0.3333 upper: [3x1 double] lower: [3x1 double]- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 线性优化问题 线性 优化 问题 word

链接地址:https://www.zhuangpeitu.com/p-7889339.html