QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3779|回复: 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 =
    + T, i8 E7 n: A+ ~! G-2

    7 I' t) S+ U9 e! t: t$ f, D% W
    -1


    3 W$ w6 L( A3 t- g7 A9 Y3


    3 U- b: m- l- R1 v! d1 L-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 =
    ' _. M! c& _  G6 S7 p6 ]& j( [% _- o1- o' I/ z: z, X- `' J0 T% R: |
    2
    7 |3 M+ p2 p5 x! F4 _7 t2 Y% G4
    . o2 O0 L- b  G$ |( N-1


    ! k- b5 J1 x; P& q* N# _3 @2; W2 u+ I& e% i. l
    31 E" ^" j2 f) O/ k
    -1$ C. x& u$ `( Y: z/ h1 ?8 E* r
    1

    % V; m6 K- }: e2 r
    1
      A$ ]9 s+ X. s0: e) o, y' r- H2 k( J& ~- H" m
    1
    * q- {. ~" o5 Y1 K3 |  C  R' G/ ^9 z1


    6 G* ^/ n' P+ j2 R# ^+ f' [-1; a* y# C/ p1 L; M5 U: H; L
    0* ]) Z! J/ R1 r% c& T
    0
    0 g6 ^: g( B, L: n2 b3 t* |0

    / I' L5 z- ?2 C3 b& J2 ~' ^3 D
    0: B* `" K* H' A/ M
    -1
    1 S, Y' Q. E0 s+ Z0
    / Z$ |0 I# d- k, }; e0


      ]$ `, _; ^/ r! k0
    # g: A4 K( k( A+ W8 J8 n( [' E. ?04 }( C6 M% T0 D" L
    -1
    : D7 `* B2 Z6 X6 Z0


    : t: n; F6 C! d0
    ' m& p8 M, h; B/ u, p! G  e8 R0! q: I* z5 `5 l# a2 s( T4 E/ |% b
    04 n2 S& k; q5 Y& h! K6 l
    -1

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

    b =' C' k" V' F& z2 X
    6


    - v) Y4 I) o4 _# r! Z12

    * J6 ^8 n" j7 }/ }- U) }
    4


    ; l; S" @( Y! V( ?& a- t  |0


    0 P6 X* `4 }/ I/ o( w, r0 p! ]! E0

    0 N0 @0 ?7 A& K" m, {2 P5 o
    0


    , _& @. w- X$ s. }0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =
    : I# @) l( M% J" g  I0.0000


    4 X. E4 Q# w% Z9 J+ Y2.6667

    ! l' @4 ^, I7 s) t2 K
    -0.0000


    & O5 _$ ~+ v2 ?! c( c4.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) K2 W$ N9 q5 Y4 E8 R! i
    !注释符号; 系统默认为自变量>0, 若不要求用free命令.


    / K% A* k$ ~% m$ @!在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP
    * K: K( b3 B9 e+ b6 C2


    ) d5 v. C4 e, Z* t, p9 I' COBJECTIVE FUNCTION VALUE


    1 h4 e5 C# L- Z4 N4 q1 E5 e- o1)
    * E% j: O4 K* M$ n145.0000


    / p2 ]& k) z' c+ I, [# C' r2 KVARIABLE
    ; W7 v  \& n* ]8 z; aVALUE
    8 @6 f( z# J0 k/ h- `REDUCED COST


      d$ o5 S8 N0 ^1 i7 B7 ]X) c8 ]. d% p* Y" d
    10.000000
    0 I& o% g4 w0 |5 ^$ n0 h, ?0.000000

    - {' q* c% ~! ]$ ~& r
    Y3 p' D4 E) u; w1 n+ m
    3.000000
    ; ~# j/ `3 N' M# q5 G, I" l0.000000

    % G) T9 Y6 J0 J4 P9 p
    ROW( d; _- Z8 r8 C/ c$ V1 J
    SLACK OR SURPLUS
    0 }5 d+ |. p7 D+ |* lDUAL PRICES


    * V3 p3 i/ s/ i* {/ g) Z2); `9 |+ |2 H! }0 W
    0.000000+ l5 w( ]* S9 R" k- f
    2.500000

    $ f, N5 P) G' t, y
    3)9 Q: y6 h  E$ y
    9.000000+ T$ R) j" U2 ^  ~
    0.000000

    7 y* M. N0 T& b. i5 O" r, g8 X6 v
    4)
    ! A8 @- e4 o2 p0 d1 f0.000000( R* r9 c+ v) C
    7.500000

    3 h+ ?4 Q4 H0 c0 q7 D' t! C
    NO. ITERATIONS=
    3 X, R: V% D1 F4 w, q* v% Y3 {2


    " x* b& I& w+ u/ b: X- CRANGES IN WHICH THE BASIS IS UNCHANGED:

    , K5 c. W1 I8 o/ _9 V
    OBJ COEFFICIENT RANGES


    # R/ a* O) B' B- kVARIABLE
    0 H8 V: E( A& _* r8 S% t. j: e/ GCURRENT3 y! W+ Z9 P9 s6 q: R
    ALLOWABLE$ s; p1 r: z( [$ n/ r; p
    ALLOWABLE

    1 m( _; i# Y0 V4 b6 o4 G8 a. ^. o
    COEF
    4 u! Y6 r( A. o1 M+ zINCREASE. Y7 u/ L: @/ D
    DECREASE

    5 v& y9 b8 O) A; }9 O
    X" I6 M% T+ F! B- O$ a1 b# p
    10.000000
    . G2 A( G' y" y  l) P, aINFINITY
    0 m( o: l( j( U+ o) G8 C2.500000

    2 Y8 f4 ]. q5 J
    Y8 t1 B( n7 C" g
    15.000000
    . w4 B* U7 \4 H5.000000
    , H) x, n  ]) Q2 j7 @15.000000


    3 a4 p1 F. P- H  `RIGHTHAND SIDE RANGES

    3 B7 G; P' D9 r
    ROW- e. p) a2 f4 x# V9 i# o( [  A1 y
    CURRENT
    2 ?/ i% J; ^" Z9 N7 v8 C! L6 V" k  NALLOWABLE0 i: ?9 ~1 q* q& }6 f" ~
    ALLOWABLE


    - [! W. R. F3 h3 d- pRHS
    8 x) d+ X0 K/ S  aINCREASE' R8 z7 [3 ^+ v8 U# [9 D5 _
    DECREASE


    4 C" Q- {6 a  U, C) `  h. T3 j
    " t# J+ {7 o- d) H" {& {2) y  K: S/ O9 Z
    10.000000% \6 d: R/ ?- t9 r0 O( |
    6.0000001 _; ?: s* N" N" s
    10.000000

    5 V5 K2 A; N2 @% ?6 ^! @
    3" r  l  A$ M1 s# M
    12.0000006 `# R5 z6 L! z& B1 A" W- y
    INFINITY( z/ O2 _- q# a. B5 q% `
    9.000000


    # K4 n) B0 h- w% E42 r/ A  V5 N! p" C1 O
    16.000000( c  n* z- j) N" P8 U
    18.000000
    * G( j% q3 v  z9 q6 h6.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
    3 M$ W+ X/ G% G1 U8 T3 \5 \report
    窗口得到以下结果:


    . ~, c8 Z% v! p
    Global optimal solution found at iteration:: E# k% D/ j% [0 _' ]
    2


    % O- @! N8 f& q0 x% V8 S, xObjective value:
    % }8 V+ k" {. J/ o" N1 f7.750000

    ( v8 ~2 }& J( D$ a
    Variable
    7 {# R% N" n3 q* Z7 a( w7 J% dValue; y8 f0 F! r/ w% l9 M0 [: E
    Reduced Cost

    7 P' Z- @3 D+ O* \2 T2 N. @
    X1
    ' ^- {- o' K+ U- n5 L0.5000000, ]: Y  T& s6 J7 f
    0.000000

    2 b6 B" z3 c. J  S& d% S" |
    X3
    6 I& k" k3 ?. o* o7 n" X' l- t3 ~0.25000001 j0 O* J0 b9 H& D
    0.000000

    3 w% c" k+ r4 S' _, T1 D

    + D/ e& C  I; b/ L1 OX2# P; Z/ z0 S/ ~( [  e! t" K" ?
    0.0000009 d% W* G/ a, n! y& H* V! x5 c
    0.5000000

    0 X* N6 |$ E" D& N: W8 |
    X4
    ( O8 t, f8 B, ?0.000000
    4 ]- \  n2 c; W8 Z# g$ R2.750000

    4 o8 U6 m, ]7 U
    X55 x  \+ t, @" X, V' j
    0.0000004 Y; ^! a# D8 V8 F1 R
    2.250000

    . C& r6 U8 m  p2 X, A
    Row$ @; v* c0 F) O. z
    Slack or Surplus
    3 Z# _* J4 C( W$ W. rDual Price


    ! V  Y! ]5 @7 j; M1 x16 l5 w2 \5 ?4 h) y7 |4 I+ d
    7.750000
    - p! w6 k- ]/ r# x5 I* i" m6 \- P5 F-1.000000

    . p  q2 B2 W8 ~  @
    2
    / b9 J  t: [9 H* I0 C! D: V5 g0.0000004 d, v  R3 {& E1 m/ @) l3 k& R
    -2.750000


    ! g# t8 S  x* F6 |3! D  ]* r4 N- X' u
    0.0000007 N7 M, G7 I; G1 u  n
    -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;
    & \% ?7 L  z1 H2 {3 F7 c' K! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:
    7 |; c8 @, Q. K  P" g5 {2


    * w* l* |* F( C  t+ k5 F; g* LObjective value:
    + n* w! l0 `% o' Y" ]9 Z7 K! t" x: v! b7 E' E3 p. C2 }
    14500.00


    4 d. L/ ]. w+ m4 ]4 D7 ~. DVariable6 ^/ d5 H9 p9 ?  H' O8 ^
    Value0 k) p+ J* {% i3 @8 K. @: `
    Reduced Cost


    # @% P& H+ J- _X
    ) F9 {; Q, s) u7 x$ N* P100.0000: i) I% Y: D( U8 \
    0.000000


    ; S1 a7 `/ B% a7 {# @Y
    + I: h6 }6 U, i& Z30.00000
    % {; F( i2 a$ E5 [, k9 m0.000000


    1 b/ u) l2 E$ C, ?Row
    1 ]* ~9 B% @5 h, _7 tSlack or Surplus
      m* l$ H5 l* o5 ~6 J3 QDual Price


    / [% Q: a7 N: R) S! I- J1
    . ~3 n6 r& D4 _14500.00
    2 }8 X9 F+ x+ b0 @1.000000

    ) D& ]0 X; W1 G6 l# b+ J" L% X9 b
    2
    4 q) I- n0 Y# H" g2 U1 ~. h4 k0.0000005 o9 m2 f6 C4 w, S4 {
    25.00000


    3 T; _# N3 l. q/ r, p: f3
    * @3 M# L' s2 I: U6 d7 u90.00000
    % m4 J' D7 K/ O6 A: i5 R0.000000

    4- R+ C6 V" b4 k4 \- e! ]7 [) E
    0.000000! [3 l: l& v3 W- a; U2 y& q
    8 V' N. A2 Y; r6 f- K
    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-8-2 20:17 , Processed in 0.487645 second(s), 60 queries .

    回顶部