QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3775|回复: 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 =; W4 t* v7 L) U3 |6 w3 M1 G0 {
    -2


    2 g# J4 g) K5 G" p1 w% u* m" r-1

    0 E; S' Z; L* ~) g
    3


    ' o$ T, {% ^6 B% u2 U9 T& 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 =' }: A" n% u' E6 i2 o
    12 h% y# x3 x) _3 Q: K
    2  A& W4 g& H& D$ e, R5 P4 P
    4# `2 Z" I. q8 M4 R. c% k% `
    -1

    - M  i( Q; {: u3 }9 V! B) R
    2
    & W2 ^. o" P2 t) c' `* J8 }39 e# d1 Y/ T" @/ p
    -1
    - c. B$ W6 o: V0 d9 o1


    7 R1 d( H4 q6 ?9 e6 O; D9 W# k3 z1! \" I& T# }/ ^6 P
    0
    ; C" ]" N! Y/ ^' x) \; z9 }$ h1' S' x* R" |) x4 a
    1

    . ?# N/ {& ^& ]0 L1 S( I7 m* F
    -1- [+ F" v: {1 }) n' p
    0
    ( p" M4 ?/ i& Z/ |/ h0
    3 j- m( @, \) |; @$ ]* S9 c0

    1 W5 O0 R! L: }% t% d
    0
    8 c4 |9 J0 L9 w-1
    ) S% i  n4 U; o9 b* e+ h0
    4 @/ o  Y* a  j, t; [0


    7 ~7 S* I0 r& q0 o! S! ]0
    * @+ u- N& T5 o5 _6 ^- u9 \- J0
    6 C" D9 A( ~; J2 j/ Z-19 b1 C) ?6 b% H& @
    0

    ' N1 X* U4 y. y: F0 e3 B1 U
    0
    . j% J1 ~6 J6 R5 i0 G. i08 m- C6 w0 A! H2 r
    07 |* k' W# \3 O0 E$ V
    -1

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

    b =' Q# R. q2 F0 L! H3 h8 z6 W  ?
    6


    8 J9 Y0 R1 d+ Z4 L6 p12


    3 |- ?' `& k' f7 n4


    2 Z8 @: x! G% ^% S( \# ~: Z& c0


    7 {' I% @' }! p! g0


    % W; o8 {# u, U) _0


    $ ^2 ~- l6 c  w0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =
    ; Y  ]7 G& j+ l: q) G+ w0.0000


    & a0 c& U0 S. h; y, V  f2.6667


    ! F7 a/ ]! I- f( u! S+ M5 C-0.0000


    1 R+ y, E$ |( |4 C0 J4.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

    end6 T& s7 o. b' o# ]2 \8 g7 m, M# A
    !注释符号; 系统默认为自变量>0, 若不要求用free命令.


    & p4 [3 Y: M7 R% d$ \; \( e!在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP5 [0 o( H7 m7 {
    2


    7 a( q+ u7 T* F  B" T. NOBJECTIVE FUNCTION VALUE

    ( J2 ?5 `" S! p  d4 f
    1)$ U" z; U1 h4 S0 S$ w2 m$ B
    145.0000

    5 O7 g: `/ B9 ~3 W
    VARIABLE
    ! p& B/ D  e: `& X0 R7 [VALUE
    + Z8 J  E( ]! |6 m" V$ iREDUCED COST

    6 Y1 P' [- V) H- w5 ?" u
    X
    6 W5 F/ R  x$ |+ q2 q4 H10.000000& i8 D# e/ i7 u- Y
    0.000000

    . |6 ~* G7 N# _+ J# g' q* V
    Y
    8 L3 U! D+ V6 ]- k' {3.0000005 u* A# C$ n' K5 D! Q2 ~1 c0 F; \
    0.000000


    , k6 J1 a  J, IROW- P3 s+ a$ C. h- U7 t1 L: Z% @
    SLACK OR SURPLUS+ P0 y# A! B5 t) x# D8 W* J, A# {
    DUAL PRICES


    & e6 v8 V- u1 R7 P" b- [0 Z! f2)4 S# r' V- [2 \
    0.0000006 o3 p& Z2 S3 a% J3 N# `7 C8 g
    2.500000

    5 c4 r8 K5 \# q! a' B
    3)
    ) [! L( J1 l6 |+ d: v, ~$ N7 n9.0000003 O& W6 _3 u+ n" {
    0.000000

    8 E: ?6 m: k+ k5 I' r+ z
    4)
    - I* f4 {- g5 F+ ]6 G/ \0.000000
    + @# ?2 ~3 i1 \+ Q7.500000


    7 l6 M% l" B) c! C/ M/ G: @3 nNO. ITERATIONS=; q4 ~1 f8 t9 P6 h1 W
    2

    ( d6 ^3 G0 W( t9 t3 u
    RANGES IN WHICH THE BASIS IS UNCHANGED:


    & x* ~) Z+ U/ a: K; BOBJ COEFFICIENT RANGES


    2 h( i. C1 J* G8 [VARIABLE  Y+ l; Z8 H; C0 A7 V. h
    CURRENT+ }3 F9 b1 G0 N, A; o$ \  n
    ALLOWABLE1 ?- E  r6 c& m- v; J& g% Y% J4 D+ D
    ALLOWABLE

      V- ~( N/ ?, o' G: M
    COEF/ r; N' C) }/ C5 W+ E% O5 {
    INCREASE& N: V! G% Y5 a4 I
    DECREASE


    ' y: G( B8 D9 G$ zX
    - {/ j* f" F) A. M4 L" h10.0000004 v) e) k2 R9 f# J6 I0 e
    INFINITY0 w" N; h7 W6 l* x& G. q, G* Q) p
    2.500000

    & v) j8 t( F( t
    Y
    % E" [3 @% M! M1 @8 y5 c# W% V" Q15.000000
    4 d) ~. p7 U6 p5.000000
    % S! }2 S" \& m8 |$ B- b7 }15.000000

    / D% d' ~- Z/ z3 ]3 P8 s
    RIGHTHAND SIDE RANGES

    % h2 N, c5 O- ]. D! H
    ROW% R( U" u4 z1 b( L$ C
    CURRENT
    . m1 l% c7 j- L6 f/ R/ [ALLOWABLE
    5 v% |- c9 _/ @ALLOWABLE


    / E8 d5 B7 o0 DRHS; e/ o& A- B" ^/ x+ _6 R. r# |
    INCREASE; A/ L* Z( E0 f3 P4 E- U
    DECREASE


    9 E( |$ w# o  @, _1 I& I) b
    % v1 j) U2 G9 }2
    / B# B% Y1 y: q10.000000" X. G8 c9 p4 y4 H
    6.000000
    ! X0 e9 m6 D. T' P( F10.000000

    $ W) u& w3 Z% n9 U4 j6 q7 F
    3
    , u2 g& J2 T9 ?5 Z: U12.000000
    5 o) K) q# a" G4 l7 mINFINITY
      W, G- C3 i8 k0 m' L; y4 Q4 L9.000000


    5 g% I5 s# g' ]' Q4  r( V4 g/ a: f* H8 L
    16.0000004 {. U) x8 y6 c, f- ~3 G
    18.0000004 K7 S, V: }; ^" q+ Q7 Q1 R3 ^
    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
    " a2 U1 {' i) s! \! ]report
    窗口得到以下结果:

    ' @7 y% H, J9 J7 O4 r( c5 u$ d
    Global optimal solution found at iteration:- u; u/ r- N& J9 J9 w2 \2 D+ U
    2


    / s% \! ?! t" J0 I" d' lObjective value:
    . r; k# k( s! Q3 l9 U* h9 ^7.750000

      y" d$ @+ k$ [% F' X9 g
    Variable
    8 [$ M  p6 N1 f! S8 a% Y* V* w0 [  JValue
    7 q- F7 S8 C9 m" VReduced Cost

    : Q* t1 Y6 U% w2 J0 \( s
    X1
    : m3 h( u4 c; `! o. |8 X0.5000000
    6 d$ `2 r+ o9 z- ^0.000000

      C: s" m* H6 U9 r5 W# L
    X3
    $ e% G- Q7 Z: `  w0.2500000
    2 H2 F/ i6 w! J/ c+ w2 X- U0.000000


    3 h+ L7 I, W; M% g$ ]& V, @& q5 g3 q2 l. a9 `
    X2
    * O, B/ k2 q3 n8 B/ l7 Y0.0000005 I$ d, p! M# T2 p% w2 }- U7 l# \
    0.5000000


    - m8 f* w5 p' ^5 OX4
    8 U/ z; q+ \8 [& a; u$ O! {0.000000, y4 [! m0 |  @2 l: J3 Z
    2.750000

    ' h" o# Z. }2 P# Q- P4 P  M& a. i
    X5. N* U4 p; X% y) o  Z+ Y
    0.000000! N3 v, M3 r8 H7 j% ^2 ~- J1 M: L
    2.250000


    0 |( r/ V1 i9 v$ I$ o  i8 ?Row/ c! \7 T3 S( q1 _  V. I
    Slack or Surplus7 t' n+ e- \. k3 ?' ^
    Dual Price

    0 m+ z' E  o/ E* Z! M9 Y6 Q: h
    1
    9 B$ F' @2 t! R, d7.750000! X% `0 k) w: |, H. o3 M% |/ p
    -1.000000


    ( w0 }" K& `$ z+ \8 V2
    + ~" M, N, g4 ~7 p" Z) k0.000000
    ( W5 Y6 v, t9 Q! g. O7 e6 V-2.750000


    ) A) z3 h8 J; K( ~+ W3" Q: `9 {# a9 d0 T8 \- a. d5 i
    0.000000; d9 p* b# ^* g" @
    -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;
    5 R" S1 E; k) w/ z: h! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:5 H/ B" E7 h6 Y0 [
    2


    ' W3 X2 G* G+ V. _! R4 QObjective value:
    0 E1 J; t. y( V+ t, N0 e1 K! S3 S, L3 A# R! l; V3 T
    14500.00


    . n& W7 z$ w9 y0 nVariable# ]& z* X6 {& `; x7 u
    Value! O# ?5 R7 t, p2 [. |0 l# J" p
    Reduced Cost

    8 d, R/ S% L- Z' C& d* |( K  W  M
    X
    ! q& ^6 d" `( _9 R5 j100.00002 x8 Z4 P7 N+ }
    0.000000

    % w& D1 w  ^" {* M
    Y
    % V/ x9 N% b3 C. \30.000008 @+ z# q: c. S* `. g
    0.000000


    + K/ h1 E: k' d( [7 `Row2 f; S& U( G0 E3 ^' ^9 l5 t4 \1 d" Y
    Slack or Surplus
    - {4 W  J( j  o0 P5 Q6 ?Dual Price


    . ~' ~/ A! p  t# I1
    , i# f# x: `; W( L  ~14500.00  z. G3 C8 D% t
    1.000000


    & B! k1 ?6 U  {27 N% \2 N' @! E/ X  p
    0.0000003 f8 V0 ~% w) _6 g: L: z
    25.00000


    ' a) ?. J- o# `8 h8 N7 X& {' r5 T3
    5 I9 p5 z2 f6 E7 M4 y! S+ e: N90.00000
    1 r1 S  l2 X: G0.000000

    4
    3 M# ^6 ~: e, f% g6 @1 `1 `& j2 o0.000000! Z/ o5 P% C5 K

    : J3 G1 w( b; j# h, P" |  d75.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 12:38 , Processed in 0.498280 second(s), 60 queries .

    回顶部