QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3736|回复: 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 =
    ; F( j6 ~4 |; ?5 Q# B-2


    / J* d' z3 d% f2 d( f" f2 x-1


    ' z& @+ Y, c8 A; u# s3


    ' n. F( F1 B; E/ u# J3 @) ]-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 =
    : V; w. `) a/ ?7 Y# ~: T" W1
    * Y* g# ^6 |  a6 G( H2; I+ C) B9 l( I  _9 j" ?' T
    4
    7 p7 ^  Y! \8 Z6 k9 _-1

    9 ?! K7 G4 F: g$ z4 }4 w
    2
    / u. x5 j0 {* y* l! U# N3
    % c2 g( E& N/ S* U-1
    8 H2 m, \' V5 `, v1

    & I2 O0 O, b! Y+ X! Y9 u, o$ [
    1/ N6 ~2 [6 r! T0 q7 d/ j  E
    02 h1 d  j! ?9 a
    1: w/ a. c3 v7 b
    1

    " G2 r1 h) Q$ d1 L
    -1# J" v/ Y: R4 u' X) t$ T2 D: ^
    0
    % f5 ?% f3 O+ e( w5 v2 S0/ J1 ^) Q' _) h4 @+ p/ \
    0


    ) {& ]" d6 S0 B$ n09 ~6 Q( b0 z% C1 {$ I& b
    -1% k( S1 S% k  T) }) n& q# ]
    0# ^9 t& V$ b+ G1 g3 h& y6 Q0 Q
    0


    ' R+ V4 O! w9 R) i7 s4 Q0: R& p& C7 w3 E* q/ z, R9 g
    09 G! Q5 V) z. f9 W  [+ F
    -10 u7 U" Z3 G4 s4 |8 ]3 Y! L
    0


    & L$ ?- f. C6 j. S& t+ `% n00 I, V- Q. {* ~. G
    0
    2 V+ U/ c* o9 L% {  Y3 j/ W0
    % L, l+ j( ~( V8 x6 {  y) ?% A: i8 Q-1

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

    b =
    4 `, i$ j; ]2 }+ q" a6


    1 z2 x' \8 ~- Q2 K6 S12

    4 W+ t% b; ~/ O0 q( ~# z# l
    4

    3 ], I# f; g; r8 E# L) B6 C  \3 Q
    0

    9 C! D7 Y6 G+ I2 C: @) q
    0

    4 b9 o; [, L, r& b( `
    0


    & p- ]0 K1 F; l; M  ~0 T0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =
    . _6 N7 ]/ a1 `6 X8 E* |0.0000

    9 l3 z, T4 P% a
    2.6667

    # X+ g) x- _' ?! s" r; c5 j: p
    -0.0000

    # h8 |2 a; k* r
    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
    + j5 F8 T9 w" G!注释符号; 系统默认为自变量>0, 若不要求用free命令.

    + o) C% t* x7 ^$ g( A
    !在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP! u. f, M3 Z- A3 k5 ]# i
    2

    6 e4 ?3 z( j+ x7 E( u
    OBJECTIVE FUNCTION VALUE


    6 \; h) Z: g5 z$ i5 U6 I; P2 R1)
    4 i  v3 k: Y+ A- t# G145.0000


    3 T$ k! y4 e8 q. `VARIABLE
    9 G7 Z. g. p! O2 C" O' Z# {& UVALUE# W/ T3 o4 I2 E: C1 O" j2 K: H5 ]
    REDUCED COST


    ' _8 t5 r, _" k; f3 K$ lX
    2 ^: V8 x0 H% ?4 i$ x  O10.000000
    + ]3 C5 G- u: t/ r0.000000

    9 n) _" X2 k- Y2 G5 I. Y3 u
    Y7 q# L/ t$ p/ R' @  a/ g/ j! O7 L
    3.0000008 U- P! d5 P' o! |* h
    0.000000


    / j; r7 g1 ?! ~3 r% e: v3 ~ROW( j, y0 d0 [# N; N
    SLACK OR SURPLUS4 V1 Y6 S% Z' y3 e; h
    DUAL PRICES


    3 N( r+ L% k* {/ q! w2)$ ^6 t1 g1 y) B4 A3 n
    0.000000
    1 g4 S- x* h) S8 ~8 e2.500000

    : \+ K1 F) Q/ f
    3)
    3 n& B5 z  o- |; l* t2 |, Z( Z; P$ M9.000000- u' x* t( M* c6 c: Q$ g) e
    0.000000


    4 G, |  L9 c: Z2 }4)( _! _$ k. {8 Q% J* h6 a
    0.0000001 y/ ~- r2 v4 u; }# @6 l6 U
    7.500000


    ( s0 t- s* ?; R* g) q8 FNO. ITERATIONS=
    1 P% h4 h* H; m! D2


    4 @) X6 T# u2 Q* n  l2 r/ e' iRANGES IN WHICH THE BASIS IS UNCHANGED:

    8 k% q3 P( q" S9 {/ ]' a
    OBJ COEFFICIENT RANGES


    " g. Y* ^& }; v1 eVARIABLE3 I4 [3 Z# L% j# ^
    CURRENT
    0 i& _  u$ ^& g' L! sALLOWABLE
    6 i3 e+ |8 ^$ V+ b7 Z: v1 ?+ Z6 QALLOWABLE


    9 E' c: t& S/ b  MCOEF
    2 d5 e- ^4 V" e2 C2 J5 ?+ cINCREASE- ^  |3 Q# c8 C8 k
    DECREASE

    + g1 w. ~0 _1 e3 e6 d& a
    X) }# M" n" \/ ]. r' @5 S: X* U
    10.000000
    1 f6 d; o' Q8 y  jINFINITY
    7 ?& j5 k& k6 U$ G2.500000

    . }* C: |2 Q  k5 [* ]
    Y. p) l- P2 P) }9 s5 s3 A# Z+ E2 y
    15.000000. m" h. |" O: m: [0 |
    5.000000; P' {2 V4 X9 S6 \& G+ b3 O: S
    15.000000


    6 _! J8 T: r6 b3 jRIGHTHAND SIDE RANGES

    # O8 @; F1 l' l
    ROW! ]) {( |: s. @( \4 h- K' z- {
    CURRENT
    ' k9 w3 e5 i* a/ c9 j5 CALLOWABLE
      C4 R8 Z5 I- P+ B, KALLOWABLE

    / C0 i) n- S- c  S
    RHS0 m# @. s/ E2 |4 j+ d) O
    INCREASE# N8 ^% r+ I& F( F' R( ^
    DECREASE

    & B" @; q' b% ]9 u5 `
    ! M9 v* P( P8 ?  {) O# L
    2. H3 {* G6 B  _: f8 A3 V0 o& q% n" N
    10.000000
    9 u* b' H, j* f3 x( @6.000000
    7 W0 y, `# ^8 e10.000000


    4 O! @3 w8 ]( ~: ^- G8 x3
    9 b7 U& D0 w8 p- q! Y, K12.000000
    / Z- l& G9 z) D; BINFINITY9 |% C" K' L8 D& e4 e1 J% K% v" `
    9.000000

    5 s+ a9 `; e# |: T3 c
    41 H3 ?  d4 m; y; V
    16.000000
    ; g. b, S0 F( d1 F! v18.000000# N4 s% b0 X2 Z1 L
    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+ D; Z6 U+ V' q5 E
    report
    窗口得到以下结果:


    : x1 K2 V" B5 r8 Y  q! `- j2 O. R/ G& E
    Global optimal solution found at iteration:
    & A6 _  s, b) y% h: f2


    . E% ^6 }& N7 b* d: Z# x. w4 ^. |Objective value:
    ( {/ R7 q+ `$ r8 o/ X0 T- V) g7.750000

      t+ D- b% c' i
    Variable- _; J) A+ M7 k' ~+ }( ~2 z: m8 f
    Value. g, ?" B9 y3 v! X3 V* k: U7 ^
    Reduced Cost


    ( J% i- k5 v6 J- {1 a5 E1 LX1
    ) F; r6 P+ w7 j( T! [  d( [0.5000000* }/ g3 T) |  r
    0.000000

    " d9 e4 B5 \1 v0 `- z' [
    X3
    . V5 n  k. ?6 a. H0.2500000! I: n+ r+ l3 N: [3 ?3 s
    0.000000

    8 d% l9 @, q/ v
    ) E0 Z2 b9 k  r) ^2 Z, P- o
    X2& f% W; M% W* c( g
    0.000000) @7 r. d! o6 D$ E. U3 c" \
    0.5000000


    . R3 s; c4 H+ }0 S0 LX4
    . b. g  Z3 t9 d1 X/ [9 S0.000000
    % `& w8 V1 @# _/ u. M2.750000

    ( O  g% U2 s9 C/ c
    X5
    8 C1 m, Z" u$ ^( O  q6 c0.0000001 H, a6 F4 V& K: A7 D* K
    2.250000

    " R5 Q& b# n2 ?/ ^1 C
    Row7 v1 S! \8 [! |" ]! o8 K
    Slack or Surplus
    2 F! N( O2 k* Y$ H- v4 ^Dual Price

    + @7 G) o( @% L2 X
    13 W. t, R  Y0 N% N; Q  J% g
    7.750000' j" p/ Q0 g( P
    -1.000000


    2 e  x/ T* h; p& v* B$ ]6 g2
    * F+ \3 b$ ^: y$ j8 I7 B0.0000007 Z! E+ p% ^' J2 Z
    -2.750000

    ; [+ M8 T( N0 B, T2 p9 R& o- t
    3, c& J0 Q" f/ E" V* A# @( N1 P
    0.000000
    3 s  H6 @5 e6 G* L% X% B& H: q-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;
    8 ?/ Z$ ~- W. b! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:; b  l/ |" E) w( h
    2


    8 M6 W5 K6 d) aObjective value:
    ; L7 t/ k, `- p* \2 a3 T9 [
    , S! Q6 {3 d0 m5 |5 f' r0 a14500.00

    ; G: ?" N  x$ O0 T' A$ F
    Variable3 j; B/ z3 N' d* x, i* U0 P
    Value. V" z% w) o: ^" o8 S, o! H
    Reduced Cost


    ( G0 z( Q4 a- LX
    1 J% ?) Q7 U5 {( Y5 W! T: }5 w100.00005 G9 R# Y! D$ C. D
    0.000000

    9 H- i# u: {  ^; p% m
    Y9 B3 ]/ e1 Q- W% T8 ~
    30.00000
      r; W" J; E0 U7 o( y3 _% B0.000000


    & ]) ~/ A% a& `0 g/ R0 j% JRow1 I9 c% n- N8 d/ T2 c
    Slack or Surplus9 Q8 |5 L- |! r% r. b
    Dual Price


    " V  F2 L! I; c. h6 K' _3 O5 t) O4 L1
    ) a" t+ y( Y# ~! G+ e7 S14500.00
    : s, f5 [3 L- y" R1.000000

    ( z; U/ w4 H# B5 P, h; O
    28 f  n+ R$ }4 |& d
    0.000000
    ) Z; }' J8 S6 v  M25.00000


    - x& X! x) B7 A  |  @3( S; y- X/ d, o/ n8 Z! X* g
    90.000001 ]$ j. H4 Y4 ~$ W* N* Q
    0.000000

    4
    % Z# D$ x5 P  T# `0.0000006 p5 g' n* ~5 G( W( R% I% z7 f4 k5 _
    " w3 e) `- H9 x9 ?
    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 03:04 , Processed in 0.417365 second(s), 60 queries .

    回顶部