QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3735|回复: 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 =
    0 w+ s6 Y# a9 R/ R# F" v-2


    2 C' H  {! M4 i" c-1

    , b& w; Y( H0 t2 ^8 U5 W
    3

    : T( Z5 H% b+ _- C+ M
    -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 =
    ; q; C9 Q* `" x5 E- P# v! @+ `  G1
    % W# C1 G8 i$ C- ~$ k; N' L2, {( d# d9 t! l3 W% H8 @4 h
    4! ~% C7 M6 a- j. Y
    -1

    " W( Z& ^- S5 F; s( j. J7 w% R
    2
    % \0 y/ w0 y9 [0 b8 @4 u; K3  F2 }# m& T* G+ u1 P# E
    -17 u. i1 t- H& ~
    1


    - N: b6 V8 `6 j, n4 D1) }/ |8 k" r- @2 z" k
    0' L  g3 e0 s% w% T( J
    1, O" C' V- j: a  k; y" E
    1

    : r4 t) Y. Q6 ]# a7 C7 h
    -1; w2 b+ ]& A3 }/ l
    0# w' }! r6 g% v$ w" B( p
    01 e- k$ R: m) Z( ~( H' ~
    0


    ) L3 Y* W. O7 P, E1 r3 K9 V: r( i0
    $ N7 r  i* P9 q8 [-1
    ) A8 t/ C6 b: `5 k) v+ Y9 r0  p- d- |& L( j8 J6 K' l6 x7 ?6 v
    0

    ' B: \# _( Y' [2 K! O3 Y- m
    0+ R( z% I. D- ?7 x% R7 \% A7 C! G
    0
    4 p3 Z4 n" g: N" r-12 @$ k; P* ?0 K5 O+ P' O1 h
    0


    ' Q; Q- |6 H1 C* u" h0 o0" a4 O6 \# K) _9 g- y' x; {
    05 l* h: e) i3 ^7 P. |* d
    0) z3 C1 k  I% Q5 F/ f
    -1

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

    b =: T* h; V3 x4 }( X' R2 X+ P5 v3 H
    6

    0 E/ B7 }8 l+ L4 ]' p0 {# a
    12


    & W! E  H4 Z2 u) ~7 L% {1 G4

    ; E* i0 x& @" b; Y) v6 r, U
    0


    2 H! u  I: _: t& O5 t; \; F0

    8 C6 t1 p; G" O9 n' {+ u) J2 I/ R# T- B
    0


    : e: H* k( F+ P4 |$ x6 [% {+ O5 J9 m; K0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =0 E* Z4 c( A, [$ h" F4 r
    0.0000


    ; Y2 H1 K  }+ N2.6667


    1 F8 {5 r( G8 j  N/ L# m8 ]-0.0000

    8 F- Y# l0 ^; r
    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- j; o9 ?4 N4 B, P& |9 e
    !注释符号; 系统默认为自变量>0, 若不要求用free命令.

    0 `3 R! G7 J' C  a) F: [
    !在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP
    . c) Z6 T$ B- k4 s$ W3 m2


    , A: H  o! M" z$ J7 cOBJECTIVE FUNCTION VALUE


    8 s: ]0 [* l$ M: h2 q0 i0 P1)
    # E* S4 `. p* _: H, _145.0000

    ) o8 P% N: o- h# ~
    VARIABLE& z: A2 S1 D9 b7 D. r* |$ G
    VALUE% P/ Q6 U% v& o
    REDUCED COST


    ; |' _9 r; N5 d" e4 Q. G* tX
    ; P. p% [' @3 q9 b7 _7 l2 o- _10.000000
    , S4 N4 J7 q3 q0 p1 i0.000000


    5 K$ _  u3 ]: |8 @0 D; V& Z& bY
    ; S( `- K- w: Y* c! E3.000000
    2 }9 A5 s) P( x1 d& ~: Z  x9 A* A0.000000


    1 K4 q' f* L$ [$ \! A9 cROW; i$ ~; \1 C: c( H( ?+ V9 L
    SLACK OR SURPLUS2 u7 L' w* t+ r3 w; b+ z
    DUAL PRICES


    # G9 T# E1 c$ a; ^2 X) Z, |2)# n8 ^2 U" O3 |/ Y3 J0 h+ u1 G; W
    0.000000
    # O6 }. L' Y4 r, m' d7 Z2.500000

    . y8 P3 u3 v1 F# x( P! r, p9 q
    3)
    7 Z( L) d7 U0 l$ l9.000000
    6 b! m, O# _1 o6 r. `4 ?# G0.000000

    0 v" u! a  N, a* P  C  d$ h5 w* `
    4)
    9 P& _- N9 v. f8 x$ [# Y$ L- c0.000000
    ; W' v6 J, }5 k6 s% E7 l7.500000


    * |$ f# \$ b8 t$ k5 B9 oNO. ITERATIONS=
    , [$ A6 R, G! ^0 h  R- p2

    $ {4 C9 U" Z% \7 a9 y' U
    RANGES IN WHICH THE BASIS IS UNCHANGED:


    - E! i* t! k; b7 U9 _OBJ COEFFICIENT RANGES

    ) |- C( m; q6 O( Y: W
    VARIABLE2 J# L) y5 z- p: r4 r
    CURRENT
    ' q2 N$ P1 ~9 `) M, ~/ nALLOWABLE. _4 v5 X, U) ?; `6 S# _
    ALLOWABLE

    ; L7 E. d! Q; q
    COEF
    $ X" v' {/ r: A& d+ [. Q- c9 n% v' CINCREASE! B0 F( S8 k" s) j" F  t
    DECREASE

    : ]' Q+ H5 Y% y$ t. b6 z- i
    X1 J; m# B; L6 E) c
    10.000000
    ) l0 ?! b2 H+ L( O& j* lINFINITY
    + E) w6 ~9 |% j: G  y- S. E2.500000


    7 o+ g, b- r8 h, t8 p6 TY  L5 [( X0 [( W6 b; E
    15.0000003 j8 D- I$ y6 M
    5.000000" F9 ]; r2 @& X4 ~3 e4 J. G: ~
    15.000000


    2 F4 X. L) G  _( \$ m  NRIGHTHAND SIDE RANGES


    : K) ^7 A. o( `ROW
    4 q$ q# ~2 i+ T& g/ Y. CCURRENT3 _2 X* h  q7 o* _
    ALLOWABLE
    5 m3 o/ h7 `) S. lALLOWABLE

    9 ]  ~* ?/ L  O6 C. s
    RHS8 w) J/ X( D: Z3 K2 Y
    INCREASE
      U5 {/ B, l+ n4 t5 a" zDECREASE

    & |0 u3 v4 B5 ~: g2 a

    - `+ k* \, C4 r1 o# U+ U2
    / k2 z$ s7 D* E' K: K% [; b+ |* [10.000000
    ( I; J. x8 s" a0 {6.0000002 q4 _+ \6 u1 j/ d% P
    10.000000

    7 S+ J  r! _* b. x8 Y8 k
    34 n$ g. u7 `* I: s4 o! I
    12.0000001 x" I' O& t/ z% x# v; [
    INFINITY
    4 O) d- |0 |+ M6 S. M4 X9.000000

    & _0 `) {& R2 }: s% j
    4# K, \4 l* P  g( f" @
    16.0000007 j( `: ~" S" q
    18.0000000 Q8 a& i" J/ v3 X! U2 L5 q
    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;

    按运行按钮在solution
    , }- _0 j# y  E% ereport
    窗口得到以下结果:


    ) }2 Q- ]0 s; j4 o
    Global optimal solution found at iteration:
    3 i& Q+ j+ \. t; x& O* x6 M2


    ( E" Y2 ?/ V' KObjective value:6 w3 Z: c/ u+ s! F& s" \  [
    7.750000


    ; f) C+ W% m$ g: q2 ]+ ^/ _Variable% ]& V# ?) z3 s' H
    Value
    $ q8 B& A1 l. Y$ a& _6 p0 {Reduced Cost


    % p7 u. L, Q8 Y: U6 ~3 u3 u3 {3 T  bX1
    # Y* L5 O% ?$ o$ l  k0.5000000
    / `6 Q) o, `7 Z6 n  J0 K: e' U% v0.000000


    , T1 e) n* E, |X3
    0 ?4 V: b% }  U" v4 {5 H6 Q) e! q# B0.2500000
    ; r1 O! t. q9 N$ f, \0 c; c; k0.000000

    : {+ _0 C8 k, T" n
    1 \6 N( l/ P& t4 m  k9 z
    X2
    % ]9 f. g. ^$ D0.000000" p2 s, b5 z' k) r
    0.5000000


    % V# i3 v) r$ z! A0 s% v, LX45 `3 o4 V6 B% M1 A" _4 S
    0.000000
    , [/ {3 Z4 ~% ^0 N3 O1 w2.750000


      s) ]5 i4 S, t  O9 n- Y8 |. FX5
    3 `$ ~) _6 Z/ D# G1 z7 N( C0.000000+ u- J8 ?+ J5 R( ^: H' ]9 s
    2.250000


    & \" q7 v7 Q; N5 {  S& vRow: g7 P' m( i4 s
    Slack or Surplus, g. f' @' x- ]/ E
    Dual Price


    + D, A: s! ]8 M; J( F& {1
    % R# @& i! S) Y5 O/ l7.750000
    & ^( X6 e% s. k& M8 Y: l( n" c-1.000000

      p: O6 f! @5 Y2 P- |0 E8 I7 P8 K
    21 t7 M  R$ q- m& I6 q0 F2 I; P% J. O
    0.000000
    $ J; D" j. V7 A* |4 m7 q-2.750000

    " ?$ Z7 U& G4 {5 u- J8 X
    3
    5 h% d. {6 W  J" E, R0 `' `0.000000
    2 W3 ?4 |: t1 L$ L-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;4 ~0 D1 z- c( A$ i
    ! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:
    & }' S, N4 ?" a% `* N3 }# o2


    + b' ~% R1 \( E9 z" ]" ^+ C3 R  M1 B, GObjective value:- M. k8 i7 ^0 K& M$ M1 [. J  M; m
    0 [7 J+ `4 U; Q
    14500.00

    , r; E0 A4 l* R: b& D) j% }+ ]
    Variable
    4 H9 g2 [6 i  hValue" Z+ `* A+ S* V8 {2 W* S+ o
    Reduced Cost

    1 ~# f% B% u& k% g. C
    X/ b( C5 ~) G6 p6 m9 X! n
    100.0000
    " W$ ?1 U$ t4 f$ L) @, W2 H  l0.000000

    5 }5 ?( m1 X! ^8 j* n3 Y' H
    Y
    : |- ]( S8 w2 N# H! h30.00000
    & Q, _( N5 f% @* |: z* v0.000000


    & {- s& W! J' n8 z" N- ?  {1 FRow
    - J* H0 }: r/ X! A% m4 lSlack or Surplus
    * w, M! r  D5 uDual Price


    ! z( o& R* S% |, Z/ @7 F, h11 [9 `; x0 @- W8 N) \3 C
    14500.006 e0 r7 \% v/ ]# c( j# m: x' x) [/ i
    1.000000

    5 d1 L0 k! c& m
    2
    . L& ]8 j9 m3 m( u0.000000
    9 \9 m3 `0 @8 y' s) S25.00000

    5 z$ z( \; w; X% G6 U  Q" u2 L
    3" m: |' i  l; D* r- O
    90.00000' y& m; B* v2 ^8 H- c0 F
    0.000000

    4" Y8 L2 O) B) H0 G+ B$ \) K0 C, K% D
    0.000000
    " H9 V. {- j- q+ D
    ( Z- {+ A4 [- x' C" j( D' g% t75.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 03:04 , Processed in 0.420785 second(s), 60 queries .

    回顶部