QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3695|回复: 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 =
    ; V2 V2 K, U* W  H6 X2 a4 x0 e-2

      {8 t, z" t" B: ^
    -1


    - @7 e+ I. J: |/ f- b: }' E3


      F3 P- a: a  v- Q1 S4 Z) B-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 =
    . X' D$ T6 u" `) K; B/ m1
    - `" o& ?( n5 @! T, x2
    . t! g, w! s5 x  P. i8 m4
    9 e3 T7 N2 _5 k-1

    " j  n, [1 p' i) z7 B5 c
    2
    2 R+ _# h4 j8 ^+ D; g$ J, }- K; N) l/ n3
    1 p3 K) H4 u4 s" @; {! X) d-1: H7 c& l: d% L& a" R9 f  Q
    1


    7 V$ V6 o& y# U* ?; [3 T3 P1% c. E. Z- B  O4 N/ v! ~4 s( V
    0
      `2 h$ P  w) [- l# e1& M' S$ U' v9 y3 ?5 _+ Q" d7 |
    1


    $ V6 ?) F: S$ E- ]. }) ~/ G-11 W. j6 m$ `) O) ]9 x0 t
    0
    ( A% @" K  h, J; C( c0
    + z) [6 j: }$ N9 e% x* Z& H; v5 f0 h( G0


    / }6 Y' @/ D' Y/ g( q8 S4 N- }0/ i' s* ^, @0 A& Y1 {3 q
    -1
    9 ~' w0 b0 U1 E+ F# I0
    . G0 g9 C( U, x0 D* G& c0

    * r2 n- \7 A9 [
    0, q: {6 b& {5 ^* p7 w4 Q+ z
    0
    9 v1 ]# s: b& P/ K/ u) ]-1- j8 z- R( ?9 q2 m& z8 A$ p
    0

    % p3 n/ m  {7 C; w# }& o
    0
    3 T; i9 k) Q5 \3 t  @/ v0
    6 Z+ r2 q8 E4 Q# h0
      [# W. B3 N! X5 r5 M# B3 J-1

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

    b =
    $ v/ ]- [. ?5 x: w+ X) v- ^4 K6


    " D2 _5 Y, g" S' }2 ~12


    2 r9 }; D- v5 a8 M- I6 W* Y4

    " B# v2 E* x' s! B2 }. e
    0


    % q+ X/ L" U1 W' x" X* B0

    5 S4 N0 G, `1 _3 [
    0


    % N# H% j6 a, S5 a& |# ?$ G# o* j0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =+ f; r; a1 _/ @6 i9 ^" n8 m$ a
    0.0000


    5 m& ]0 B) \( t5 ?6 q! U2.6667

    7 }6 `8 G& K4 W
    -0.0000

    # z# e  N; L7 ~9 M4 |1 b
    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
    ; I! Q2 X7 _" Q: w$ C!注释符号; 系统默认为自变量>0, 若不要求用free命令.


    / Q0 s' }0 k$ C) u4 r/ }  @8 a8 s!在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP4 _1 E( H1 r, J; s% D+ [' G
    2


    , Z6 e8 n2 i4 wOBJECTIVE FUNCTION VALUE


    ' M( f( ^" m1 y1 ?5 V+ ?  P1); w/ @9 N/ t/ t* I, X
    145.0000


    $ b7 h3 g& |; ^9 h. SVARIABLE/ K" T7 {8 S+ {1 W  I
    VALUE
    ; S) G- L: i7 l& n8 }REDUCED COST

    9 n/ q# A( F8 v! z4 Z- m
    X9 B! I& O" L2 b1 i
    10.000000: {# W% R/ `) Y+ n5 c
    0.000000


    $ D$ a" ?/ S' I/ _+ a0 [Y3 b+ w4 y* q% n2 g" d) d
    3.000000
    * f# d- V2 m$ {! W0.000000


    ! c7 T3 o# L2 N" ]: h2 YROW" o8 J, f( m8 k+ s
    SLACK OR SURPLUS
    7 E, h. x, |' w: qDUAL PRICES

    3 h3 H8 N; n% U* w5 u4 R! _) h
    2)' ]$ F7 ]1 f: B4 S. A
    0.000000
    ( i& Q0 M; Z# o9 m2.500000


    . \) A/ p' V( B4 C- J5 N3)& ~5 z. }" E# j6 F6 O0 y
    9.0000007 u% f3 g( d, L: h" e; Z+ c
    0.000000


      M1 [# J7 O( I1 {4 X7 w$ O4). Q# [$ X1 }  f
    0.000000
    2 E; c6 S' S# Q7.500000

    - ]1 f# b! z7 \
    NO. ITERATIONS=2 z# b$ E) A4 {6 x( r
    2

    # i) R4 z. c* M- V
    RANGES IN WHICH THE BASIS IS UNCHANGED:


    0 H7 V' \0 \  @- \6 EOBJ COEFFICIENT RANGES

    7 l- [9 u  A  c3 {) B* L, h8 R* P
    VARIABLE; r- k1 K& n; N2 ^- z3 _
    CURRENT
    6 ]% I+ p5 F9 vALLOWABLE
    3 T9 a3 \+ @" [/ p- @6 x, GALLOWABLE


    ' f: J7 L) ~7 A1 L+ B- s& ?COEF  j2 p. j& B  K6 _! o
    INCREASE  D  s2 M* j! v3 k  t  S
    DECREASE


    + }2 `- i" K0 d* }! g$ m) DX
    4 q' G/ M& F& S3 R% o8 D  Y: j10.000000- m; j9 `0 E! b+ L) Y( H: ~% a) [
    INFINITY
    8 N! V5 h4 d- \0 d: @0 x2.500000

    ' k. k: e) Q0 J9 G7 z
    Y: V+ D( G9 `% x  U4 n3 y+ i: Q9 B
    15.0000001 v7 o3 r0 G; M* R# [- x' `8 t
    5.000000
    $ i5 a( }+ q# F15.000000


    / f& Y4 ~; H  w7 N) fRIGHTHAND SIDE RANGES

    0 ~- m# S# A& A: f  W% t
    ROW0 W2 }+ y& @6 D8 u. g; z8 m$ L
    CURRENT
    ( z$ L& h" X) M1 l7 S. {7 R/ AALLOWABLE
    ' m1 X0 g# O( |3 X5 g, k. }ALLOWABLE

    * W& l$ x$ K! s1 p
    RHS
    7 h( Q4 R8 O4 H5 Z& k" WINCREASE" X1 {5 m, i1 Q: ^' X/ Z" z
    DECREASE

    . }9 [5 W# y' f. t4 [, I' A) T& n

    . }9 D; ^0 A, [! P( X, s5 m2
    ( J- P3 D. Y5 m, q1 y6 Q% z$ C10.0000001 f7 Y. I/ d5 O( ~9 G) J6 B7 a
    6.000000
    " h* J8 ^- X+ Q1 o1 N10.000000

    3 X) X7 _# b3 p' b+ ]0 d1 V5 _' h
    3
    ; J& d' U  i. H6 A+ ?12.000000
    + p8 t. J$ W) P) v; f9 mINFINITY; ^( P  @% _" Q% y. x* V$ h
    9.000000

    # y( g" b# _: V* a/ I# M7 }; e
    4
    # C! j2 a) Q. b  J, b& ~- Q16.0000005 K8 N/ @' w6 n
    18.000000' o1 B( C8 v3 q3 w- q) A
    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;

    按运行按钮在solution1 V% f6 r2 w* }1 A, ~+ A2 g5 w
    report
    窗口得到以下结果:


    8 U7 K4 {8 c( L
    Global optimal solution found at iteration:
    & j5 D, k# @0 ~  ~0 T2


    6 _: k4 F7 A7 B! {7 i2 aObjective value:, Y. L& n: J& l$ ^
    7.750000

    0 P1 ~2 o, R# m) ^( ^
    Variable- e- }2 R9 \4 u; I; ~  E' p4 U
    Value: e2 a; @( W4 \& V- g0 s. H: _3 m0 m8 q
    Reduced Cost

    " v' \4 E( t8 J0 ]& M' P
    X15 {) j% U2 a: G: m, D6 C  i: x
    0.50000001 z/ K$ H. b, S$ X+ w9 O$ W, k) Y6 k
    0.000000


    # Z" t8 h7 |* ?( N- O5 u; t9 |. BX31 C8 o! q; N" E7 S5 ^$ o
    0.25000005 \0 m( e4 B5 W' n: b# w" v: t; K
    0.000000

    1 ?8 {$ \, j. i4 C3 K  P
    # X$ N% d# A+ s7 E
    X2
    8 k- g- u7 A9 m8 N$ d5 R0.000000# v% w* r/ n0 Q
    0.5000000


    ( d# E2 f# _! m/ uX4
    1 c& N8 L$ ]9 L1 b: q; n3 p3 J7 [+ C0.000000  b5 R. h1 A8 p. Z
    2.750000


    8 Y2 |( |7 S( P6 ZX5
    # d8 U5 z4 ]- g( J  G7 `+ b/ `0.0000008 B6 S- q+ j, _& y% ]4 s5 j3 p
    2.250000


    * U& p) H: P7 S& |4 Q8 {Row
    2 y  {: X& ]. |& v( I$ SSlack or Surplus
    " ]; \- G. B! |/ \6 M' W6 ~3 YDual Price

    / q5 j+ q  d1 Y5 V1 M8 g
    1- Y. f: G0 _! p
    7.7500009 C; G& _+ |% R: m- c9 A7 T
    -1.000000


    ! f1 {' o' u% n1 V2
    ! Y' d, x, c9 z' P% Q) G0.000000
    : M0 d3 }# s4 q& @0 o7 x-2.750000

    ( ?' Z6 W1 D( m6 h1 H( j
    35 x" H3 d' Z' ?( W3 e4 v
    0.000000
    6 U0 R5 o6 k& I8 F) z-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;% R- M; T: m! F7 Y
    ! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:
    , C* E- ~. V% }  H  b5 O7 i, |2

    0 \+ A9 @# J4 |
    Objective value:
    $ i0 }- ]2 M# i! T. m: H& b7 G. L+ j/ _6 d; r: o8 w
    14500.00

    * X/ C6 l+ z6 [( P
    Variable8 R: `, H' T5 Z) S$ h
    Value
    ) a" @+ L( I* J) h+ [Reduced Cost

    5 @  B& _: ^  ~3 {
    X8 _) i4 I2 K) Q( m" @
    100.0000. D9 k* |( b) Z1 N$ d
    0.000000

    ! G. `' y; e' X, O
    Y& ~' n5 `1 ?$ j$ l
    30.00000" X! s7 S5 z+ @% f8 U$ S
    0.000000


    / A1 @# @* D) d3 v: kRow
    + g9 E# |4 V0 N" ~5 GSlack or Surplus! W+ ]/ ?; F; x0 P5 _
    Dual Price

    ' E9 W) W& x8 P- u5 V
    1/ v3 c6 A. x( {( h. K
    14500.00  X+ `9 ?- Y+ a0 Y
    1.000000

    ; l9 U/ }# ]. i' |
    2
    1 m8 y2 P' G7 t  Q' y6 d0.000000( z% c0 t6 i/ T7 A0 E7 m
    25.00000


    , C, U% l5 G0 \2 T- N' [* y; p% n) {  e) y3; B6 |% [. f* K& Y
    90.00000/ w! M: {7 {# e0 F4 N
    0.000000

    4
    9 X0 {9 ?, R& X( {- q7 j0.000000
    , B% [' C0 q& V
    3 L8 L' \" v) M; J& A# n$ r' q$ ~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-4-29 22:20 , Processed in 0.469174 second(s), 59 queries .

    回顶部