forked from burakbayramli/books
-
Notifications
You must be signed in to change notification settings - Fork 0
/
10.decent.smg
33 lines (32 loc) · 1.19 KB
/
10.decent.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 Decent
SET
ndepts = {1 .. 5},
ncities = {1 .. 3},
ncitiesm1 = {1 .. 2};
DATA
benefit[ndepts,ncities] = [10,10,0,15,20,0,10,15,0,20,15,0,5,15,0],
dist[ncities,ncities] = [5,14,13,14,5,9,13,9,10],
comm[ndepts,ndepts] = [0,0,1.0,1.5,0.0,0,0,1.4,1.2,0.0,0,0,0.0,0.0,
2.0,0,0,0.0,0.0,0.7,0,0,0.0,0.0,0.0];
VARIABLES
d[ndepts,ncities] integer,
g[ndepts,ncities,ndepts,ncities] integer;
OBJECTIVE
! MAXIMIZE tcost = sum{i in ndepts, j in ncitiesm1} benefit[i,j]*d[i,j];
MAXIMIZE tcost = sum{i in ndepts, j in ncitiesm1} benefit[i,j]*d[i,j]
-sum{i in ndepts, j in ncities, k in ndepts,
l in ncities, k> i} (comm[i,k]*dist[j,l])*g[i,j,k,l];
CONSTRAINTS
dept{i in ndepts} : sum{j in ncities} d[i,j] = 1,
city{j in ncities} : sum{i in ndepts} d[i,j] <= 3,
for{i in ndepts, j in ncities, k in ndepts, l in ncities, k>i}
{g[i,j,k,l] - d[i,j] <= 0,
g[i,j,k,l] - d[k,l] <= 0,
d[i,j] + d[k,l] - g[i,j,k,l] <= 1,
g[i,j,k,l] <= 1},
for{i in ndepts, j in ncities}
{d[i,j] <= 1};
END MODEL
solve Decent;
print solution for Decent >> "Decent.sol";
quit;