QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3739|回复: 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 =
    . F( m5 z; r2 W# M-2

    9 g: M# K% {) j$ {9 j1 L  d% |2 ~
    -1

    - X. s/ Y* Z% Z& ]$ J6 ~3 P
    3

    6 m3 w% e0 K5 K
    -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 =: U& e( b2 O1 Q+ X0 ?+ Y0 Z) A
    1
    6 h+ b" a1 }7 ?! s% b2 m2
    3 s8 R. |- \$ ]/ H4
    1 x- @/ u5 h4 O2 |5 _) d7 ^: @. k-1


    . \  ^5 v1 Y& _6 S$ y22 H' T3 A% u5 q* x
    3
    ) U7 C8 H1 t1 {* ^) ?-12 K# i. u& J. G8 I3 z2 I3 y1 G
    1

    % |) c) G: i5 m4 N) Q. y
    1' p! y+ m* q2 g0 n
    0
    5 A8 q) {& F6 A5 w: W, k# V1" R' N. K9 u+ l+ u! Q  S
    1


    2 [& n* d3 a, w+ K6 p* G9 c-1
    * i6 x) `" F# u. c* \, |  n03 R2 m1 ]+ c! f! T+ L4 `
    0
    ; {* [. F1 F: T* T0 n8 [0


    7 G+ t. z5 ]1 h7 L' c# g, E0
    * c' ]+ _4 i7 q; b. @( K  b4 }' R-1
    3 p$ V6 N8 t' P; m8 O$ A* C9 W0* S7 f3 E" c4 J- M
    0


    / P# V# g. R2 a% u1 G; K& x0
      x8 ]( }- S2 x# c0
    5 A3 \* J/ Y& i: U2 {# e: I-13 ]+ I0 x% E  m# l" D
    0


    ) N7 [0 H) T$ w: Q0. Q, @8 m4 |8 K- ^( _
    0
    ( x! K! q+ H# @8 i+ `2 \# N0
    ; H6 U. w' R- U5 {* |' {-1

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

    b =
    4 ~% i3 U8 E: o7 g5 M; L; l) {* e6

    , x6 P1 ^9 g. _* k
    12


    8 y" M+ u- G- R: U1 N4

    , [9 I3 s$ H  b- d: ^
    0


    1 \9 ~4 F4 Z$ ~. _  c# ]0


    # [# R3 t' `9 Q3 j. M0

    + @1 u4 U- K1 A1 v& e6 M( T
    0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =
    ! V/ t  Q1 D& \; m+ G+ i) ~0.0000

    $ b" _1 j9 L2 l" \
    2.6667

    9 F- H/ U- O! k, X
    -0.0000


    - O/ U3 f( J, M+ x. K  v7 ^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.

    2LINDO 程序说明程序名: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
    2 ~4 ?% Y# b  P6 C7 }/ T* ^) r9 Z; @# P!注释符号; 系统默认为自变量>0, 若不要求用free命令.

    2 m: s! v8 _3 x; p: ^
    !在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP
    ) S  b& q( Q6 @4 \" Q2


    , Q" {7 n# b' t. o/ dOBJECTIVE FUNCTION VALUE

    3 {7 v' Y' e+ q, N+ q+ r
    1)/ j+ O6 e; F% X, u. Z
    145.0000

    9 F  }1 j+ F( Q+ y: Y1 S! C% m2 y: A
    VARIABLE0 ~; t/ z3 i9 f. \# f5 S  q
    VALUE  o. d! [$ z4 ^) T* U/ O- \
    REDUCED COST


    3 h: T4 ]% v/ K  QX7 @5 I: Y0 w+ m  r2 @6 o
    10.000000
    / [4 `0 `8 Y% D0 T2 J/ ~0.000000


    " E4 y0 Q% O" c8 @9 UY
    ) i( \( o' |& g) p. r2 y3.000000' ?: y9 d& _2 W( l' n/ L
    0.000000

    ' i1 r3 V" L6 S6 d2 U0 D
    ROW
    " o+ [; J% I5 e# j: oSLACK OR SURPLUS$ v" ]5 B0 f; \- p1 c
    DUAL PRICES

    1 g$ c! Z# k. w5 _
    2)
    : w0 Q% N% S1 d0.000000: ?: V+ d/ v6 \% z. I
    2.500000


    $ s( S: s3 i+ c9 P3)7 S- o4 ], Q; u* n5 s1 Q- ?7 E) l
    9.000000
    % i3 a7 ], H# h3 @" b! N# s* `; M0.000000

    ; e- \2 {( _) ~0 ]7 u$ v6 F2 I" r& a4 b5 K
    4)! O9 v7 D8 y# \( }  d% D
    0.0000001 l. y7 U: \$ q0 `1 E* o# z
    7.500000


    ( p. C# v4 R; h% C+ H# `( oNO. ITERATIONS=
    4 |6 Z% L' {7 o3 }2

    ( b" ~# t# C( |/ S
    RANGES IN WHICH THE BASIS IS UNCHANGED:


    " b# i. O  ?* x; O4 COBJ COEFFICIENT RANGES


    " o; L/ N& F4 D: J8 }VARIABLE! B" B8 k- I' P5 _- x2 n/ z
    CURRENT, J5 P. L0 r  ~, t
    ALLOWABLE
    - b. A# b6 w7 d4 G9 oALLOWABLE


    3 z# Y7 L3 _5 \2 L; {. ~9 RCOEF
    ) z; m7 t/ v% i0 D& {; ~5 k4 c7 R, _6 OINCREASE6 E' B, v1 [$ y# `( W* n
    DECREASE

    % g' t( ^% L4 c* E& ~  V. s- h; W, U
    X
    , s- B) c( A! b, }10.000000
    ) ?+ A0 g. k( P; U' X( xINFINITY
    " v0 k9 C; c4 k2 O+ c2.500000


    + O0 g; K9 i+ AY& w( u" {2 U# P# s
    15.0000005 K) p# z6 q! ~9 L' L. P- \, ?
    5.0000006 x4 X) y* F' e2 Y! }* s
    15.000000

    * I  d+ p1 ^( B9 q) i) ]
    RIGHTHAND SIDE RANGES


    ; b/ _7 h) o0 ]* }- K' n# h$ BROW- j( t/ ?# f+ j1 N
    CURRENT
    , F6 x$ c- }$ n; u: ~( iALLOWABLE+ B+ N; |5 V. y7 A! o3 C- \
    ALLOWABLE

    ) r6 S" x& ?& o) @% A* B. y
    RHS) M* M5 }: w5 D  `6 N
    INCREASE* A, V3 Q3 }/ F- [2 ]4 ?* V: q+ y+ K
    DECREASE


    + V$ F% `  P) f" s
    $ Q8 ~; _! e+ V) G' N, a24 Z% r$ P' k1 ]; q9 X# S& r. H, a
    10.0000005 N5 `" w" `8 I3 G
    6.000000
    . h" w8 S1 D$ b. M8 `5 X10.000000


    " m1 k! B5 z6 b" L4 V35 M8 U/ P) q* g5 L
    12.000000- B9 U; g" a- J# z# R
    INFINITY3 M( e. E' g- ^5 }7 _" }% Z, X
    9.000000


      a$ t/ j2 d2 i: O1 z47 s( ^, [" m, w0 G8 h& y( ]5 I# d
    16.000000
    7 B3 w% t  g. X# U18.000000) L* K8 r! N# c8 F0 e
    6.000000

    3LINGO 程序说明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;

    按运行按钮在solution9 ?% {( R, H& B# Q" O
    report
    窗口得到以下结果:

    : i6 m8 Y& L, k; h" n
    Global optimal solution found at iteration:
    ' L; D: z. c8 v6 f: w2

    . O8 P2 d0 u+ a( r! C) h
    Objective value:+ E, ^, B+ D5 K, c- s+ x( M0 l
    7.750000


    $ b  N# A) S0 w, K6 IVariable+ ^' {% H1 ?* Y5 L; T
    Value
    ! p) A9 i, A) N# F3 o  `Reduced Cost

    " j6 T+ P& Q5 K- f
    X1
    - F, r5 Z$ Z+ w0.5000000; W9 R& m- b  o% W0 n: m$ F
    0.000000

    : c1 T: f7 i" d: }
    X3
    7 N1 v" Z; q5 d7 F- a0 `2 y" B0.2500000
    4 k0 f' q/ Y& l+ n& |2 L0.000000


    % e8 B; W7 _5 b0 E7 L4 R* Y% q$ E7 ?+ ]8 x7 V' L8 L
    X22 j9 j1 a9 M3 [! v' g
    0.000000; V4 q5 o: X- R! K
    0.5000000


      O% w6 V9 C9 F$ E$ HX4
      v, d+ r5 u, }* r! W$ ~% u0.000000
    2 {1 d' T; {3 l9 q( p3 j! w2.750000


    , K% l- b. Y, a! AX5. W5 C  b! ^8 L! {& u4 g
    0.000000
    " F5 P- L; i+ T% C2 B9 J0 ?7 h2.250000

    , L* r& h  ]! b7 W* w
    Row! s0 c, b, T7 ^  `' y5 ?, O) x2 g9 N7 b
    Slack or Surplus0 ?- I, }: j% T% G3 P+ g
    Dual Price

    7 {- S) I& d) h& Z
    1
    ( L: y5 X) _6 `# |& K7.750000' y" Z! l* J$ O! [: |( _
    -1.000000

    0 K( F6 T$ F# J+ G
    2
    ( s7 `% \. u! r8 ?7 Q( {" \0.000000! W+ x5 H! M$ {' A  h
    -2.750000

    4 h' ~$ d4 t* A
    3( a2 Q, J% j' U4 M0 Y
    0.0000007 s2 {: G3 C% _+ ~$ s  Q* k
    -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;
    - |% \! U3 W' o5 Y/ b1 j% X! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:4 D# M  a! q) |9 @( _# T
    2


    2 X( Y0 O! H( K' ~. n7 I! nObjective value:
    4 _4 k; G- _3 Y
    ( r. X4 g5 [- F- S3 M14500.00

    ( _) T1 V' _8 q+ L5 o
    Variable  x: |0 K/ r0 q! E8 K/ N  v  |
    Value
    $ H. |+ |# t: i; t( e. {Reduced Cost

    $ `; t. Y* H9 T" S/ }
    X
    ! L3 h' t$ w2 R100.0000
    8 _. y9 b, R' h. o2 h; A: Z/ B6 w0.000000


    5 L" o. n# A  d/ x5 NY
    " x0 l8 d* E1 d30.00000
    ( F3 ~, [' l/ b0.000000


    # D4 y5 C( V2 WRow
    9 j, S& D" Z1 C% hSlack or Surplus
    ; R0 s3 j, B5 GDual Price


    2 n! H- \- Y- b* d, D0 f3 I. t( h7 T1+ z' e+ R/ h% E- c, l9 A- z, |
    14500.00
    9 ?/ o7 a$ @/ q5 R' A1.000000


    " V& l7 |0 a) D4 G1 h2
    ' `# P, n0 _) m0.000000
    ( ^2 s: G( U4 k3 E25.00000

    2 X3 H4 L0 a" s( `
    3% c: ~# {. d" N2 c
    90.00000$ C) ?' q: A5 r/ C& y# R  s# N
    0.000000

    4! C5 b) n6 ~& e1 _% @4 t
    0.000000
    3 D1 I' I% M6 _! \% c# e2 |) z; M2 U; {- C
    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-6-16 21:12 , Processed in 0.468734 second(s), 60 queries .

    回顶部