-
Notifications
You must be signed in to change notification settings - Fork 190
/
3.factory.smg
33 lines (33 loc) · 1018 Bytes
/
3.factory.smg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;