lingo模型定义出错问题model: sets: center/1..3/:u; addr/1..7/:v; w(center,addr):x,y;endsets data: y=36 24 49 21 81 72 4530 20 56 24 99 88 5536 24 63 27 90 80 50 ;enddatamin=@sum(w:x(i,j)*y(i,j));@sum(addr:x(1,j))=3;@sum(addr:x(2,j))=2;@sum(a
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 19:50:00
lingo模型定义出错问题model: sets: center/1..3/:u; addr/1..7/:v; w(center,addr):x,y;endsets data: y=36 24 49 21 81 72 4530 20 56 24 99 88 5536 24 63 27 90 80 50 ;enddatamin=@sum(w:x(i,j)*y(i,j));@sum(addr:x(1,j))=3;@sum(addr:x(2,j))=2;@sum(a
lingo模型定义出错问题
model:
sets:
center/1..3/:u;
addr/1..7/:v;
w(center,addr):x,y;
endsets
data:
y=
36 24 49 21 81 72 45
30 20 56 24 99 88 55
36 24 63 27 90 80 50 ;
enddata
min=@sum(w:x(i,j)*y(i,j));
@sum(addr:x(1,j))=3;
@sum(addr:x(2,j))=2;
@sum(addr:x(3,j))=2;
@for(addr:@sum(center:x(i,j))=1);
@for(w:@bin(x));
end
这是一个消防车调度问题 ,三个消防中心往7个失火点派车,每个失火点一辆车,三个中心分别有3,2,2辆消防车,lingo程序运行之后提示
请问该怎么改?
lingo模型定义出错问题model: sets: center/1..3/:u; addr/1..7/:v; w(center,addr):x,y;endsets data: y=36 24 49 21 81 72 4530 20 56 24 99 88 5536 24 63 27 90 80 50 ;enddatamin=@sum(w:x(i,j)*y(i,j));@sum(addr:x(1,j))=3;@sum(addr:x(2,j))=2;@sum(a
model:
sets:
center/1..3/:u;
addr/1..7/:v;
w(center,addr):x,y;
endsets
data:
y=
36 24 49 21 81 72 45
30 20 56 24 99 88 55
36 24 63 27 90 80 50 ;
enddata
min=@sum(w:x*y);
@sum(addr(j):x(1,j))=3;
@sum(addr(j):x(2,j))=2;
@sum(addr(j):x(3,j))=2;
@for(addr(j):@sum(center(i):x(i,j))=1);
@for(w:@bin(x));
end
结果:
Global optimal solution found.
Objective value: 329.0000
Objective bound: 329.0000
Infeasibilities: 0.000000
Extended solver steps: 0
Total solver iterations: 0
Variable Value Reduced Cost
U( 1) 0.000000 0.000000
U( 2) 0.000000 0.000000
U( 3) 0.000000 0.000000
V( 1) 0.000000 0.000000
V( 2) 0.000000 0.000000
V( 3) 0.000000 0.000000
V( 4) 0.000000 0.000000
V( 5) 0.000000 0.000000
V( 6) 0.000000 0.000000
V( 7) 0.000000 0.000000
X( 1, 1) 0.000000 36.00000
X( 1, 2) 0.000000 24.00000
X( 1, 3) 1.000000 49.00000
X( 1, 4) 0.000000 21.00000
X( 1, 5) 1.000000 81.00000
X( 1, 6) 1.000000 72.00000
X( 1, 7) 0.000000 45.00000
X( 2, 1) 1.000000 30.00000
X( 2, 2) 1.000000 20.00000
X( 2, 3) 0.000000 56.00000
X( 2, 4) 0.000000 24.00000
X( 2, 5) 0.000000 99.00000
X( 2, 6) 0.000000 88.00000
X( 2, 7) 0.000000 55.00000
X( 3, 1) 0.000000 36.00000
X( 3, 2) 0.000000 24.00000
X( 3, 3) 0.000000 63.00000
X( 3, 4) 1.000000 27.00000
X( 3, 5) 0.000000 90.00000
X( 3, 6) 0.000000 80.00000
X( 3, 7) 1.000000 50.00000
Y( 1, 1) 36.00000 0.000000
Y( 1, 2) 24.00000 0.000000
Y( 1, 3) 49.00000 0.000000
Y( 1, 4) 21.00000 0.000000
Y( 1, 5) 81.00000 0.000000
Y( 1, 6) 72.00000 0.000000
Y( 1, 7) 45.00000 0.000000
Y( 2, 1) 30.00000 0.000000
Y( 2, 2) 20.00000 0.000000
Y( 2, 3) 56.00000 0.000000
Y( 2, 4) 24.00000 0.000000
Y( 2, 5) 99.00000 0.000000
Y( 2, 6) 88.00000 0.000000
Y( 2, 7) 55.00000 0.000000
Y( 3, 1) 36.00000 0.000000
Y( 3, 2) 24.00000 0.000000
Y( 3, 3) 63.00000 0.000000
Y( 3, 4) 27.00000 0.000000
Y( 3, 5) 90.00000 0.000000
Y( 3, 6) 80.00000 0.000000
Y( 3, 7) 50.00000 0.000000
Row Slack or Surplus Dual Price
1 329.0000 -1.000000
2 0.000000 0.000000
3 0.000000 0.000000
4 0.000000 0.000000
5 0.000000 0.000000
6 0.000000 0.000000
7 0.000000 0.000000
8 0.000000 0.000000
9 0.000000 0.000000
10 0.000000 0.000000
11 0.000000 0.000000