请各位高手看看我的LINGO程序错误在哪?错我提示为12。但我找不到错误
sets:document/a1..a8/:size;datatraveler/b1..b5/:capacity;links(document,datatraveler)...
sets:
document/a1..a8/:size;
datatraveler/b1..b5/:capacity;
links(document,datatraveler):c
endsets
!目标函数;
max=@sum@sum(size(I)*c(I,J)/capacity(J));
!约束条件;
@for(document(I):
@sum(datatraveler(J):c(I,J)=1);
@for(datatraveler(J):
@sum(document(I):c(I,J)*size(I)<=capacity(J));
size(I)>0
capacity(J)>0;
data:
size=0.08 0.3 0.6 1.4 2.8 3.2 4.5 5.6;
capacity=2 4 8 12 16;
@for(links:@bin(c));
enddata
end
还有,到底怎么编写双求和符号的程序?也就是两个求和符号连乘 展开
document/a1..a8/:size;
datatraveler/b1..b5/:capacity;
links(document,datatraveler):c
endsets
!目标函数;
max=@sum@sum(size(I)*c(I,J)/capacity(J));
!约束条件;
@for(document(I):
@sum(datatraveler(J):c(I,J)=1);
@for(datatraveler(J):
@sum(document(I):c(I,J)*size(I)<=capacity(J));
size(I)>0
capacity(J)>0;
data:
size=0.08 0.3 0.6 1.4 2.8 3.2 4.5 5.6;
capacity=2 4 8 12 16;
@for(links:@bin(c));
enddata
end
还有,到底怎么编写双求和符号的程序?也就是两个求和符号连乘 展开
展开全部
错误比较多,恕不一一指出,修改后的代码:
model:
sets:
document/a1..a8/:size;
datatraveler/b1..b5/:capacity;
links(document,datatraveler):c;
endsets
!目标函数;
max=@sum(datatraveler(J):@sum(document(I):size(I)*c(I,J))/capacity(J));
!约束条件;
@for(document(I):
@sum(datatraveler(J):c(I,J))=1);
@for(datatraveler(J):
@sum(document(I):c(I,J)*size(I))<=capacity(J));
data:
size=0.08 0.3 0.6 1.4 2.8 3.2 4.5 5.6;
capacity=2 4 8 12 16;
enddata
@for(links:@bin(c));
end
运行结果:
Global optimal solution found at iteration: 0
Objective value: 3.274167
Variable Value Reduced Cost
SIZE( A1) 0.8000000E-01 0.000000
SIZE( A2) 0.3000000 0.000000
SIZE( A3) 0.6000000 0.000000
SIZE( A4) 1.400000 0.000000
SIZE( A5) 2.800000 0.000000
SIZE( A6) 3.200000 0.000000
SIZE( A7) 4.500000 0.000000
SIZE( A8) 5.600000 0.000000
CAPACITY( B1) 2.000000 0.000000
CAPACITY( B2) 4.000000 0.000000
CAPACITY( B3) 8.000000 0.000000
CAPACITY( B4) 12.00000 0.000000
CAPACITY( B5) 16.00000 0.000000
C( A1, B1) 0.000000 -0.4000000E-01
C( A1, B2) 1.000000 -0.2000000E-01
C( A1, B3) 0.000000 -0.1000000E-01
C( A1, B4) 0.000000 -0.6666667E-02
C( A1, B5) 0.000000 -0.5000000E-02
C( A2, B1) 0.000000 -0.1500000
C( A2, B2) 1.000000 -0.7500000E-01
C( A2, B3) 0.000000 -0.3750000E-01
C( A2, B4) 0.000000 -0.2500000E-01
C( A2, B5) 0.000000 -0.1875000E-01
C( A3, B1) 1.000000 -0.3000000
C( A3, B2) 0.000000 -0.1500000
C( A3, B3) 0.000000 -0.7500000E-01
C( A3, B4) 0.000000 -0.5000000E-01
C( A3, B5) 0.000000 -0.3750000E-01
C( A4, B1) 1.000000 -0.7000000
C( A4, B2) 0.000000 -0.3500000
C( A4, B3) 0.000000 -0.1750000
C( A4, B4) 0.000000 -0.1166667
C( A4, B5) 0.000000 -0.8750000E-01
C( A5, B1) 0.000000 -1.400000
C( A5, B2) 0.000000 -0.7000000
C( A5, B3) 1.000000 -0.3500000
C( A5, B4) 0.000000 -0.2333333
C( A5, B5) 0.000000 -0.1750000
C( A6, B1) 0.000000 -1.600000
C( A6, B2) 1.000000 -0.8000000
C( A6, B3) 0.000000 -0.4000000
C( A6, B4) 0.000000 -0.2666667
C( A6, B5) 0.000000 -0.2000000
C( A7, B1) 0.000000 -2.250000
C( A7, B2) 0.000000 -1.125000
C( A7, B3) 1.000000 -0.5625000
C( A7, B4) 0.000000 -0.3750000
C( A7, B5) 0.000000 -0.2812500
C( A8, B1) 0.000000 -2.800000
C( A8, B2) 0.000000 -1.400000
C( A8, B3) 0.000000 -0.7000000
C( A8, B4) 1.000000 -0.4666667
C( A8, B5) 0.000000 -0.3500000
Row Slack or Surplus Dual Price
1 3.274167 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.4200000 0.000000
12 0.7000000 0.000000
13 6.400000 0.000000
14 16.00000 0.000000
如有疑问,请留言。
model:
sets:
document/a1..a8/:size;
datatraveler/b1..b5/:capacity;
links(document,datatraveler):c;
endsets
!目标函数;
max=@sum(datatraveler(J):@sum(document(I):size(I)*c(I,J))/capacity(J));
!约束条件;
@for(document(I):
@sum(datatraveler(J):c(I,J))=1);
@for(datatraveler(J):
@sum(document(I):c(I,J)*size(I))<=capacity(J));
data:
size=0.08 0.3 0.6 1.4 2.8 3.2 4.5 5.6;
capacity=2 4 8 12 16;
enddata
@for(links:@bin(c));
end
运行结果:
Global optimal solution found at iteration: 0
Objective value: 3.274167
Variable Value Reduced Cost
SIZE( A1) 0.8000000E-01 0.000000
SIZE( A2) 0.3000000 0.000000
SIZE( A3) 0.6000000 0.000000
SIZE( A4) 1.400000 0.000000
SIZE( A5) 2.800000 0.000000
SIZE( A6) 3.200000 0.000000
SIZE( A7) 4.500000 0.000000
SIZE( A8) 5.600000 0.000000
CAPACITY( B1) 2.000000 0.000000
CAPACITY( B2) 4.000000 0.000000
CAPACITY( B3) 8.000000 0.000000
CAPACITY( B4) 12.00000 0.000000
CAPACITY( B5) 16.00000 0.000000
C( A1, B1) 0.000000 -0.4000000E-01
C( A1, B2) 1.000000 -0.2000000E-01
C( A1, B3) 0.000000 -0.1000000E-01
C( A1, B4) 0.000000 -0.6666667E-02
C( A1, B5) 0.000000 -0.5000000E-02
C( A2, B1) 0.000000 -0.1500000
C( A2, B2) 1.000000 -0.7500000E-01
C( A2, B3) 0.000000 -0.3750000E-01
C( A2, B4) 0.000000 -0.2500000E-01
C( A2, B5) 0.000000 -0.1875000E-01
C( A3, B1) 1.000000 -0.3000000
C( A3, B2) 0.000000 -0.1500000
C( A3, B3) 0.000000 -0.7500000E-01
C( A3, B4) 0.000000 -0.5000000E-01
C( A3, B5) 0.000000 -0.3750000E-01
C( A4, B1) 1.000000 -0.7000000
C( A4, B2) 0.000000 -0.3500000
C( A4, B3) 0.000000 -0.1750000
C( A4, B4) 0.000000 -0.1166667
C( A4, B5) 0.000000 -0.8750000E-01
C( A5, B1) 0.000000 -1.400000
C( A5, B2) 0.000000 -0.7000000
C( A5, B3) 1.000000 -0.3500000
C( A5, B4) 0.000000 -0.2333333
C( A5, B5) 0.000000 -0.1750000
C( A6, B1) 0.000000 -1.600000
C( A6, B2) 1.000000 -0.8000000
C( A6, B3) 0.000000 -0.4000000
C( A6, B4) 0.000000 -0.2666667
C( A6, B5) 0.000000 -0.2000000
C( A7, B1) 0.000000 -2.250000
C( A7, B2) 0.000000 -1.125000
C( A7, B3) 1.000000 -0.5625000
C( A7, B4) 0.000000 -0.3750000
C( A7, B5) 0.000000 -0.2812500
C( A8, B1) 0.000000 -2.800000
C( A8, B2) 0.000000 -1.400000
C( A8, B3) 0.000000 -0.7000000
C( A8, B4) 1.000000 -0.4666667
C( A8, B5) 0.000000 -0.3500000
Row Slack or Surplus Dual Price
1 3.274167 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.4200000 0.000000
12 0.7000000 0.000000
13 6.400000 0.000000
14 16.00000 0.000000
如有疑问,请留言。
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询