Answer

问题及解答

供应与选址

Posted by haifeng on 2018-03-25 10:14:44 last update 2018-03-25 10:29:59 | Edit | Answers (1)

某公司有 6 个建筑工地要开工, 每个工地的位置(用平面坐标系 $a,b$ 表示, 距离单位: km) 以及水泥日用量 $d$ (单位: 吨 (t)) 由下表给出.

工地位置 $(a,b)$ 及水泥日用量 $d$
  1 2 3 4 5 6
横坐标位置 $a$ 1.25 8.75 0.5 5.75 3 7.25
纵坐标位置 $b$ 1.25 0.75 4.75 5 6.5 7.75
水泥日用量 $d$ (吨, t) 3 5 4 7 6 11

 

目前有两个临时料场位于 $A=(5,1)$, $B=(2,7)$, 日储量各为 20 吨.

假设从料场到工地之间均有直线道路相连.

(1) 试制定每天的供应计划, 即从 $A,B$ 两料场分别向各工地运送多少吨水泥, 使总的吨千米数最小.

(2) 为了进一步减少吨千米数, 打算舍弃这两个临时料场, 改建两个新的料场, 日储量仍都为 20 吨. 问应建在何处, 使得吨千米数最小? 节省的吨千米数为多少?

 

References:

赵静, 但琦 等编 《数学建模与数学实验》第四版, P56--61.

1

Posted by haifeng on 2018-03-25 10:55:45

使用 Lingo 编程


(1) 使用临时料场. 此时问题是线性规划问题.

Lingo 代码:

model:
Title 供应与选址;
sets:
    gongdi/1..6/:x,y,d;
    liaochang/A,B/:xx,yy,e;
    links(gongdi,liaochang):c;
endsets
data:
    x=1.25 8.75 0.5 5.75 3 7.25;
    y=1.25 0.75 4.75 5 6.5 7.75;
    d=3 5 4 7 6 11;
    e=20,20;
    xx=5,2;
    yy=1,7; !说明: 改建两个新料场时这两句应注释掉;  
enddata

min=@sum(links(i,j):c(i,j)*((xx(j)-x(i))^2+(yy(j)-y(i))^2)^(1/2));

@for(gongdi(i):@sum(liaochang(j):c(i,j))=d(i));
@for(liaochang(j):@sum(gongdi(i):c(i,j))<=e(j));
end

 


运行结果:

  Global optimal solution found.
  Objective value:                              136.2275
  Infeasibilities:                              0.000000
  Total solver iterations:                             1
  Elapsed runtime seconds:                          0.09

  Model Class:                                        LP

  Total variables:                     12
  Nonlinear variables:                  0
  Integer variables:                    0

  Total constraints:                    9
  Nonlinear constraints:                0

  Total nonzeros:                      36
  Nonlinear nonzeros:                   0

 

  Model Title: 供应与选址

                                Variable           Value        Reduced Cost
                                   X( 1)        1.250000            0.000000
                                   X( 2)        8.750000            0.000000
                                   X( 3)       0.5000000            0.000000
                                   X( 4)        5.750000            0.000000
                                   X( 5)        3.000000            0.000000
                                   X( 6)        7.250000            0.000000
                                   Y( 1)        1.250000            0.000000
                                   Y( 2)       0.7500000            0.000000
                                   Y( 3)        4.750000            0.000000
                                   Y( 4)        5.000000            0.000000
                                   Y( 5)        6.500000            0.000000
                                   Y( 6)        7.750000            0.000000
                                   D( 1)        3.000000            0.000000
                                   D( 2)        5.000000            0.000000
                                   D( 3)        4.000000            0.000000
                                   D( 4)        7.000000            0.000000
                                   D( 5)        6.000000            0.000000
                                   D( 6)        11.00000            0.000000
                                  XX( A)        5.000000            0.000000
                                  XX( B)        2.000000            0.000000
                                  YY( A)        1.000000            0.000000
                                  YY( B)        7.000000            0.000000
                                   E( A)        20.00000            0.000000
                                   E( B)        20.00000            0.000000
                                C( 1, A)        3.000000            0.000000
                                C( 1, B)        0.000000            3.852207
                                C( 2, A)        5.000000            0.000000
                                C( 2, B)        0.000000            7.252685
                                C( 3, A)        0.000000            1.341700
                                C( 3, B)        4.000000            0.000000
                                C( 4, A)        7.000000            0.000000
                                C( 4, B)        0.000000            1.992119
                                C( 5, A)        0.000000            2.922492
                                C( 5, B)        6.000000            0.000000
                                C( 6, A)        1.000000            0.000000
                                C( 6, B)        10.00000            0.000000

                                     Row    Slack or Surplus      Dual Price
                                       1        136.2275           -1.000000
                                       2        0.000000           -3.758324
                                       3        0.000000           -3.758324
                                       4        0.000000           -4.515987
                                       5        0.000000           -4.069705
                                       6        0.000000           -2.929858
                                       7        0.000000           -7.115125
                                       8        4.000000            0.000000
                                       9        0.000000            1.811824