QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3512|回复: 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 =/ \/ q" Q& Y( P2 f  I; T
    -2

    ; Q+ I, L6 u2 N8 w( z& ~
    -1


    6 y$ {$ v* {# r. O0 }/ s) I3

    ) ?0 s3 u5 F% q- H9 a! E0 @- 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 =
    ; v7 K) K& U) |( S7 }; |+ b1
    ; q- N2 z& e; _2
    # J/ f9 }6 J* p5 X7 @4  @, [0 L. ?/ w) F2 M4 k
    -1

    % P+ q+ b9 ?0 p9 D0 a
    2
    $ _% o1 N& Q6 e- M9 j1 v, s, ?3
    5 ]0 ^: t% o( U3 p$ w9 ~2 C-1
    7 h& C* m" S( V. o1

    5 E4 K/ s  B: O( z: j
    1
    % \4 n- t0 h6 l1 g" u. g* q02 h; K( Y2 u) v1 j4 c6 {) a! g
    1/ J3 T* P2 i; p/ U
    1

    ( ~3 M; H6 s& v' T7 H1 r
    -1
    , p0 U/ o+ d( {& J5 n4 K0' N5 {2 g9 A; }; O
    0
    4 w& o2 X( ^7 t5 q0

    ( v3 F: J+ |5 u" N8 i2 S
    0
    - \/ n0 @! N, W-1
    $ H) e. |5 C8 b: ?/ s0
    9 |9 u0 \6 d1 J  i5 `+ o9 M0

    ( ~, I9 T( Q0 ]: s: W7 I5 N
    0
      h8 t* r; L! g+ r0 N2 x' t: r0
    4 D: s0 ^2 q! t. u5 [$ ^9 T-1) p  s9 {0 F) q7 \
    0

    ! x5 M. o- Z9 Q: V3 g; H, P5 j
    0
    " Z6 l# n8 Y) Q+ Y( M3 |; u& f0, @3 R% e; v$ {+ m6 ?
    0* u8 c6 E" Q) c! ?
    -1

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

    b =; L5 v5 O0 E1 i# r2 C) |! o
    6

    5 |( d: u8 {0 Y
    12

    5 X- F2 d* Y/ m
    4

    3 b4 N7 Q% L( H" c* \6 W
    0

    : {2 {1 x& F0 o
    0

    ! n- Z* V) I( \6 G" |
    0


    / W6 g- l, @3 ?0 ^$ {4 f0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =/ s  \2 `. a' a1 _
    0.0000


    0 H% S& m! r3 a* j9 X/ R: `2.6667


    % V2 o& d! u+ E/ N2 O; n-0.0000


    6 g2 X. h5 Z* q. F! w' @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+ t- l/ b/ n, a
    !注释符号; 系统默认为自变量>0, 若不要求用free命令.


    ) r  ]( w1 _# _' p6 H!在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP+ H5 ~) m) x8 S) n
    2


    5 e" o4 Q+ q6 P1 ^" H" GOBJECTIVE FUNCTION VALUE


    . B0 G- p8 O* C; [1)
    # }, v$ K* y6 r( x145.0000


    9 g# e# B3 p) `, j  iVARIABLE6 ]+ y' |2 r8 i0 c/ u0 P3 Z3 C: F
    VALUE- C& |- A& ]! T
    REDUCED COST


    . d) e6 c! s6 L' W$ G5 a2 LX
    8 K: l6 H, N- H9 {7 e10.000000
    5 g! B* \. E) l- v# d5 ]* \0.000000


    $ y: g8 G9 Z& T0 tY
    % ^$ F3 ~/ D3 g5 ]3.000000: C' k; B8 s- o
    0.000000


    ( K% L8 ^/ O* u2 n, b  LROW
    : P/ t7 g' e& n$ o7 l' fSLACK OR SURPLUS
    , z  o1 d" X- F% B% NDUAL PRICES

    " [. ]$ m1 N: w  ]5 E; E1 z
    2)4 c# C/ P; t7 v7 `% B( n9 c
    0.0000003 \( O3 u' p- S2 o
    2.500000


    6 t4 L2 y/ X3 Z+ m3 U8 `3)& Q8 e4 A# t! A; Y: t7 k* P. M8 R
    9.000000
    8 S* F) A% }8 V! t6 m0.000000

    9 r4 i/ d' c$ v3 x9 M4 `
    4)& Z' ]& f4 Y8 X+ T! }
    0.000000/ a7 O( g' x" Q8 L( S* @" g) c
    7.500000


    8 z. Z- }6 I* j9 V/ F0 d+ XNO. ITERATIONS=
    7 @1 v9 r( N  ~7 I+ s1 f; F1 a2


    1 P7 f8 w! C) P6 nRANGES IN WHICH THE BASIS IS UNCHANGED:

    % C' f' b5 U4 l9 t8 R: N
    OBJ COEFFICIENT RANGES

    ! w, ^' O" T. Y  R5 g
    VARIABLE
    & u  t7 t5 t" s/ n  {8 b0 d& WCURRENT3 z8 U  `1 _( a! }2 B2 X
    ALLOWABLE1 L! t4 B4 @4 M3 N
    ALLOWABLE

    ) w' p7 Q! A+ R- b" z& |3 v1 X
    COEF
    & l8 y1 U/ l8 Q7 @5 iINCREASE" ~( n; j5 D" T
    DECREASE

    8 T$ F5 a" I! H
    X( \& f  X3 \. {: C
    10.000000
    ( m6 K+ f$ ?; x5 C3 ^INFINITY. h; \( g; ~4 ?, @
    2.500000

    " G& S2 Q. W- w2 U- Z& z! T% o
    Y; X7 H+ f  e# S3 ~. H9 Z
    15.000000
    . q4 T; k( N; h6 \3 U5.000000, i; _0 C& h# r7 u: }& `
    15.000000

    / p7 g) V9 ]1 k1 P! {% n
    RIGHTHAND SIDE RANGES

      p. D" ~- u! S7 r  `4 g7 T' @
    ROW/ s( \$ n5 G: P4 P5 K6 @
    CURRENT, }6 D" z2 O. c+ F" }: ?2 I5 O
    ALLOWABLE
      d: u' l' A5 r7 H8 n, QALLOWABLE


    % @; A9 [/ ?+ E; ?* |1 S/ V; QRHS8 e9 C$ r. g( ^4 ]$ t: o; x
    INCREASE& J: I: S1 B: K& x
    DECREASE


    % y1 Q" u& ~& M. o3 M; ], k& A. ]; c( U# _2 w
    22 D1 H7 y) H0 `  Z) d& E! W1 z
    10.0000006 z2 h7 z# c4 X4 l; M
    6.000000$ L9 ^8 F* o$ s. v
    10.000000

    ' i, }: q/ `1 x# {) |  A( [: ?
    3
    ; \8 q" ~! i9 X+ c. ]+ b- u12.000000. h2 n7 k2 l5 ]  ]/ k
    INFINITY
      z; Z' B: X2 ?& O& u8 k4 T2 W' x9.000000

    9 l( }( [6 ^- t5 f
    40 T' u, s" z7 l
    16.000000
    ) c, S4 J& H1 _18.000000# v2 Y! x- C7 t% @
    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;

    按运行按钮在solution3 F5 s+ `& S4 H" j
    report
    窗口得到以下结果:


    " k9 g5 I- t% t& `8 [$ Z4 o
    Global optimal solution found at iteration:
      c7 D$ z; ~- L7 z& u8 u- x2


    6 |! S- L: _" f& ~8 A  e' M$ cObjective value:
    - R  {5 U2 @9 [  t( ?7.750000


    6 C6 g0 s+ _" |' o0 I& uVariable
    ! q6 ?8 _2 _* q7 w# n. n; {5 tValue
    + P" k1 J- g+ jReduced Cost


    3 Y- v1 \& p9 O  |+ _4 ^X1
    3 ~4 i' l/ c; p$ i! p0.50000008 g$ P6 m% v! U8 P
    0.000000


    - f# I0 ?! r$ a1 Q7 }3 A: Y% q/ PX3
    2 x1 e2 s# K; i2 I) O7 N0.2500000' o: G' [6 P# c6 i
    0.000000


    ( _% r- }; l0 {/ J1 d) D+ |
    $ p3 L0 O6 `) h9 C4 hX2& \5 {, ^. O7 B
    0.000000
    , M! `; O7 H4 d4 {0.5000000


    ; g+ ?) ~7 g, Z! u$ k8 l$ K& {* GX4" G1 N# w- @! v2 n
    0.0000009 }1 Y' w+ s; y* M# {$ F" b1 e
    2.750000


    # v& L8 Y! i+ W& ZX5
    2 h. q9 C3 [  ~  }2 S6 R0.000000
    ) s2 B( F7 T9 I2.250000


    9 x: m& P) f2 V( W8 a" N4 i8 BRow* k2 I2 t8 ?! v
    Slack or Surplus, R4 F! r& s; m
    Dual Price


    8 @7 H- ~8 p* G! {! @& t& {) H1$ ?( Z+ Q* m0 A  f+ X) R- Q+ ^
    7.750000/ h5 \; g) ]0 v: U' r
    -1.000000


    " `7 T; N; w9 c5 v/ `5 d27 ?# z* y. Q6 j( S
    0.000000# }3 L2 _/ k1 q4 K
    -2.750000


    0 T9 Y* U, `2 Z, O3& Z9 b4 ]( p/ e2 P- O
    0.0000004 ?3 h3 @. p# W. O, [0 f: t
    -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;0 |! ~3 d/ D5 S6 e
    ! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:
    3 \3 }' P  ?: a; |4 z2


    ) c# `4 a2 n: X' d$ b2 KObjective value:
    6 B( g% `& {5 ~: x- c. A) e
    7 v+ x  x- j% {7 L5 K5 Q14500.00

    7 S5 A) A1 l* T! n7 U
    Variable
    $ g5 Y# n& L0 ^( P9 V; ~Value" I2 R( T3 V8 W$ w) U9 i8 O& g4 \  M
    Reduced Cost

    9 e0 X( t4 \3 T4 t- h
    X
    6 `0 n8 k, W( \$ l7 y8 D100.0000
    5 |) i- ]6 E+ d& s; V+ R0.000000


    " q1 }) H. d; |' OY2 q- V2 ]  J# f' l$ m4 {) J2 e6 r# w
    30.00000
    5 V" D. H5 }4 L5 Y9 t1 x% [0.000000


    + a, N1 y' R3 a  O; p  I8 L$ CRow
    1 R: i# U5 |3 e- ^5 ESlack or Surplus2 ?/ c  X5 }  L! T. y
    Dual Price


    0 M3 i( g+ D: I4 A5 F# T1
    6 X8 |1 k" M8 D. X14500.00- Y; c' q0 l* \+ M" w* i" l+ C
    1.000000

    ; V2 M- m1 i# T
    2/ A! d4 l8 p, e7 M4 ^" e0 B
    0.000000
    " |/ Z* ~; o7 `) b5 W9 p25.00000

    & u# m2 {9 a6 A2 d* R+ Z$ g1 C
    3
    : r+ n) a$ |( @# `" n90.00000
    0 [6 [" p5 H) K  k0.000000

    4
    * Q2 m+ l  B, `/ K- h0.000000
    6 a4 }& u) I. h2 d+ g0 W3 M
    " f) C8 a3 X" G& 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, 2025-5-15 09:22 , Processed in 0.428420 second(s), 59 queries .

    回顶部