QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3738|回复: 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 =
    7 J' n* ]# I4 r6 C+ |-2

    # i( B+ D( _/ `* a  O
    -1

    " c6 x5 d7 `; g- r; z1 X
    3

    * b0 n1 B1 Y; B% c
    -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 =) @5 b3 T6 T  \; O  E
    1  E1 e; v! j* x5 c& Y) _$ A
    2
    " i8 p7 I6 j1 m$ n4& L6 {  [) Z9 u; t% s. r
    -1


    2 q& V  R0 V& q* v+ h% v/ q8 J2$ S* g4 W7 ^( T4 _4 [- |+ f
    3
    , I5 T3 c4 a# L, o* k, ~4 t( o-1+ {' l  J6 ], }' X" E1 F' f
    1

    9 R- U, V  J1 v& p5 N' Z( b
    1
    % f3 d7 @3 R% d' [5 L$ l0
    7 n+ |# u( I$ b1" \* C% t0 F0 U( L
    1


    6 ]1 T0 I& `. H  _0 f/ z9 M-1) t! N% T/ S3 \7 a& a
    0: g% H5 I% b; {/ q" i/ s% g) n
    0$ L' b* b5 Y1 B* g' n8 W
    0

    8 i' s) S; v& }, Q& N( p+ A! |, ]1 V% f
    0
    9 v0 w, T! D4 ^% W" J-1
    / q6 o: F& {; P3 U! _: H0 N01 b2 r" o: M5 J: Y8 T
    0

    $ C1 u6 u! U3 d+ Z7 i" e
    0
    3 ]' L# m5 c- G! V! [2 q7 u08 y8 [. ?& E( c/ i( N
    -19 \! _" y# x. @% N
    0

    8 \/ y" |8 a: o) o
    0" w; U. |% h: [7 r1 e! ]
    0
    + O/ Z( Y8 h6 h$ t) z, ]0
    & M3 G" F' p1 x8 D6 e+ t( W-1

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

    b =; w! L3 v' G: Z1 J
    6

    0 u, T3 b$ b! U8 B
    12


    % [7 j. _  C6 Z5 ~4

    : i- t; m' i- `) b! U
    0


    0 X  }2 T! o' X. v% o0


    7 ~" H% |6 Q" J! w) \0


    8 {& P; p, y0 g( F+ ~0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =' w6 b' [1 _# h0 W+ C
    0.0000


    $ R  E, s" {' U( k/ \! n( M# X" h2.6667

    - m. g, J' C8 P, }/ O6 ?
    -0.0000

    2 }& ^% G# K  ~$ }) A8 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.

    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

    end2 T$ d* w' o3 i9 {# z$ @0 C
    !注释符号; 系统默认为自变量>0, 若不要求用free命令.


    + ~$ C1 b/ o9 k% l$ |4 [% k!在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP0 O0 J6 Q. G8 E  D9 v. i: I
    2


    $ s) k. z, b1 NOBJECTIVE FUNCTION VALUE


    / q) w& j, h" V+ s1)  F& @) ?8 O5 [
    145.0000


    1 i/ g" ^0 v; B% ], kVARIABLE
    - f8 M. o% M3 uVALUE4 e/ L- O, ]9 b/ x$ p2 O
    REDUCED COST


    & E. `" p# b8 a( w+ x1 [$ c6 XX0 Y2 X! v# J) X. M8 H4 P1 w, s. [
    10.000000
    * v* c. X& |, l0 d8 q+ m0 \0.000000

    & Q* E+ x2 D( M" O
    Y
    8 R: p) v; i' t. ~( c9 y2 q& u3.000000
    + p/ F6 N6 K0 t0.000000

    $ ?2 `, X- D. K/ o2 I: W0 ]
    ROW
    5 e; O5 k% G5 Q) }SLACK OR SURPLUS
    1 \; @- T' v$ r$ |' N  DDUAL PRICES


    - }/ j4 V, G4 o% B3 Z. Y) x6 Z5 I2)# b+ {$ g; Z' L
    0.000000* y9 ?! @6 C. I0 \7 `' x) x
    2.500000


    ; y! K$ ]8 r! W3)  X' n) E+ @: d% G( s
    9.000000# H5 W0 t- I" X9 u2 k
    0.000000


    ) S3 }! q, I1 T4 _1 U/ i' E4)
    5 n, Q" l- ?; N  u' Y! c# n0.000000
    : t6 ~1 s% l+ J, k4 P( t7.500000


    & v. w8 A# v7 P# Z8 bNO. ITERATIONS=8 z7 M  S- f( ]& j9 @) l
    2


    $ P- I& @7 Q3 DRANGES IN WHICH THE BASIS IS UNCHANGED:

    3 k6 t/ m" X; I
    OBJ COEFFICIENT RANGES

    & {# _1 Y$ s0 B( r/ U
    VARIABLE, u4 Y2 h; U8 e* [* p9 t0 Q$ g
    CURRENT
    - n# y4 h, C( W3 [ALLOWABLE
    ) J& [) N- |/ |$ _: Y3 ZALLOWABLE


    ) X0 D$ E, E- ^: d4 U6 B9 j/ D0 nCOEF
    ( T& E0 ?+ p9 FINCREASE# `) J& |* [: C7 m- y* J$ J* Q. p
    DECREASE

    ' L# f+ W! p' z, A
    X
    . j' ~; c; ?" [- f/ a6 w10.000000
    , u3 S+ n0 d1 l- d$ \INFINITY
    ( S9 m7 ]& Y: B0 W! v9 l2 _2.500000


    6 j  Q4 s9 ~0 g( g5 _Y* e2 [$ v- U' W9 C0 y- M) ?
    15.000000
    ) r) p6 w3 t2 l* |+ f$ u/ ~9 ]5.000000
      M, P# f% V1 X2 q15.000000

    4 C5 B1 n3 `: L. G4 p
    RIGHTHAND SIDE RANGES

    3 ?* g' j. j; j: N' l' G
    ROW' p; f$ m7 d. H  ]) y
    CURRENT$ X# ^! r: A, ~9 l$ X& D1 [" M* N( Q. \# d
    ALLOWABLE4 I. t9 _: i0 R
    ALLOWABLE


    0 V' h1 \# `9 h! l: J* _( `( f/ \RHS
    - \% _' y' T4 [9 nINCREASE; j- w; o; w* m  K6 k" ]* _, W
    DECREASE


    1 }( E3 n/ I5 U5 q8 a' z$ ]  x+ N# M2 P& v  Z: y+ \
    20 U9 \" C$ _  Q' G6 s8 b
    10.000000* |/ Q) r1 Z. g1 W3 H$ `' x
    6.000000
    " R! Z) r4 m; i! z! c10.000000


    % W  ^3 P3 j: A3 d( y- k$ V3' F/ P# S( B" C! D3 N% r! g2 D
    12.000000
    ! r- }* [. u+ W2 \# _* c8 mINFINITY
    - X, T) _' v" r. c9.000000

    + m* J: Z0 i7 X+ n* \
    4
    ' J' W$ {3 r2 I) i16.000000
    * T# v; r5 r# k( {6 Z4 h! N18.000000' F& S8 S" a; E5 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;

    按运行按钮在solution2 n4 y/ O2 Z' L7 ~5 I% ?  i& [
    report
    窗口得到以下结果:


      v5 u* @- d5 @" h0 ]% j% n/ h
    Global optimal solution found at iteration:  G! S3 u7 n1 x2 D  w2 ~. @
    2


    , {/ D/ o& E, M3 ?- O' c5 XObjective value:
    1 ^& ~# P' b6 O# g, O7.750000


    - P! O) {9 Q5 P2 H5 ^% ]Variable
    / f, c/ s  Y( V# \$ P* c' bValue, E( n8 H, x1 r/ u1 @' m: \
    Reduced Cost

    1 K& o( S5 u. I1 D/ t# s( ~
    X14 K' @" U7 A& P+ m# g4 d2 `
    0.5000000% G, D' t7 ^8 M* I7 H: O, a1 \: s: p
    0.000000


    5 B7 G$ v$ y7 T. k% n9 p" V- r  B* W( BX3
    / N9 ~. K% g& w  H! b0.2500000( O5 [4 _5 H3 r3 C$ e# p# d% v
    0.000000

    3 g* h+ J7 c5 N2 c5 C# H
    3 u! }* N1 t- E* O
    X2- n7 L% _4 Y7 A8 d+ ^4 u
    0.000000' Z7 c  ^8 z+ D- P! l
    0.5000000

    ! G, J  Y6 V9 K* `, n
    X4
    / G4 M; w' b' u5 e( ?# {8 `2 X+ I0.000000
    ( J5 R2 k( l& Y3 i2.750000

    " V2 w. u9 L4 K1 Z; H
    X5& T' P7 A& S' C: U8 u! }
    0.000000" v1 V) P; m8 k3 s+ a& S0 B
    2.250000

    $ c3 w* x7 d/ J+ j
    Row
    * n- b0 @6 ~$ SSlack or Surplus
    - L* Z8 A3 q' l& sDual Price

    * x. e) y6 I( s
    15 {; p# a( L3 K
    7.7500009 k+ d) x6 C/ h, w: D; T
    -1.000000

    # D: o% `2 _  [0 q4 s7 j4 P/ G
    2) u5 C0 N, l% O3 n! G* `7 _  q
    0.000000
    ' }1 l- v% z8 |# Z. |4 s-2.750000


    # R+ H, Z! @- T- O, ?& o. |33 S5 M" a! x. p$ ^, C( U
    0.000000
    % N& ?8 _/ K9 W) 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;. J5 c1 X+ l0 S  Q
    ! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:! {1 ^' r3 O+ n
    2

    1 L/ _: p* {0 B2 r* B/ r5 m7 Z9 X6 x" `
    Objective value:
      X/ \1 A- g, ]% L8 N) A
    1 l1 |# I+ @; c7 {14500.00

    2 i% a, M' f, ?  {" ?4 t. ~8 V/ A
    Variable
    9 f* O  R& L& Q3 Z( O: F" f3 p7 C' vValue! J/ p1 R8 R7 ]
    Reduced Cost


    & [, U4 p9 y  q6 {( A3 Z6 }6 KX
      z# ?$ V7 E0 ]5 w( b0 T2 F100.0000+ v* o8 a' p( N7 W; i
    0.000000

    , B( G6 ~. o, {; ^; T5 R
    Y) T* F% ^2 p; I& z. |2 p0 `
    30.00000
    / T  N0 z' \& x  a" r# k' b0.000000

    : ?; O# n; \3 ?* g  R$ M, _6 C& D
    Row1 D9 o9 x2 Y$ Z5 t
    Slack or Surplus
    2 p, Z  q) E2 P  n8 z. ODual Price

    8 |8 s) x5 D$ T0 N
    1
    5 A# e, K5 G& Z  w( u" b. Y14500.00
    . y  c0 [3 a! o8 c# e7 k/ c4 t8 @. i1.000000

    % m8 J& [7 ]$ t, W
    2! t& ~  r; ^5 l6 o+ K( j
    0.000000
    0 M* e( O2 G" d1 n  F3 \/ V25.00000


    9 w& |" G5 R6 W3
    : g3 @. }! j6 x/ K- m- i90.000009 n% H. ?% m  J
    0.000000

    4  `; w3 s. v* [+ z/ Z
    0.000000. k9 l; L, H8 x% R
    : k8 p& ?; z3 T+ |
    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-6-16 19:56 , Processed in 0.454628 second(s), 61 queries .

    回顶部