|
» Agprice
» Constraint
» Curve
» Decent
» Distrib
» Economy
» Efficient
» Factory
» Farm
» Food
» Hydro
» Logic
» Manpower
» Market
Milk
» Mining
» OandX
» Opencast
» Refinery
» Tariff
» TSP
» Yield
| |
Model Milk |
|
|
|
MODEL MILK |
|
SET |
|
|
oned={11..21}, |
|
|
alld={1..10}, |
|
|
farm={1..21}, |
|
|
days={1..2}, |
|
|
! sets to eliminate subtours at 2nd stage |
|
|
sa={6,7,20}, |
|
|
sb={2,5,18}, |
|
|
sc={3,4,13,16,19}, |
|
|
! sets to eliminate subtours at 3rd stage |
|
|
sd={8,9,21}, |
|
|
se={1,2,6,7,10,17}; |
|
DATA |
|
|
Dist[farm,farm] << "farm21.dat", |
|
|
Cap[farm] << "cap21.dat", |
|
|
Tcap = 80; |
|
|
capacity (1000 litres) |
|
VARIABLES |
|
|
x[farm,farm,days] integer, |
|
|
y[oned,days] integer; |
|
OBJECTIVE |
|
|
MINIMIZE cost=sum{i in farm, j in farm, k in days,i < j} Dist[i,j]*x[i,j,k]; |
|
CONSTRAINTS |
|
|
limit{k in days} : sum{i in oned} Cap[i]*y[i,k] <= Tcap - sum{i in alld} Cap[i], |
|
|
dayvis{i in oned} : sum{k in days} y[i,k] = 1, |
|
|
mat{i in alld, k in days} : sum{j in farm, j > i} x[i,j,k] +sum{j in farm, j < i} x[j,i,k] = 2, |
|
|
mat{i in oned, k in days} : sum{j in farm, j > i} x[i,j,k] +sum{j in farm, j < i} x[j,i,k] = 2*y[i,k], |
|
|
va{i in oned, j in farm,k in days, j > i} : x[i,j,k] <= y[i,k], |
|
|
vb{i in oned, j in farm,k in days, j < i} : x[j,i,k] <= y[i,k], |
|
|
suba{k in {1..2}} : sum{i in sa,j in sa,i < j} x[i,j,k] <= 2, |
|
|
subb{k in {1..2}} : sum{i in sb,j in sb,i < j} x[i,j,k] <= 2, |
|
|
subc{k in {1..2}} : sum{i in sc,j in sc,i < j} x[i,j,k] <= 4, |
|
|
subd{k in {1..2}} : sum{i in sd,j in sd,i < j} x[i,j,k] <= 2, |
|
|
sube{k in {1..2}} : sum{i in se,j in se,i < j} x[i,j,k] <= 5, |
|
|
bounds{i in farm, j in farm, k in days,i < j} : x[i,j,k] <= 1, |
|
|
bounds{i in {12..21},k in days} : y[i,k] <= 1, |
|
|
bounds{i in {11..11}, k in {1..1}} : y[i,k] = 1, |
|
|
bounds{i in {11..11}, k in {2..2}} : y[i,k] = 0; |
|
END MODEL |
|
|
solve MILK; |
|
|
print solution for MILK >> "milk.sol"; |
|
|
quit; |
|
|
cap21.dat |
|
|
[0,5,4,3,6,7,3,4,6,5,4,7,3,4,5,6,8,5,7,6,6] |
|
|
farm21.dat |
|
|
[0.0, 4.2,11.0, 8.1,10.3, 5.4, 8.1, 6.0, 6.7, 3.2, 6.0, 7.2, 5.4, 8.2,11.7, 8.1, 3.2, 7.8, 9.2, 7.8, 6.4, |
|
|
0.0, 0.0, 8.9, 8.1, 6.3, 5.4,10.0, 9.5,10.8, 6.3, 9.5, 9.1, 5.4, 5.1,11.4, 6.4, 2.0, 3.6, 7.8, 8.5,10.6, |
|
|
0.0, 0.0, 0.0, 5.0, 6.3,14.3,18.7,12.1,17.1,14.1,17.0, 8.6, 6.1, 4.2, 5.1, 3.0,10.8, 9.2, 2.2,17.5,15.5, |
|
|
0.0, 0.0, 0.0, 0.0, 9.2,12.7,16.1, 7.3,13.0,11.2,13.6, 3.6, 2.8, 6.1, 3.6, 3.2, 9.2,10.2, 2.8,15.6,11.0, |
|
|
0.0, 0.0, 0.0, 0.0, 0.0,11.0,16.0,14.2,17.0,12.6,15.8,12.1, 8.1, 3.2,11.0, 6.1, 8.2, 4.1, 7.0,14.0,16.4, |
|
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.1,11.2, 8.9, 4.1, 6.4,12.5, 9.9,10.4,16.3,11.7, 3.6, 7.1,13.0, 3.2,10.2, |
|
|
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,12.2, 7.1, 5.0, 4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