QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3741|回复: 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 P" s" [- H, R6 l
    -2

    4 _, t( b8 t0 c( u
    -1


    0 U& @  L8 y  v2 P. ?6 A/ K3


    & ~" Y2 M$ |4 ?6 e-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 =& Q8 _8 L9 h% X! U
    1" E/ w7 n6 J$ G" y
    2- j. b' u; O: E. H$ J. a, {% e
    4
    ' j  Y# P* v) ~$ ?) E-1

    ; g/ V3 M& _+ _# B& n! I2 d2 B% \
    2* i& `* @2 C" a/ l
    3
    ) U+ g! Z$ L) F9 L-12 l* R! Q1 r' Z) @
    1

    5 I# q$ u6 B" C7 W$ ~
    1
    $ d3 v8 g* n' H1 }3 [- j5 b+ ~0
    ( Y  k* Z0 Q0 z% f1
    7 P% c4 j5 ?7 Y) b% O; X5 O1


    4 J8 P  y6 l) o" W  g6 ^$ K' o6 z-14 z# D3 w1 B& V
    0
    / \) l1 a" m3 O8 h9 J. r04 ^! z/ U* b/ ~, v  t7 V% V5 A
    0

    - I# S: z6 T& N! j0 s5 i5 i! ~, A0 [
    0/ j6 ]2 k% u; V* J+ Q7 C
    -1/ n3 t/ |& R* y
    0
    8 J5 S* Y# B4 U0


    4 D. J+ `, ]" o3 Q6 p0
    - O# P, I& O8 S9 `0; U" z# n9 S; ?  c1 l
    -15 a3 [4 ^/ z; W- @# T$ `! k
    0


    # N3 W3 F, j: s6 M6 H0$ v3 \9 {/ j) C6 w
    0
    1 n1 c5 }  z6 d5 d2 X; A0
    , r6 K' m' ?: z: j* v& g' r) |-1

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

    b =
    6 q- d, t  p6 T& t6

    , {) j- T5 c# v8 i! p
    12


    3 L4 I, u; }. R7 i4


    1 b+ q2 S& H3 I# L0

    $ N, o9 o( Y1 ?
    0

    0 I8 X* t$ x! M' x  y& v! N! s; Z
    0


    6 `5 e& N1 @. C" p' D9 M0 [- V" Z0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =
    ) l- O; R( s4 S0.0000

    8 ^8 C- S6 j7 @$ b' w+ x4 f3 Q1 `
    2.6667


    " z& u9 ~. i* X8 o) n. A) L-0.0000


    8 n) z! e/ w2 o" y) b( M4.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
    1 Q! }$ m5 a: K3 r!注释符号; 系统默认为自变量>0, 若不要求用free命令.

    2 F( n# c* A( q" h3 I4 X1 D7 `
    !在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP( V% d  X7 {& S' @/ q5 ]
    2


    ) x( W) H, j* [8 \* |4 XOBJECTIVE FUNCTION VALUE

    : i" M% s( p4 u
    1)
    1 H: u6 ~$ n( A" n* [1 s145.0000


    - F! Z8 n9 w  h/ AVARIABLE2 F! K, [) Y) G, b9 r* P3 u
    VALUE
    " w, Y" g+ @& u5 a$ GREDUCED COST


    $ ?9 U: P- X  g% \% C, q" DX
    , w1 E, z1 D  V& b. G- `10.000000
      W9 g  p; K/ t0.000000

    " a# {6 T8 @/ ~+ _
    Y1 K! B7 K# h1 I, J& l1 N
    3.000000) S) D) c! x1 B, z5 ~1 m0 F9 F  w
    0.000000


    $ A: V8 Z& ^7 q+ ZROW. {' x* N- }- w. d# {1 h2 ?
    SLACK OR SURPLUS, m( V1 X) g. r$ Q4 {
    DUAL PRICES


    - a! L9 c: v7 G2 A2)
    ; k+ w( y4 L& s) d5 H0.000000& W' ^2 Z, B& w; i' t
    2.500000


    / d* T; `$ |3 k2 w  j3); P+ n9 S4 o  I; q
    9.000000
    ' _9 I! V, Q; \. b: Y8 r  R  b0.000000

    . m0 q8 R9 D2 Z2 n$ t) q
    4)" `1 }) q+ k7 t- [" N4 z+ G4 d; t
    0.000000( u3 f* j0 M% z
    7.500000

    , q  C/ N+ d9 @: U8 P) ]/ o. @
    NO. ITERATIONS=
    ! C! S* u0 i3 Z2

    % J; D/ Y. @8 j. |+ O( K3 Q
    RANGES IN WHICH THE BASIS IS UNCHANGED:


    + _2 Y/ j& }- |1 Q& T( u7 Z, BOBJ COEFFICIENT RANGES


    8 d7 _$ R) {% T( qVARIABLE
    & R" ~, z$ w8 v4 U9 o9 RCURRENT4 Q- b4 m9 Y4 J; l- c$ I
    ALLOWABLE
    $ ]3 u% u8 D) `ALLOWABLE


    4 s, s5 O# ]! g9 d7 sCOEF
    , ?) u) h' B3 S& m1 n9 OINCREASE
    9 U! h7 u) o  c, n# k/ r. n. L1 `- pDECREASE

    ' x6 f; R+ z. E9 X  H% G
    X
    1 J7 r; R3 H' p% L1 H0 X/ x10.000000: U) h- z, T0 e5 }0 x2 j- v
    INFINITY3 \  }4 d" d; ?9 g8 t5 I* [
    2.500000


    * G1 ]. y7 u. P3 JY
    1 M$ L- N+ d( m15.000000
    2 n, \% t) p, B" {5.000000+ Q" x/ U) D; Q. x. b( }; G
    15.000000


    * p5 ?0 o; ]' i- q8 f" ?9 m4 FRIGHTHAND SIDE RANGES

    % h/ N* W7 J+ k  _
    ROW
      X3 e/ r% o5 U' Q; BCURRENT
      s* z# Q- i& wALLOWABLE, ]0 W0 }, b- G$ u( @$ d# Y1 F
    ALLOWABLE


    2 }$ n% E) l$ z, }* ERHS
    & Q. y  T/ O* v4 Q, h  {( M% rINCREASE
    * J; R# N" z6 d8 D+ cDECREASE


    5 t# H8 K6 w. w) L* d2 T/ G# l( E4 g8 O1 {$ F" e
    2
    ! t2 r$ u* |" c' H4 B0 X  ?+ ]& g10.000000) `; u5 S( [8 N7 I+ }6 S5 i5 d3 s
    6.000000- t% V' m! r9 _  c
    10.000000


    ( o4 v7 f" F8 M& S. I) F/ V3
    ; V; q, z& ^' G12.000000
    2 C* q6 v! ^0 ~! G( g" i8 {INFINITY/ F! z0 \7 q# f  w
    9.000000

    4 W. ^8 l' J3 a7 q% J" ^
    4
    9 X# C2 B6 v+ }% R3 b: v4 l16.000000
    * G) [* {# c, d; l; m/ i6 O# {18.000000* |4 `/ w/ E. s$ ~/ b( t. E
    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
    + o& a' l  _: [8 r7 b5 L5 g. Sreport
    窗口得到以下结果:


    & [* f4 n& L7 q: E& N; m- M4 z4 |
    Global optimal solution found at iteration:& Z2 e$ e9 R' w+ I  {
    2

    ( ~. z% Q: X9 M. ]+ ^9 F
    Objective value:; \- K3 i7 E3 w
    7.750000


    6 k2 e3 _1 \! oVariable5 i% M  {- b2 m  n) ^% H
    Value3 _' k6 n7 d- _9 K: h7 x# A; z! I
    Reduced Cost


    . S) t- u% c4 Y5 ?+ E, EX1
    6 Z6 ~1 F, j1 z' U0 l* i" V0.5000000+ x5 R) O9 S: m! X$ c0 o3 s- m
    0.000000


    - d" I# X/ G  B2 E2 U* O. p5 ?. rX35 v# X7 f8 A# h5 W. i+ h1 c$ G
    0.2500000/ e. _8 `: n) d$ U
    0.000000


    0 d# ?  t) @( f6 b) S
    ) ^/ s& \) v: I  KX2
    8 V5 N7 m7 @$ e7 C; E0 N3 D2 y, U0.000000
    ! m, P+ N" t6 b8 R2 \0.5000000

    2 o- D6 W5 m8 ]/ a
    X42 o* g* a3 d1 S; K& Z
    0.0000008 a. Y1 g2 `! k) Z
    2.750000


    9 @, G( i! H0 m- e# _( zX5: {; A! |& s- t1 O" T" |6 c
    0.000000
      q1 d) J8 {3 L$ N( S2.250000

    % i0 l" U. G' }* Y1 K
    Row" {3 S+ D' N! f- J, n$ {
    Slack or Surplus
    % t% D; z: h: I1 e/ W$ aDual Price


    + k5 ^6 F; L% Q8 B- V& x3 s3 F1
    ( e% N; Z2 r& R& p! d& o; E7.750000
    , @$ |: Z1 V6 `! a. z-1.000000

    ) R+ }8 h$ j, t3 {/ e2 Q& M
    2
    # a% Z$ B4 R* d& [& D0 w1 b0.000000
    - \  F6 Y1 H' o& ]# \-2.750000


    5 g" F/ J3 g* y& m2 _# d/ i* V% c3 f( G: a33 V6 I' s4 z. q$ H+ H
    0.000000, N7 s" X" r6 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;; i) b# R) A2 W, o  w" j8 I
    ! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:
    ; {4 m9 M( s' N% c& B" b2


    / X' V+ v5 K2 s* ^# L7 n9 ~Objective value:, r; Q' p7 k6 V- _$ c" C8 u
    * K( a- Q0 m9 Q: K' ~6 t
    14500.00

    . m2 l" R  M" d( ]
    Variable* ]6 h. l5 O0 A* z. J; w
    Value. ^3 R+ {' N: z( r$ n
    Reduced Cost

    5 m7 c. k' o$ r5 i0 w% l
    X
    ! b' q2 {) O7 o100.00008 f- I/ J& O* K3 I  {' x7 y
    0.000000

    2 j5 p/ d. A. s' t3 R
    Y; w! d6 l$ V2 c( c2 f3 L
    30.00000% B% f( [( l6 `4 m
    0.000000

    . }' w) n( m9 @- D: H
    Row
    8 p5 M0 S0 i# `# a( I% `Slack or Surplus
    & s, e& G6 d8 F% w. |Dual Price

    5 T, }; t7 G2 g: ^# M
    1
    % h4 r9 L& G6 g# l. m) q+ T) U! E* W14500.00
    $ D: ]/ ~$ k; `% @( ^; r6 P1.000000


    9 v$ g4 T$ b0 W2/ o0 n& f, w: p) U
    0.000000
    ' P6 A* S8 V) C25.00000

    2 N$ V# K9 Y# x
    3
    / B2 L! ~* C6 a- o1 N90.00000
    2 t) B  ?) d- ?; q: C. g0.000000

    4, T- d3 ]+ W# j% P/ C
    0.000000' Z4 d2 s* k! v! A; Z0 F3 c2 }' p
    " |! {- u3 Z8 \6 R8 f7 p
    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-17 12:09 , Processed in 0.423356 second(s), 60 queries .

    回顶部