QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3809|回复: 1
打印 上一主题 下一主题

运筹学第三版(刁在钧)光盘中的内容

[复制链接]
字体大小: 正常 放大
mnpfc 实名认证      会长俱乐部认证 

131

主题

38

听众

1万

积分

升级  0%

  • TA的每日心情
    开心
    2018-12-4 08:49
  • 签到天数: 282 天

    [LV.8]以坛为家I

    邮箱绑定达人 新人进步奖 最具活力勋章 风雨历程奖 元老勋章

    群组: 2010MCM

    群组: 数学建模

    群组: 中国矿业大学数学建模协会

    群组: 华中师大数模协会

    群组: Mathematica研究小组

    跳转到指定楼层
    1#
    发表于 2009-12-31 14:14 |只看该作者 |倒序浏览
    |招呼Ta 关注Ta |邮箱已经成功绑定
    第二章 线性规划

    本章, 我们介绍三种解决线性规划问题的软件:

    第一种: MATLAB软件中的optimization toolbox中的若干程序;

    第二种: LINDO软件;

    第三种: LINGO软件.

    1. MATLAB程序说明程序名: lprogram执行实例:

    file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image002.gif

    在命令窗口的程序执行过程和结果如下:

    the program is with the linear programming

    Please input the constraints number of the linear programming m=7

    m =7

    Please input the variant number of the linear programming n=4

    n =4

    Please input cost array of the objective function c(n)_T=[-2,-1,3,-5]'

    c =
    ( M" t* |. o1 E' w-2


      V# t. T6 s4 I! w. v-1


    ' w: L1 A6 T7 m. n3

    0 |, m) A& A& N( [+ L- ]% o
    -5

    Please input the coefficient matrix of the constraints A(m,n)=[1,2,4,-1;2,3,-1,1;

    1,0,1,1;-1,0,0,0;0,-1,0,0;0,0,-1,0;0,0,0,-1]

    A =# Z  A) L7 Z% C* a  L$ X. [4 s
    1
    * B& v' n8 Z( k. T1 m4 f/ ?* D% E24 B5 \4 X; L4 P1 k& J
    4
    7 q& S. G, V/ `, N-1

    ( d1 }( P& a# ?+ m  |/ W
    2
    / u& P1 W: y3 s8 |: W2 l# U/ K3  \) t" a) n3 q" g9 j
    -15 I0 m* Y0 d5 |" `0 T1 Y
    1


    ( b) [! S- z0 ~4 M1# D6 @1 S! y" U
    0
    3 ^$ ?3 D( C' W* ~* z# Q, j6 [1 `) J% G1( n; x6 h9 k" o0 ]7 N. P
    1

    8 N6 p1 W- w/ |* y; k
    -12 C% t9 \8 E/ n9 D/ h- m% {: ^
    0
    ) ^1 `1 H! V4 d0: H. K! [( j2 U
    0

    ; t/ {5 P6 e& `' O2 e) m) u
    0: J; _) j0 Y2 c
    -1) u; w: v. j( W0 U, p+ l: x4 G& R
    0
    2 K" W5 C' V- Q$ l7 S0

    2 ~! n; N2 X2 V
    0
    ! c( ]* Q$ d  r0 [+ B, z/ x: L0 c' H0+ I  C; h; g9 q. |+ x2 p( L3 Y: N
    -18 y6 ?" Z" y% P/ w7 T$ A
    0

      B7 Z5 K4 w, v3 C1 J1 L1 G5 g
    0
    & a+ b& k( Y0 u9 W; J04 }+ ~/ [# u, U$ C
    0
    ) e( e/ v" }6 `$ v-1

    Please input the resource array of the program b(m)_T=[6,12,4,0,0,0,0]'

    b =
    1 M7 e/ a9 {% D0 y4 b3 b6


    : E9 D( [1 D- C. b12

    9 h# k* U; V8 E6 B; @% w" S
    4


    # a  p9 L9 D: x& S( |% c0


    4 p+ {% `7 N% F0


    ! q  l9 h& w" J$ ], ]0


    ) x% O/ q+ \/ s* K& t! x0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =7 }0 a8 a# B# P7 b
    0.0000

    6 Z' U2 d5 x! |& u! c' p
    2.6667

    0 g8 z! b8 N# U5 p! I; e
    -0.0000

    $ x- T' n  O2 Z( T3 u
    4.0000

    The optimization value of the programming is:

    opt_value = -22.6667

    注: 红色字表示计算机的输出结果.

    程序的相关知识:

    Solve a linear programming problem

    file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image003.gif

    where f, x, b, beq, lb, and ub are vectors and A and Aeq are matrices.

    相关的语法:

    x = linprog(f,A,b,Aeq,beq)

    x = linprog(f,A,b,Aeq,beq,lb,ub)

    x = linprog(f,A,b,Aeq,beq,lb,ub,x0)

    x = linprog(f,A,b,Aeq,beq,lb,ub,x0,options)

    [x,fval] = linprog(...)

    [x,fval,exitflag] = linprog(...)

    [x,fval,exitflag,output] = linprog(...)

    [x,fval,exitflag,output,lambda] = linprog(...)

    解释:

    linprog solves linear programming problems.

    x = linprog(f,A,b) solves min f'*x such that A*x <= b.

    x = linprog(f,A,b,Aeq,beq) solves the problem above while additionally satisfying the equality constraints Aeq*x = beq. Set A=[] and b=[] if no inequalities exist.

    x = linprog(f,A,b,Aeq,beq,lb,ub) defines a set of lower and upper bounds on the design variables, x, so that the solution is always in the range lb <= x <= ub. Set Aeq=[] and beq=[] if no equalities exist.

    x = linprog(f,A,b,Aeq,beq,lb,ub,x0) sets the starting point to x0. This option is only available with the medium-scale algorithm (the LargeScale option is set to 'off' using optimset). The default large-scale algorithm and the **x algorithm ignore any starting point.

    x = linprog(f,A,b,Aeq,beq,lb,ub,x0,options) minimizes with the optimization options specified in the structure options. Use optimset to set these options.

    [x,fval] = linprog(...) returns the value of the objective function fun at the solution x: fval = f'*x.

    [x,lambda,exitflag] = linprog(...) returns a value exitflag that describes the exit condition.

    [x,lambda,exitflag,output] = linprog(...) returns a structure output that contains information about the optimization.

    [x,fval,exitflag,output,lambda] = linprog(...) returns a structure lambda whose fields contain the Lagrange multipliers at the solution x.

    2.LINDO 程序说明程序名:linear执行实例:

    file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image005.gif

    在命令窗口键入以下内容:

    max 10x+15y !也可以直接解决min问题

    subject to

    x<10

    y<12

    x+2y<16

    end! {; m9 z9 T/ y* a- }
    !注释符号; 系统默认为自变量>0, 若不要求用free命令.

    - p# B, ?# `9 F! {: k  h+ r
    !在出来report windows之前可选择显示对此规划进行灵敏度分析等

    按solve键, 在reports window中出现以下内容:

    LP OPTIMUM FOUND AT STEP! y* Q. d7 h( t; y3 G9 H
    2

    * L4 ^: r9 m7 e6 I
    OBJECTIVE FUNCTION VALUE

    5 ^6 b( i' d$ l( s0 y% [% v
    1)4 x, r3 {/ A" ?& E' |+ h/ S6 }
    145.0000


    ; E5 z' ^. @& H: a* h5 _0 s* WVARIABLE
    * ?! x( w' ]) Y# w4 O9 ?$ fVALUE3 t( l; f/ E8 {0 ~
    REDUCED COST

    + {4 n+ S0 i3 J
    X/ m  p! h- v1 E8 K( D4 {2 M/ J
    10.000000
    2 e" \' m  d8 }* _* r, ?/ l0.000000


    0 a, ^7 Q- P; G- uY2 g5 _% |1 v. b1 a& k6 ?
    3.0000003 U9 y3 `5 ~' E" a/ w9 A
    0.000000

    . A0 _; j6 |" W  g
    ROW
    , v' c- s, g( `% K/ `9 rSLACK OR SURPLUS
    ) g" y1 E' V0 p3 I% h( m. `DUAL PRICES

    3 a- [! }9 V+ B9 T
    2)
    # x- n% T8 c8 e/ ~2 P( `$ o2 l0.000000$ B2 Q/ J! e$ o! p& Q0 E3 ^- v
    2.500000

    $ x* {/ R3 t# b3 \. F
    3)
      g8 F' ^" I, e+ k$ C2 ]! q: y* h" {9.000000
    ! ^' P! H  F: [) D6 N0.000000


    8 R: u3 A% H1 D( D7 q5 ?. V4)/ M8 _: p" Z( p( r0 z% Z
    0.0000006 [" Y. D; w# p: B. R
    7.500000

    / H: {8 E4 K/ G: _. }
    NO. ITERATIONS=
    / e; o  B& [: ]2

    2 \& D1 k/ V: g% o1 S
    RANGES IN WHICH THE BASIS IS UNCHANGED:

    - Y' Q! h  E) C  K) H
    OBJ COEFFICIENT RANGES


    ) B6 p5 ?- s( @1 O) Z/ w7 ~VARIABLE! w2 _$ I) h" [/ W
    CURRENT
    7 f: q  p+ j3 ?+ ^$ PALLOWABLE* ?+ w& s6 _& \
    ALLOWABLE

    9 ~8 `# U! t! i' [+ P
    COEF: B) l( y8 _2 B
    INCREASE: e9 P! E* \9 }4 w& ~+ o& f
    DECREASE

    5 r; M' v' A" [- B! w/ ]
    X
    5 ^* j0 t% K/ ^7 j1 f10.0000003 Q9 q# J5 [  f+ b( o1 s
    INFINITY
    . I4 [* u$ \6 L2.500000


    ' V! x& T9 \% g4 \8 f! o) x; pY, G' s. Q# P. a2 O+ s
    15.000000
    9 p- @6 H& l  W$ j3 H8 \! l5.000000; v* H9 ?" w2 [4 \
    15.000000

    / o1 |4 s' Q) v& b/ u5 M
    RIGHTHAND SIDE RANGES


    0 o& E* o; B7 ~: }) k0 XROW- B' z6 R3 o; O4 j. g: _! B
    CURRENT
    $ l& r8 W' p1 L' N$ q0 @5 V* OALLOWABLE- y+ ~/ o) o6 y3 ^* f' F: U
    ALLOWABLE


    ) C( h: a# s3 [, P0 R# P% T( i8 sRHS8 r* k. Z$ {9 H+ e2 G( {
    INCREASE3 Y$ N) \) s: C2 @0 E0 j
    DECREASE


    " g8 N& Y6 j$ H4 c3 P6 t/ m9 `
    * z! k! Y7 M* O) Q  ]- K- ~8 B2
    1 t. I# m5 E3 @1 t" h10.000000
    % e6 r+ x* I/ v/ m1 b( z0 W' B6.0000001 B; J4 [4 g# }7 P% r
    10.000000

    ; D' H( C% n* @; c/ p% ~
    3# z  Q3 t% z2 {* ?' a
    12.000000
    # F. r! X8 u2 X8 @) u- I: e; k) Z, AINFINITY8 `( ^. A3 D7 I* m
    9.000000

    ' c1 z* d" X& k# K( F
    4
    : \$ z, }8 f3 ?& d2 J16.000000
    8 O8 _: i  K- _8 c) |$ p4 `18.000000
    ; Y6 t- M3 a2 m. K3 x6.000000

    3.LINGO 程序说明3.1 程序名: linearp1(求极小问题)linearp1运行实例:

    file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image007.gif

    在model window中输入以下语句:

    min=5*x1+21*x3;

    x1-x2+6*x3-x4=2;

    x1+x2+2*x3-x5=1;

    按运行按钮在solution
    % H' {8 C8 m: K/ A2 G9 [7 zreport
    窗口得到以下结果:


    : ~8 r) s, i3 I; p6 i) X; w9 |/ ~
    Global optimal solution found at iteration:
    1 G: x; ?* G, X& r) o) T5 g8 p, {2


    0 Z8 o: [/ Q0 C5 |Objective value:
    , q7 e; i  ]2 [4 I/ a* Y7.750000

    0 A4 J% A) w" H0 @- ?
    Variable
    9 E# i$ s' r( Q0 @' X! U7 }  ^& wValue
    ! ?6 B4 o& B, g1 ]* LReduced Cost

    : V9 L. _2 y, j' ?2 h! m4 N  o
    X12 f  J& k2 }" v3 u- R, R5 u- R. _
    0.5000000, z' m0 d! H9 ^! s
    0.000000

    & a! A9 u/ b* B! R+ S( l3 ^
    X3$ p. }+ H# T. d2 r; N& @% {4 v
    0.2500000
    ! J4 Y' \  W" T0 s0.000000


    $ A2 b8 \4 m) [8 }: V
    4 |- R0 s( \" k5 g! R2 cX2
    5 x3 ^* L4 j) |5 D8 y0.000000
    2 W; D1 T* }0 t0.5000000

    7 k1 w+ r1 R, {, z
    X4* R/ {+ _; W% p3 m& v( x7 ]. d
    0.000000
    * D3 n# S5 ~0 Z" [! W( y; O/ R( v2.750000

    ' p# b/ d7 c& D, E) N
    X5
    + O9 S, M$ @' ~  @- q0.0000009 Y' i& {5 ?, @( \- U* c) e
    2.250000

    3 b  h; W& K$ O! g& B6 h
    Row
    8 N& d" e, ?5 A1 K8 wSlack or Surplus  B0 a7 u3 I2 E5 p) ]; T5 i
    Dual Price


    ' {  E8 L8 N7 o% w1! n( q+ `( g: F' ~. E- \
    7.750000
    ! L' u8 {2 M# J  U& s-1.000000

    8 [8 g; C- h9 z
    27 Y  _+ ?+ i( k; w
    0.000000. \+ M7 D2 }1 `' ?+ C: x
    -2.750000

    4 q( ^4 M/ Z  U$ K( |: k% ]
    3% B2 Q: R- T, F
    0.0000006 I1 ~7 o; M2 Q
    -2.250000

    3.2 程序名: linearp2(求极大问题)linearp2运行实例:

    file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image009.gif

    在model window中输入以下语句:

    max=100*x+150*y;
    2 q, o% y) @- \& _5 [1 ~! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

    按运行按钮在solution report 窗口得到以下结果:

      Global optimal solution found at iteration:
    ; |3 Q/ p& j6 F0 r2


    , A1 X( L+ _) R/ {. n" P% zObjective value:
    2 z; `$ {2 w& R8 u% Y; d% R! J) h5 R4 E& x* k5 [9 A
    14500.00

    7 ]3 ]& X8 i* O/ Z' \* A# y. k
    Variable& q* f7 Q' T, W& c# p
    Value
    / `" L4 u3 U, zReduced Cost

    1 \4 K. z- M( a, P/ y; {
    X$ U+ x% i0 P+ w$ m5 d+ r- h1 ^7 Q
    100.0000
    5 x/ V, X, W- h9 ?- Y. m0 v% c0.000000


    ) V9 `/ [+ A. I$ O) x' ?: ]' IY2 U) V5 w4 t: u1 I5 n
    30.00000+ S/ C8 k# ^/ \! P
    0.000000


    % w' e+ C/ y* W2 F' O3 m6 F9 ~Row& Q! f7 r2 a# e5 ?$ a; A
    Slack or Surplus
    1 V4 i- ]. c3 E" d  S9 j; JDual Price


    & D3 ]2 z) u0 E9 v19 T9 H6 w$ C0 V  j$ u% s
    14500.006 u, ]: T' A2 O0 ?
    1.000000

    7 @) H& t) N' V3 P* X- X2 f
    2$ C/ l; `4 X! U6 G& _: ?5 A
    0.000000
    # B6 U/ c4 H6 m25.00000

    1 e5 `5 x' e% e' p, b
    3
    , \( [1 c5 B* ?: j- `" B3 e90.00000, i2 T! t  Q# |0 i' }/ Z7 g
    0.000000

    4
    5 u  d8 I6 t" l  k/ X$ q# P& m0.000000: H( R+ O5 K4 S; `1 k+ ~
    * \5 P9 M5 K& C/ i  a
    75.00000

    第二章 线性规划.doc

    62.5 KB, 下载次数: 14, 下载积分: 体力 -2 点

    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏1 支持支持0 反对反对0 微信微信
    loooog12 实名认证       

    1

    主题

    3

    听众

    412

    积分

    升级  37.33%

  • TA的每日心情
    衰
    2013-8-16 10:51
  • 签到天数: 1 天

    [LV.1]初来乍到

    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2026-10-18 03:17 , Processed in 2.816554 second(s), 60 queries .

    回顶部