QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3811|回复: 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 =- |3 T& w0 X9 {" e7 P
    -2

    . K" A: F- L: I) a4 B
    -1

    ; D9 l2 h2 P- H9 d
    3

    ) D2 P: Q& s: l  X
    -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 =
    $ \( T# ~, K- q$ ^1
    6 C+ h1 [3 T3 Y! u% z2) _) T. B' u+ Q( m: Y3 S
    4
    ! I- P/ j( ]2 a8 L8 [# K-1

    ' {: ~: g& M) G
    28 R- u- T  ], P/ t+ c
    3
    % \0 p( q& T) S* ?. u  O7 J* `-10 }0 u& {$ e, I7 O
    1

    9 h9 c0 P3 b+ M" }' a' ?7 l1 U
    1
    9 i# x; l  L; a! i& i9 o0
    " W+ c# P* Z" k( i# L% D5 h) V6 a1
    . s, I9 h- `. }5 G1


    0 j  Q* [- d2 B. ~6 t-1( x" \8 C; q1 x6 @
    02 P& F! _1 a& a" E
    0- k; T: e& k& d& R3 f. B
    0


    ( v0 n, g7 E; _+ O9 E0
    ( M1 y5 o, M. F6 L6 p/ A-1
    8 B4 r& J+ C- D$ {0. Y9 i2 w9 T$ y1 j3 K, }
    0

    , j6 y, @7 _3 k8 b2 d1 x! S4 R
    0! v+ t7 W  V% U
    05 i4 S" G* v0 P* |2 y6 z& Y
    -1
    " \5 q/ M5 t; \7 A0 V. ]0

    5 ^- Z6 {. p; L) L  j
    0
      E" |& ~  D& n1 i6 R! H# v" G0 t0* Y, U0 f( ~( E
    06 a9 ?- O  w- Q; L" e: ~
    -1

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

    b =& P4 g8 j5 {* N: P$ R
    6


      I: [" P7 B  B" o9 }/ L12

    8 I# e. q2 X3 }1 {5 v
    4


    8 ~% _* W2 k$ c0


    6 ]: `3 S8 X3 g0


    1 n% d  u1 R: U9 O1 E0


    8 j* m' W2 ~" F6 {: P! Z; q: i0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =5 A, w" B( {% q2 F  g2 C% H
    0.0000

    . l& w) j1 Y' j) z: O" n& d7 H, I9 ]
    2.6667

    . u) U" a; h/ n2 M5 U( R
    -0.0000

    % u/ p* c. J( o/ H
    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
    ! Q- e( Y9 _# v3 I!注释符号; 系统默认为自变量>0, 若不要求用free命令.


    ( D5 v7 X% f, s8 g2 z( i6 Y% v!在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP8 C: Y# l5 t. n1 V% S4 R
    2


    8 p! k1 H3 ]+ @# d8 ]OBJECTIVE FUNCTION VALUE


    ' y9 x8 `% y7 {, i! t4 S1)
    $ O; O% J+ f* e8 T8 M2 C2 t145.0000


    ' T/ ]$ ^7 f' n7 AVARIABLE
    ( N* _7 V; s! |- v) e* UVALUE
    6 T5 @3 X8 n0 ]5 P: S+ y6 XREDUCED COST

    + d: j3 ^2 M- k1 L; ^9 Y2 W
    X5 p3 k  D; _# K+ z' X8 d
    10.000000
    ) m: ?+ c" r5 a# H( d: f0.000000


    6 }: B2 n/ y) p6 l1 t6 UY
    8 b3 P! M0 D* v5 F  C9 l% [, p- \3.000000
    $ x" s* [8 l% J0 z( L0.000000


    . `5 R+ [% M% j" |" wROW. p% O# T3 `& q$ A& t* H. B" v
    SLACK OR SURPLUS" e- _5 {' v! ?
    DUAL PRICES


    0 u% D7 v! ]; O- d: x. m/ U2)9 J+ V# }+ q) f+ ?& s
    0.000000
    0 g& p9 p/ D: V, o& u$ ^  c2.500000

    ; o1 n  P% r* A( X7 r
    3)
    ! a3 C. d6 a, n/ o" i9.0000004 ^' b. m( m8 }6 @/ G7 U
    0.000000


    $ i+ `4 n" i+ \4)
    ; G9 S' f8 V' ?& N; Y0.000000
    $ ~3 C6 c# X) b, O; d9 b# L3 y" A8 f7.500000

    / T, H1 I  `4 @3 b) n
    NO. ITERATIONS=
    & v# x" w+ P0 N, i3 a' F2

    # e' N; o+ d6 V. D" H7 N
    RANGES IN WHICH THE BASIS IS UNCHANGED:

    ; ~. F$ T9 p) s, S) H4 G
    OBJ COEFFICIENT RANGES

    - C& B6 @2 q0 g( }
    VARIABLE
    # h% A0 Z1 I  p! a3 q) p4 U( yCURRENT
    # |6 K2 e+ c/ |4 g! o' w7 bALLOWABLE
    1 y+ }4 W% _/ tALLOWABLE


    ; O! D9 v+ I( g! I: _: ]- n- i8 XCOEF
    ! a: q8 U* T5 w! [- c' ]INCREASE
    + r9 a, y1 }  B9 s" l$ DDECREASE

      e/ s8 D* j/ R) B
    X# J! f- ?  G& j. e1 D  P& p* u7 J
    10.000000" K. g! O4 m9 `2 [( L8 V* R
    INFINITY
    + N( i4 B1 [. d3 L4 E4 s9 i2.500000


    8 h" I4 m6 U) A$ j4 z# qY9 e: \! L% z, o% Z2 X. p
    15.0000000 M/ ?9 t" _) j  L1 ^' `
    5.000000& _. v+ X9 P! ^7 x5 O
    15.000000


    # z7 U+ w  {% r- t8 FRIGHTHAND SIDE RANGES

    . P: ~6 b6 }% Y$ c
    ROW
    ) B3 @# [+ V+ A) P8 N3 a2 pCURRENT
    # y, J4 u6 G. S- yALLOWABLE# ^; t/ x- T( @- C: \
    ALLOWABLE


      s, U4 f; ~4 {9 P% ^RHS, W# K+ k/ r; ^! c9 K& ?' H5 e
    INCREASE
    3 {1 \$ _* K2 IDECREASE

    : B8 f1 Q. F, B0 r1 y9 V7 R
    , ]+ b% P7 K2 C/ i1 T4 ?# X( W
    2) G9 z9 D: n" I+ f8 h
    10.0000002 k. Y4 ], Y! Q% [* V
    6.000000
    8 p% I7 n( a. M0 k  T; V3 d10.000000


    % @( X8 f& K# u  f+ }3: @' g3 W& w4 M. W' k- O, Q7 N& e
    12.000000  U8 f& [: i/ ~2 k8 S- f7 ^% |
    INFINITY0 M$ H) T$ m7 w$ }7 b) X' c& a
    9.000000


    , R) l$ Q5 ]- q2 S5 _4
    4 g0 Q" g/ Q3 ~' `. M7 i4 \16.000000
    6 J* i$ t7 f% b4 J2 |18.000000
    5 w; c& s* Z1 |6.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( Q) s1 ?% M; J% L" A9 b. _0 |
    report
    窗口得到以下结果:


    ; s; C7 k4 O9 P- z
    Global optimal solution found at iteration:
    $ Y2 N) {3 G2 C  d& D* O6 ^$ k2

    * {. w( W& J6 A0 L0 ], e, c8 \
    Objective value:
    & ^9 l# Y( k: q2 E- h7.750000

    0 O6 \% I, [; X2 y& b/ ^; x* d* M
    Variable: M( \2 v, p% n+ t, B; c7 c8 J: y
    Value
    9 J& U6 z# u6 b8 I6 \! sReduced Cost


    7 ]! ~) ^4 _$ Y2 }: QX1
    , X3 T5 Y* j7 U3 g0.5000000/ l) L* Z1 S( `& x, l3 d6 t( U
    0.000000


    2 h! T" E8 g  z! G; z. oX3+ o3 x6 y3 F# l6 w! c- q7 J
    0.2500000
    ) F8 J' v: ^" ?! c5 l; i) E& g0.000000


    * Z# J0 \- I5 ~5 U8 T: i  C3 U; e1 f
    X2: o. D8 A% \* p0 P% @9 p% x( C! `
    0.000000
    * r6 {  H2 N+ j: z0.5000000

    0 h' I$ o  |+ I. C
    X4
    2 ?" z% ?) F  _0.000000  [5 a2 e  c0 X7 O1 v: L5 s9 u- X# N( k
    2.750000

    & @- P3 T: C2 h7 N1 {
    X5
    . x! n; i  M* ~6 r' t8 @( b0.0000007 A* a. P% V! n  N
    2.250000


    + m9 ?* l5 F. Q, g9 q! C- tRow
    2 p% A* k0 ~8 A$ d) ~Slack or Surplus
    7 J1 j8 s1 G5 _( C2 {5 A2 c" mDual Price


    , X, g; j+ o  T$ ]- R& u" B1
    : z$ i4 O! o0 M; d; ^" W/ @  I7.750000
    5 ^1 A9 a/ C; R& v- H0 E-1.000000

    $ ]6 U3 W9 {% Z& @$ h
    2
    ' r% Y  t9 \0 N9 w1 L: l/ P0.000000
    9 P+ T' l+ i* k- x/ e' O-2.750000

    ' `% O  f/ v! r. E
    3
    & @( M% M. Z& b+ e9 ?& b6 [0 F0.0000002 C: J* `: k* A0 F7 d
    -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;& u& t8 L  Q7 D0 _; i
    ! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:
    1 ^+ y3 S. q  ^; h( N( _) B2


    1 f- P% H& }# C; b5 c. i( MObjective value:5 l8 n# N: b2 u) J' M, h5 F& `

    & i( Y# i5 |4 X  P14500.00


    % h$ G8 t. c- J$ B* W1 m% |0 yVariable6 z' M# r1 B6 j$ Q
    Value
    9 m5 f9 O9 n/ mReduced Cost


      R7 c0 V+ {8 hX/ w) @8 {1 J; k' ~& S7 I, E/ e! s, a
    100.0000
    9 j. T1 S: v4 j0.000000


    ; L: U8 z' j1 }& GY; g4 V! C6 i7 m4 p! x- x6 k
    30.00000! h6 m, C6 U4 z9 ^
    0.000000

    9 x* [) H6 E2 Z6 p$ l" H' g
    Row
    ! o+ F1 N2 F. z: D' w; PSlack or Surplus
    6 _# n; v. e  |$ JDual Price

    9 M& n/ e$ Q9 J2 K( ?
    19 N' i$ P# O& A( _5 `; G
    14500.004 x- Z2 p0 X. I  _. {
    1.000000

    1 S2 `' L* O: M" f8 F1 j" R( q
    2$ G' G! x; m" |# N& T
    0.000000
      ], B, y7 v9 W3 {& M, N0 N5 E25.00000

    1 F% r, g) @: I5 q" q
    39 G7 Q' d& ?0 A& @6 K4 U8 k1 W
    90.000008 e8 ]* _1 Z$ v) g9 U, F
    0.000000

    4
    5 m( c7 z/ W, F* h6 Y& C1 e0.000000
    6 d. R# W  L" `( l( v$ {# R. i9 m
    6 W9 Q1 g$ x" W$ ?7 O6 |' I9 H75.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 09:10 , Processed in 1.912168 second(s), 60 queries .

    回顶部