lingo

问题描述:

lingo
联系 给题 帮着

大概是下面这样 最重要的是transport两个量
model:
sets:
s/1..2/:;
w/1..2/:wcost1,wcost2,z;
c/1..3/:;
p/1..2/:;
link1(p,s,w):transportcost1,transport1;
link2(p,w,c):transportcost2,transport2;
link3(p,c):demand;
link4(p,s):cost;
link5(w,c):y;
endsets
data:
transportcost1=
1.8 1.6
1.7 1.5
1.9 1.7
1.8 1.6;
transportcost2=
2.5 2.3 2.7
2.2 1.8 2.4
2.6 2.4 2.8
2.3 1.9 2.5;
demand=
55 45 50
45 35 40;
cost=
28.5 28.5
38.5 39.5;
wcost1=
1.5 1.3;
wcost2=
20 85;
enddata
min=@sum(link1:transportcost1*transport1)*10000+@sum(link2:transportcost2*transport2)*10000
+@sum(link4(l,i):cost(l,i)*@sum(w(j):transport1(l,i,j)))*10000+@sum(w(j):wcost1(j)*@sum(s(i):@sum(p(l):transport1(l,i,j))))*10000
+@sum(w:z*wcost2);
@for(p(l):@for(w(j):@sum(s(i):transport1(l,i,j))=@sum(c(k):transport2(l,j,k))));
@for(link3(l,k):demand(l,k)=@sum(w(j):transport2(l,j,k)));
@sum(p(l):@sum(s(i):transport1(l,i,1)))@sum(w(j):transport1(1,1,j))@sum(w(j):transport1(2,1,j))@for(w(j):z(j)=@if(@sum(p(l):@sum(s(i):transport1(l,i,j)))#eq#0,0,1));
@for(link5(j,k):y(j,k)=@if(@sum(p(l):transport2(l,j,k))#eq#0,0,1));
@for(c(k):@sum(w(j):y(j,k))end