|
» Agprice
» Constraint
» Curve
» Decent
» Distrib
» Economy
» Efficient
Factory
» Farm
» Food
» Hydro
» Logic
» Manpower
» Market
» Milk
» Mining
» OandX
» Opencast
» Refinery
» Tariff
» TSP
» Yield
| |
Model Factory |
|
|
|
MODEL Factory |
|
DATA |
|
|
n_per = 6 |
|
SET |
|
|
Prod = {1 .. 7}, MACH = {1 .. 5}, PER = {1 .. n_per}; |
|
DATA |
|
|
hours_avail = 384, |
|
|
time[MACH,Prod] << "time.dat", |
|
|
market[n_per,Prod] << "sale.dat", |
|
|
totmach[MACH,n_per] << "mach.dat", |
|
|
prof[Prod] = [10,6,8,4,11,9,3]; |
|
VARIABLES |
|
|
mprod[Prod,n_per], sprod[Prod,n_per], hprod[Prod,n_per]; |
|
OBJECTIVE |
|
|
MAXIMIZE PROFIT = sum {t in PER, i in Prod} (prof[i]*sprod[i,t] - 0.5*hprod[i,t]); |
|
CONSTRAINTS |
|
|
bal{i in Prod, t in PER, t=1}: mprod[i,t] - sprod[i,t] - hprod[i,t] = 0, |
|
|
bal{i in Prod, t in PER, t>1}: hprod[i,t-1] + mprod[i,t] - sprod[i,t] - hprod[i,t] = 0, |
|
|
cap{m in MACH, t in PER}: sum {i in Prod} time[m,i]*mprod[i,t] <= hours_avail*totmach[m,t], |
|
|
for {i in Prod, t in PER} {sprod[i,t] <= market[t,i], if (t<n_per) hprod[i,t] <= 100 else hprod[i,t] = 50 }; |
|
END MODEL |
|
|
solve Factory; |
|
|
print solution for Factory >> "Factory.sol"; |
|
|
quit; |
|
|
|
MODEL Factoryb |
|
DATA |
|
|
n_per = 6; |
|
SET |
|
|
Prod = {1 .. 7}, MACH = {1 .. 5}, PER = {1 .. n_per}; |
|
DATA |
|
|
hours_avail = 384, |
|
|
time[MACH,Prod] << "time.dat", |
|
|
market[n_per,Prod] << "sale.dat", |
|
|
mach_avail[MACH] = [4,2,3,1,1], |
|
|
prof[Prod] = [10,6,8,4,11,9,3], |
|
|
n_down[MACH] = [2,2,3,1,1]; |
|
VARIABLES |
|
|
mprod[Prod,n_per], sprod[Prod,n_per], |
|
|
sprod[Prod,n_per], |
|
|
hprod[Prod,n_per], |
|
|
nd[MACH,n_per] integer; |
|
OBJECTIVE |
|
|
MAXIMIZE PROFIT = sum {t in PER, i in Prod} (prof[i]*sprod[i,t] - 0.5*hprod[i,t]); |
|
CONSTRAINTS |
|
|
bal{i in Prod, t in PER, t=1}: mprod[i,t] - sprod[i,t] - hprod[i,t] = 0, |
|
|
bal{i in Prod, t in PER, t>1}: hprod[i,t-1] + mprod[i,t] - sprod[i,t] - hprod[i,t] = 0, |
|
|
cap{m in MACH, t in PER}: sum {i in Prod} time[m,i]*mprod[i,t] <= hours_avail*(mach_avail[m]-nd[m,t]), |
|
|
down{m in MACH}: sum {t in PER} nd[m,t] = n_down[m], |
|
|
for {m in MACH, t in PER} nd[m,t] <= n_down[m], |
|
|
for {i in Prod, t in PER} {sprod[i,t] <= market[t,i], if (t <n_per) hprod[i,t] <= 100 else hprod[i,t] = 50 }; |
|
END MODEL |
|
|
solve Factory; |
|
|
print solution for Factoryb >> "Factoryb.sol |
|
|
quit; |
|
|
mach.dat |
|
|
[3,4,4,4,3,4, |
|
|
2,2,2,1,1,2, |
|
|
3,1,3,3,3,2, |
|
|
1,1,1,1,1,0] |
|
|
sale.dat |
|
|
[500,1000,300,300,800,200,100, |
|
|
600,500,200,0,400,300,150, |
|
|
300,600,0,0,500,400,100, |
|
|
200,300,400,500,200,0,100, |
|
|
0,100,500,100,1000,300,0, |
|
|
500,500,100,300,1100,500,60] |
|
|
time.dat |
|
|
[0.5,0.7,0,0,0.3,0.2,0.5, |
|
|
0.1,0.2,0,0.3,0,0.6,0, |
|
|
0.2,0,0.8,0,0,0,0.6, |
|
|
0.05,0.03,0,0.07,0.1,0,0.08, |
|
|
0,0,0.01,0,0.05,0,0.05] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|