-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathquiz4-2.gms
41 lines (31 loc) · 1.02 KB
/
quiz4-2.gms
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
34
35
36
37
38
39
40
41
SETS
i sector / 1*10 /
j disposal site / 1*5 / ;
PARAMETER q(j) capacity of disposal site j /
$include "capacities.txt"
/;
PARAMETER d(i,j) distance from sector i to disposal site j in kilometers /
$include "distances.txt"
/;
PARAMETER e(i) estimated annual snow removal requirements of sector i /
$include "estimates.txt"
/;
SCALAR C cost of the transporting one thousand cubic meter of snow one kilometer ;
C = 0.10 * 1000;
VARIABLE Z total cost for objective function ;
VARIABLE X(i,j) indicating assignment of sector i to disposal site j;
X.up(i,j) = 1;
X.lo(i,j) = 0;
EQUATIONS
COST define total objective function
CAP(j) capacity constraints
ASGN(i) sector assignment constraints;
COST .. Z =e= SUM((i,j), X(i,j) * d(i,j) * e(i) * C);
CAP(J) .. SUM(i, X(i,j) * e(i)) =L= q(j);
ASGN(I) .. SUM(j, X(i,j)) =e= 1;
MODEL GAP /ALL/ ;
OPTION MIP = Cplex;
OPTION optca = 0;
OPTION optcr = 0;
SOLVE GAP USING MIP MINIMIZING Z ;
DISPLAY X.L;