使用 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