# lingo9.0 for循环致命

0

model:

sets:
waiter/1..7/:num,cost;
st/1..9/:f;
SQ(st,waiter):A;
endsets

data :
cost=@file("data\cost.txt");
f=@file("data\f.txt");
A=@file("data\A.txt");
enddata
min=@sum(waiter:num*cost);
@sum(waiter(j): a(1,j)*num(j))>=4;
@sum(waiter(j): a(2,j)*num(j))>=3;
@sum(waiter(j): a(3,j)*num(j))>=4;
@sum(waiter(j): a(4,j)*num(j))>=6;
@sum(waiter(j): a(5,j)*num(j))>=5;
@sum(waiter(j): a(6,j)*num(j))>=6;
@sum(waiter(j): a(7,j)*num(j))>=8;
@sum(waiter(j): a(8,j)*num(j))>=8;
@sum(waiter(j): a(9,j)*num(j))<=3;

@for(waiter(i):@gin(num(i)));

end

model:

sets:
waiter/1..7/:num,cost;
st/1..9/:f;
SQ(st,waiter):A;
endsets

data :
cost=@file("data\cost.txt");
f=@file("data\f.txt");
A=@file("data\A.txt");
enddata
min=@sum(waiter:num*cost);

@for(st(i):
@sum(waiter(j)|i#le#8  :num(j)*a(i,j))>=f(i));
@sum(waiter(j): a(9,j)*num(j))<=3;
@for(waiter(i):@gin(num(i)));

end

cost=100 100 40 40 40 40 40；

f=4 3 4 6 5 6 8 8 3；

A=1 1 1 0 0 0 0
1 1 1 1 0 0 0
1 1 1 1 1 0 0
0 1 1 1 1 1 0
1 0 0 1 1 1 1
1 1 0 0 1 1 1
1 1 0 0 0 1 1
1 1 0 0 0 0 1
0 0 1 1 1 1 1；

您需要登录以后才能回答，未注册用户请先注册