Model:
sets:Supply/1,2,3,4,5,6,7,8,9,10,11,12/:a,b,c;
Demand/1,2,3,4,5,6,7,8,9,10,11,12/:d;
Link(Supply,Demand):x,p;
endsets
Data:
a=
300 250 100 180 275 300 200 220 270 250 230 180 ;
b= 3500 9000 10000 4000 3000 9000 9000 3000 4000 10000 9000 35000 ;
d= 120 80 75 100 110 100 90 60 30 150 95 120 ;
m=
0.8333 1.0000 0.6667 0.5000 0.5455 1.0000 1.3333 1.5000 2.0000 0.4667 0.6842 0.9167
1.0000 1.1250 0.8000 0.7000 0.5909 1.1000 1.5555 1.8333 2.6667 0.5333 07895 1.0833
1.1667 1.3750 1.0667 0.8000 0.6818 1.3000 1.7778 2.0833 3.3333 0.6667 0.8421 1.2500
1.3333 1.5625 1.3333 1.0000 0.7273 1.5000 2.1111 2.5000 4.3333 66.667 105.26 83.33
1.5833 1.8750 1.7333 100.00 90.90 100.00 2.2222 3.0000 5.0000 66.666 105.26 83.33
1.6667 2.2500 2.0000 100.00 90.90 100.00 1.1111 1.3333 1.6667 1.1111 1.3333 1.6667
0.8333 1.0000 0.6667 0.5000 0.5455 1.0000 1.3333 1.5000 2.0000 0.4667 0.6842 0.9167
1.0000 1.1250 0.8000 0.7000 0.5909 1.1000 1.5556 1.8333 2.6667 0.5333 07895 1.0833
1.1667 1.3750 1.0667 0.8000 0.6818 1.3000 1.7778 2.0833 3.3333 0.6667 0.8421 1.2500
1.3333 1.5625 1.3333 1.0000 0.7273 1.5000 2.1111 2.5000 4.3333 66.667 105.26 83.333
1.5833 1.8750 1.7333 100.00 90.909 100.00 2.2222 3.0000 5.0000 66.667 105.26 83.33
1.6667 2.2500 2.000 100.00 90.909 100.00 1.1111 1.3333 1.6667 0.3333 0.6316 0.8333
;
enddata
min=@sum(Supply(i):@sum(Demand(j):p(i,j)*x(i,j)))+@sum(Supply(i):c(i)*b(i));
@for(Demand(j):@sum(Supply(i):x(i,j))=d(j));
@for(Supply(i):@sum(Demand(j):x(i,j))<=c(i)*a(i));
@sum(Supply(i):c(i)*a(i))>=1130;
@for(Supply(i):@bin(c(i)));
end
这是窝做的代码
这样子错的
sets:Supply/1,2,3,4,5,6,7,8,9,10,11,12/:a,b,c;
Demand/1,2,3,4,5,6,7,8,9,10,11,12/:d;
Link(Supply,Demand):x,p;
endsets
Data:
a=
300 250 100 180 275 300 200 220 270 250 230 180 ;
b= 3500 9000 10000 4000 3000 9000 9000 3000 4000 10000 9000 35000 ;
d= 120 80 75 100 110 100 90 60 30 150 95 120 ;
m=
0.8333 1.0000 0.6667 0.5000 0.5455 1.0000 1.3333 1.5000 2.0000 0.4667 0.6842 0.9167
1.0000 1.1250 0.8000 0.7000 0.5909 1.1000 1.5555 1.8333 2.6667 0.5333 07895 1.0833
1.1667 1.3750 1.0667 0.8000 0.6818 1.3000 1.7778 2.0833 3.3333 0.6667 0.8421 1.2500
1.3333 1.5625 1.3333 1.0000 0.7273 1.5000 2.1111 2.5000 4.3333 66.667 105.26 83.33
1.5833 1.8750 1.7333 100.00 90.90 100.00 2.2222 3.0000 5.0000 66.666 105.26 83.33
1.6667 2.2500 2.0000 100.00 90.90 100.00 1.1111 1.3333 1.6667 1.1111 1.3333 1.6667
0.8333 1.0000 0.6667 0.5000 0.5455 1.0000 1.3333 1.5000 2.0000 0.4667 0.6842 0.9167
1.0000 1.1250 0.8000 0.7000 0.5909 1.1000 1.5556 1.8333 2.6667 0.5333 07895 1.0833
1.1667 1.3750 1.0667 0.8000 0.6818 1.3000 1.7778 2.0833 3.3333 0.6667 0.8421 1.2500
1.3333 1.5625 1.3333 1.0000 0.7273 1.5000 2.1111 2.5000 4.3333 66.667 105.26 83.333
1.5833 1.8750 1.7333 100.00 90.909 100.00 2.2222 3.0000 5.0000 66.667 105.26 83.33
1.6667 2.2500 2.000 100.00 90.909 100.00 1.1111 1.3333 1.6667 0.3333 0.6316 0.8333
;
enddata
min=@sum(Supply(i):@sum(Demand(j):p(i,j)*x(i,j)))+@sum(Supply(i):c(i)*b(i));
@for(Demand(j):@sum(Supply(i):x(i,j))=d(j));
@for(Supply(i):@sum(Demand(j):x(i,j))<=c(i)*a(i));
@sum(Supply(i):c(i)*a(i))>=1130;
@for(Supply(i):@bin(c(i)));
end
这是窝做的代码
这样子错的