QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 3782|回复: 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 =
    # M8 b& h- \! f  Z7 U6 i0 o-2


    ! Z) Z$ c. k+ G-1

    1 ?- f$ H' W% N. q" Q2 Q
    3

    % c( z7 U3 y) A1 H0 T2 Q
    -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 =( b4 B* o; g/ \  m, k! l6 Z
    1
    ! D% r. R1 I9 j1 d; c  G* D2: W. q( j# z( H5 I. a( i, v9 Q1 q
    4
    : t/ `! B9 Q% ]6 {' K-1

    ( i: A2 g, f4 y, s% P' J
    23 y6 ^6 w' `% J' ~
    3  l, H; Z& H$ j8 N' R
    -1% E  ~1 z6 V% S6 ]
    1

    % l# \$ h: W/ b% i( Y
    1
    / m% R0 h- F$ ?+ W3 Z9 l5 R0
    1 @" y; U( R5 \; ~/ f1
    ! {0 T5 ~( N) @3 v7 _: {5 K1

    ! h. w1 ?& {/ D1 X4 Z& A7 s& ?
    -1
    " C( G/ ^% M  j4 ?) ?: j+ h& m: ~0% d- _3 M/ C* {
    0
      |* N, N" J3 m  V! t, p/ o0


    7 p. J7 h, ~  P2 x! b0
    1 n6 u0 |! b1 k# n2 x2 a& |" u-1  _( \% C$ v* K
    08 q9 f4 p) a) g* [* a( ?
    0

    ; U( L4 o* j5 S$ [; ^! S- Q3 f8 x
    00 E6 f% v* D2 \1 v
    0$ [; D7 z- `% O
    -1
    . Z  K; G7 p$ Y7 q, [2 [, j0


    3 _2 e; C. ^# F: n3 u6 d% E06 ]. `% m5 w/ ~: [7 k
    0
    # w8 y6 h; f! a0; [7 H7 b. d2 N' c+ U
    -1

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

    b =  f2 T. W8 c7 E, d- q5 X! J
    6

      w: \/ v# U& D/ e) a
    12

    ) W/ E* D# g3 `" u( E6 P7 I$ m1 ^
    4


    / e& u( P5 R; I4 r" c  k% M# ]0 m2 G- c0


    - K- r2 E; V% K+ n+ n0 c1 c0


    5 }% m5 U" v9 K  L( R- R$ h( f0


    " M$ I) V5 P: @' e7 G0

    Optimization terminated successfully.

    The optimization solution of the programming is:

    x =
    0 {# m7 u9 N5 p2 p3 B7 W0 q0.0000

    , C4 |( Y3 `% s2 s0 K% K( T0 c
    2.6667

      j" X: M) @- L( o8 N
    -0.0000

    - t) A0 D' N1 U
    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
    ( D. {+ N' K$ Y+ M6 @5 @!注释符号; 系统默认为自变量>0, 若不要求用free命令.


    & \/ k* n0 h- F2 I; X!在出来report windows之前可选择显示对此规划进行灵敏度分析等

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

    LP OPTIMUM FOUND AT STEP. D7 {+ A2 b* X& x9 Q+ I6 E
    2

    ) _5 F) x) a5 m$ L) G9 W
    OBJECTIVE FUNCTION VALUE

    " l: s/ [# @- `
    1); G% e# T1 H5 a( w0 r7 [
    145.0000

    7 I0 W& {( @' w" l
    VARIABLE
    ' m! w0 K0 z* b1 @0 E# C# I/ JVALUE
    & t& W  z) j& e! t1 n+ gREDUCED COST

    # }6 `$ [6 N  l8 v+ G
    X
    # t0 l) W$ q( l/ g10.0000007 N6 C5 j& Y- ^+ |4 S& M1 t3 c5 v
    0.000000


    5 S+ e- \+ o3 o* M& G$ pY0 g8 F8 J$ r% V" r# S
    3.000000
    6 Q$ h: _" d! d, `/ Y6 V0.000000

    % c5 R& K, A- ?  c2 e  R, D# M
    ROW. i2 q4 d% o* t" W% @7 r; R4 P
    SLACK OR SURPLUS/ X/ m' b! [& h/ o* r. x: \
    DUAL PRICES


    * A- u) S: q0 Q  {: B2)
    * \4 L! ?" e, K0.000000) J& m. d& h4 i2 b& g
    2.500000


    ! f2 X- t1 e. P1 y. Y% d3)
    ' t5 ^+ [" @  h& E0 \! F9.000000
    ; J* K/ h+ w" I: z0.000000

    2 Y3 \& q: \+ B& g6 t0 H$ `
    4): Y1 v' D- J1 c0 Q0 A
    0.000000: y5 X# i7 Y, [( X: d5 O# I
    7.500000

    9 P" s9 x5 _( r) V
    NO. ITERATIONS=
    7 h0 i2 d9 |. S! {) u# J! L2 Y2


    , c  i8 O6 l$ A. Q6 [. o$ ARANGES IN WHICH THE BASIS IS UNCHANGED:


    / J+ D8 {5 P4 r; N% K6 r/ nOBJ COEFFICIENT RANGES

    2 h$ G' I2 L! |1 I. z4 }. I
    VARIABLE
    - \9 |  [- s! ]/ V2 MCURRENT
    3 X9 ?. P( o' F: qALLOWABLE
    # v+ v1 l% X9 f1 |  l4 ?8 K) `, PALLOWABLE

    7 U/ o) e3 ^! w' M# w  ~1 \
    COEF
    - @" C$ k/ H) T. G+ tINCREASE; {& D3 K6 [, t, @2 v3 m  ?
    DECREASE

    ; P0 u) V& z! E# {. P" r$ L# H
    X
    & B  V( j. t# y0 Y- a10.000000; ~. w4 h& @% c" i7 t) O
    INFINITY, v3 n7 S9 r0 C$ p
    2.500000


    5 h3 ^" c5 y5 H- d3 _: d( p+ DY
    8 o; g- c( `* I1 I15.000000
    / W8 f/ J3 E8 |' }% K$ y% B# l! y5.000000/ Q8 \1 q9 n/ s6 J' O2 s
    15.000000

    6 M3 z4 d- y% `7 }7 L$ g
    RIGHTHAND SIDE RANGES

    4 b! w" v" v$ O/ K2 R1 ^1 R- Y
    ROW
    ) f" T/ J) N* q# u- _- P, JCURRENT
    . |% j: ~1 Y7 w8 UALLOWABLE
    7 B) Q4 A8 Q0 F) ~) s9 e8 MALLOWABLE


    & E8 ~$ _# M/ w. l! G9 l+ {! YRHS' i2 H; o) G* z9 C" U- r9 I
    INCREASE! X  y0 L! n% k9 [
    DECREASE

    4 v% _8 o' F' [% t9 ~

    ) W# D% h# w+ V& l* D* p* B7 j2
    0 O7 f* A' T; {9 f4 T3 i! |10.000000" h7 @* R( c  [0 o
    6.000000, W: x& L+ F( a# H9 N$ L8 c
    10.000000


    " D. h3 i9 n+ D2 |& m; V3
    7 q  r  C/ A6 B3 I: v: `12.000000
    $ O$ ^2 h' G; t/ g+ IINFINITY# U  d4 J1 w& p. d, S
    9.000000

    . L8 y7 x' P, h1 A
    4
    , P  l3 k# l7 ?7 e$ f: D! [8 i. M16.000000
    ' v% V/ k- v5 {* T! e6 z3 Q18.000000
    # z& C7 E5 ]4 S0 o1 A6.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
    . P; R) t# P1 R1 d9 }, Rreport
    窗口得到以下结果:


    ( K/ A- h3 k# A' |0 J
    Global optimal solution found at iteration:
    2 A  x% q7 y, G( @' v$ K# q5 v% L2

      e6 M, e' D4 N3 r" @- O
    Objective value:- u' G1 I2 O3 P7 l0 C
    7.750000

    - c/ m. M* Q' b: z: L
    Variable7 B( _8 i9 v6 u% M; H
    Value
    ' j! D0 f, J* L4 CReduced Cost

    : a+ |. v4 E* Q9 Y; q/ I; R
    X1- O8 D/ [+ }6 U0 u% h
    0.5000000& `7 R/ z! y, a5 y% a$ D; d) [* ^
    0.000000


    + g4 h7 C9 |; Q/ ~- e9 V1 WX3
    # K* f$ [; ^+ M4 h) v5 u3 s0.25000008 V. K% K% B9 T  q) ?! A
    0.000000

    % Z' E/ \  l/ w

    9 D- S& z' s; \* ~, U, A/ G9 F$ U. eX2
    : P2 ?. [( m: {/ a. q- I- q0.000000+ W8 n0 X, J# S# u& N) Q
    0.5000000

    7 @. e3 b% e; f, W! W& V/ h
    X47 Y. _5 ~) t9 P0 S
    0.000000- Y+ b6 Q1 a7 R! D/ I
    2.750000


    + }, C; j! Z% z- I1 D" {X5( \, v" r6 L/ k
    0.000000/ Y0 y9 W  W/ g, }
    2.250000


      `  O" C* q- T5 h6 x# u- |4 aRow+ `# `: j  a; ~$ \
    Slack or Surplus
    1 l" Z/ |; Q1 ^: q4 MDual Price

    + w+ f8 r4 _" v$ _. Z# r9 G
    19 ]& P0 C( D7 z/ r
    7.750000
    2 r) j# a! |; I7 O0 d-1.000000

    $ u3 B  ^$ ]3 G+ g
    2
    - C% q" P3 Q$ Y& g2 i, O! x0.000000/ Z8 g" b7 h' x- {- k6 w
    -2.750000

    ; Q0 y1 y! d. \4 i* e  z( g
    3
    ( v# h6 b3 v, i( C$ E0.0000007 s# g3 q6 e+ v  h
    -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;
    , d8 q/ g; E$ r' S: ?8 ~8 X; q! this is a commnent;

    x<=100;

    y<=120;

    x+2*y<=160;

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

      Global optimal solution found at iteration:9 R; J' y( z: E0 P3 Q
    2


    # w% K8 c0 Q3 o0 G/ h; h2 F% v( Y. wObjective value:
    ' B* K# L+ Z0 D% F) M7 L  Q; Q9 N- M8 J. r3 B% d
    14500.00

    4 w7 |  n2 `4 D6 m( d/ J
    Variable3 ~2 H) k7 y6 M
    Value
    & ?, q: y$ M. A! cReduced Cost

    9 t% S# h+ W8 B7 N7 u
    X
    : j" I( v$ u9 q0 N100.0000
    9 x4 ]" c' n, N; ^; x7 z0.000000

    1 w$ Y; T$ K" s( O) k9 w
    Y
    3 @' ?) u& B3 F, B30.00000/ r$ l% W5 v& f! ^% S, X; o
    0.000000

    * Y% p$ u( n- j2 }2 D
    Row
    ; O) V9 o6 e* M1 ?Slack or Surplus/ g; y  f6 u0 s
    Dual Price

    * V" e! y5 Y$ W3 S- z& [! ]5 b
    1# S' X& Z/ N7 S/ m/ A8 G* H# b1 Y
    14500.006 B7 N$ N5 V; q& K1 h0 N
    1.000000


      V' E( q7 H6 U  L0 J8 J0 U2: Z: n8 [& J9 U
    0.000000& }6 U; P+ |- v' Q  F% B
    25.00000


    ; g% G) ]. h0 Z7 |0 t% v' A9 C/ ^5 D3
      {* A, z& S& m90.00000
    3 M/ C/ c$ v6 v2 b3 j7 n' j) ]* p; v0.000000

    4" J1 {& ?. H, }" j4 u8 [. U
    0.0000003 m. S8 O! q- L/ t, M
    * j8 l$ P, h0 i  h, u# f9 q  w
    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-8-4 23:40 , Processed in 0.445951 second(s), 60 queries .

    回顶部