Snow Solutions
Snow Solutions
Algebra Formulation:
Variables:
The factor 1000 · 0.01 (in other words, 100) in the objective function represents that the
snow amounts are in 1000’s of cubic meters, and it costs $0.10 to move a cubic meter of
snow one kilometer. Thus, this factor converts the whole objective function to (Canadian)
dollars. Since this factor is the same for every term in the objective function, it just scales
the whole objective function by 100, and may be omitted, leaving the objective function in
1000’s of snow-kilometers.
In class, we formulated this model using more advanced mathematical notation (which won’t
be on the exam). Here’s how it would look formulated like the other models we did:
Variables:
1
xij = 1 if we assign sector i = 1, 2, . . . , 10 to site j = 1, 2, . . . , 5, and 0 otherwise
yj = 1 if we expand site j = 1, 2, . . . , 5, and otherwise 0.
An alternative approach would be do just solve five modified versions of the original problem,
in each case modifying one of the site capacities by 100 units. That would work fine in this
case. If the problems were taking a long time to solve, or there were a lot more disposal
sites to check, then it would likely be much faster to just add some variables to the integer
program, as shown here.
2
snow.xls
A B C D E F G H I
1 Montreal Snow Removal
2
3 Kilometer Distances Estimated
4 Disposal Site Snow
5 Sector 1 2 3 4 5 Amount (1000 cubic meters)
6 1 3.4 1.4 4.9 7.4 9.3 153
7 2 2.4 2.1 8.3 9.1 8.8 152
8 3 1.4 2.9 3.7 9.4 8.6 154
9 4 2.6 3.6 4.5 8.2 8.9 138
10 5 1.5 3.1 2.1 7.9 8.8 127
11 6 4.2 4.9 6.5 7.7 6.1 129
12 7 4.8 6.2 9.9 6.2 5.7 111
13 8 5.4 6 5.2 7.6 4.9 110
14 9 3.1 4.1 6.6 7.5 7.2 130
15 10 3.2 6.5 7.1 6.0 8.3 135
16 Site Capacity: 350 250 500 400 200
17
18 Cost per cubic-meter kilometer $ 0.10
19
20 Assignment Costs
21 Disposal Site
22 Sector 1 2 3 4 5
23 1 520.2 214.2 749.7 1132.2 1422.9
24 2 364.8 319.2 1261.6 1383.2 1337.6
25 3 215.6 446.6 569.8 1447.6 1324.4
26 4 358.8 496.8 621.0 1131.6 1228.2
27 5 190.5 393.7 266.7 1003.3 1117.6
28 6 541.8 632.1 838.5 993.3 786.9
29 7 532.8 688.2 1098.9 688.2 632.7
30 8 594.0 660.0 572.0 836.0 539.0
31 9 403.0 533.0 858.0 975.0 936.0
32 10 432.0 877.5 958.5 810.0 1120.5
33
34 Site Assignments
35 Disposal Site
36 Sector 1 2 3 4 5 Sum
37 1 0 1 0 0 0 1
38 2 1 0 0 0 0 1
39 3 0 0 1 0 0 1
40 4 0 0 1 0 0 1
41 5 0 0 1 0 0 1
42 6 0 0 0 1 0 1
43 7 0 0 0 1 0 1
44 8 0 0 0 0 1 1
45 9 1 0 0 0 0 1
46 10 0 0 0 1 0 1
47 Snow Quantity 282 153 419 375 110
48
49 Total Cost $ 547,000
Values
snow.xls
A B C D E F G
1 Montreal Snow Removal
2
3 Kilometer Distances Estimated
4 Disposal Site Snow
5 Sector 1 2 3 4 5 Amount
6 1 3.4 1.4 4.9 7.4 9.3 153
7 2 2.4 2.1 8.3 9.1 8.8 152
8 3 1.4 2.9 3.7 9.4 8.6 154
9 4 2.6 3.6 4.5 8.2 8.9 138
10 5 1.5 3.1 2.1 7.9 8.8 127
11 6 4.2 4.9 6.5 7.7 6.1 129
12 7 4.8 6.2 9.9 6.2 5.7 111
13 8 5.4 6 5.2 7.6 4.9 110
14 9 3.1 4.1 6.6 7.5 7.2 130
15 10 3.2 6.5 7.1 6 8.3 135
16 Site Capacity: =350 =250 =500 =400 =200
17
18 Cost per cubic-meter kilometer 0.1
19
20 Assignment Costs
21 Disposal Site
22 Sector 1 2 3 4 5
23 1 =B6*$G6 =C6*$G6 =D6*$G6 =E6*$G6 =F6*$G6
24 2 =B7*$G7 =C7*$G7 =D7*$G7 =E7*$G7 =F7*$G7
25 3 =B8*$G8 =C8*$G8 =D8*$G8 =E8*$G8 =F8*$G8
26 4 =B9*$G9 =C9*$G9 =D9*$G9 =E9*$G9 =F9*$G9
27 5 =B10*$G10 =C10*$G10 =D10*$G10 =E10*$G10 =F10*$G10
28 6 =B11*$G11 =C11*$G11 =D11*$G11 =E11*$G11 =F11*$G11
29 7 =B12*$G12 =C12*$G12 =D12*$G12 =E12*$G12 =F12*$G12
30 8 =B13*$G13 =C13*$G13 =D13*$G13 =E13*$G13 =F13*$G13
31 9 =B14*$G14 =C14*$G14 =D14*$G14 =E14*$G14 =F14*$G14
G37:G46 constrained = 1
32 10 =B15*$G15 =C15*$G15 =D15*$G15 =E15*$G15 =F15*$G15
33
34 Site Assignments Changing Cells, constrained binary
35 Disposal Site
36 Sector 1 2 3 4 5 Sum
37 1 1.22124532709571E-16 1 0 0 0 =SUM(B37:F37)
38 2 1 0 0 0 0 =SUM(B38:F38)
39 3 2.0016114846971E-24 0 1 0 0 =SUM(B39:F39)
40 4 3.09740365307866E-22 0 1 0 0 =SUM(B40:F40)
41 5 0 8.61612005544903E-22 1 0 0 =SUM(B41:F41)
42 6 0 0 0 1 0 =SUM(B42:F42)
43 7 0 0 0 1 1.12269088638024E-21 =SUM(B43:F43)
44 8 0 0 9.0770147530029E-23 0 1 =SUM(B44:F44)
45 9 1 0 0 0 0 =SUM(B45:F45)
46 10 0 0 0 1 0 =SUM(B46:F46)
47 Snow Quantity =SUMPRODUCT(B37:B46,$G6:$G15) =SUMPRODUCT(C37:C46,$G6:$G15) =SUMPRODUCT(D37:D46,$G6:$G15) =SUMPRODUCT(E37:E46,$G6:$G15) =SUMPRODUCT(F37:F46,$G6:$G15)
48
49 Total Cost =1000*D18*SUMPRODUCT(B23:F32,B37:F46)
50
51
B47:F47 constrained <= B16:F16
52 Objective, Minimize
53
Formulas
snow-3sumproduct.xls
A B C D E F G H I
1 Montreal Snow Removal
2
3 Kilometer Distances Estimated
4 Disposal Site Snow
5 Sector 1 2 3 4 5 Amount (1000 cubic meters)
6 1 3.4 1.4 4.9 7.4 9.3 153
7 2 2.4 2.1 8.3 9.1 8.8 152
8 3 1.4 2.9 3.7 9.4 8.6 154
9 4 2.6 3.6 4.5 8.2 8.9 138
10 5 1.5 3.1 2.1 7.9 8.8 127
11 6 4.2 4.9 6.5 7.7 6.1 129
12 7 4.8 6.2 9.9 6.2 5.7 111
13 8 5.4 6 5.2 7.6 4.9 110
14 9 3.1 4.1 6.6 7.5 7.2 130
15 10 3.2 6.5 7.1 6.0 8.3 135
16 Site Capacity: 350 250 500 400 200
17
18 Cost per cubic-meter kilometer $ 0.10
19
20 Site Assignments
21 Disposal Site
22 Sector 1 2 3 4 5 Sum
23 1 0 1 0 0 0 1
24 2 1 0 0 0 0 1
25 3 0 0 1 0 0 1
26 4 0 0 1 0 0 1
27 5 0 0 1 0 0 1
28 6 0 0 0 1 0 1
29 7 0 0 0 1 0 1
30 8 0 0 0 0 1 1
31 9 1 0 0 0 0 1
32 10 0 0 0 1 0 1
33 Snow Quantity 282 153 419 375 110 Sum
34 1000 Snow-Kilometers 767.8 214.2 1457.5 2491.5 539.0 5470.0
35
36 Total Cost $ 547,000
Values
snow-3sumproduct.xls
A B C D E F G
1 Montreal Snow Removal
2
3 Kilometer Distances Estimated
4 Disposal Site Snow
5 Sector 1 2 3 4 5 Amount
6 1 3.4 1.4 4.9 7.4 9.3 153
7 2 2.4 2.1 8.3 9.1 8.8 152
8 3 1.4 2.9 3.7 9.4 8.6 154
9 4 2.6 3.6 4.5 8.2 8.9 138
10 5 1.5 3.1 2.1 7.9 8.8 127
11 6 4.2 4.9 6.5 7.7 6.1 129
12 7 4.8 6.2 9.9 6.2 5.7 111
13 8 5.4 6 5.2 7.6 4.9 110
14 9 3.1 4.1 6.6 7.5 7.2 130
15 10 3.2 6.5 7.1 6 8.3 135
16 Site Capacity: =350 =250 =500 =400 =200
17
18 Cost per cubic-meter kilo 0.1
19 G23:G32 constrained = 1
Changing Cells, constrained binary
20 Site Assignments
21 Disposal Site
22 Sector 1 2 3 4 5 Sum
23 1 1.11022302470556E-17 1 0 0 0 =SUM(B23:F23)
24 2 1 0 0 0 0 =SUM(B24:F24)
25 3 2.0016114846971E-24 0 1 0 0 =SUM(B25:F25)
26 4 3.09740365307866E-22 0 1 0 0 =SUM(B26:F26)
27 5 0 8.61612005544903E-22 1 0 0 =SUM(B27:F27)
28 6 0 0 0 1 0 =SUM(B28:F28)
29 7 0 0 0 1 1.12269088638024E-21 =SUM(B29:F29)
30 8 0 0 9.0770147530029E-23 0 1 =SUM(B30:F30)
31 9 1 0 0 0 0 =SUM(B31:F31)
32 10 0 0 0 1 0 =SUM(B32:F32)
33 Snow Quantity =SUMPRODUCT(B23:B32,$G6:$G15) =SUMPRODUCT(C23:C32,$G6=SUMPRODUCT(D23:D32,$G6=SUMPRODUCT(E23:E32,$G6=SUMPRODUCT(F23:F32,$G6 Sum
34 1000 Snow-Kilometers =SUMPRODUCT(B23:B32,B6:B15,$G6:$G15) =SUMPRODUCT(C23:C32,C6: =SUMPRODUCT(D23:D32,D6: =SUMPRODUCT(E23:E32,E6:E=SUMPRODUCT(F23:F32,F6:F=SUM(B34:F34)
35
36 Note: C33:F34 contain copies of B33:B34 (I made the Total Cost =D18*1000*G34
37 columns narrower for printing clarity)
38 B33:F33 constrained <= B16:F16
39
Objective, Minimize
40
41
Formulas
snow-expand.xls
A B C D E F G H I
1 Montreal Snow Removal
2
3 Kilometer Distances Estimated
4 Disposal Site Snow
5 Sector 1 2 3 4 5 Amount (1000 cubic meters)
6 1 3.4 1.4 4.9 7.4 9.3 153
7 2 2.4 2.1 8.3 9.1 8.8 152
8 3 1.4 2.9 3.7 9.4 8.6 154
9 4 2.6 3.6 4.5 8.2 8.9 138
10 5 1.5 3.1 2.1 7.9 8.8 127
11 6 4.2 4.9 6.5 7.7 6.1 129
12 7 4.8 6.2 9.9 6.2 5.7 111
13 8 5.4 6 5.2 7.6 4.9 110
14 9 3.1 4.1 6.6 7.5 7.2 130
15 10 3.2 6.5 7.1 6.0 8.3 135
16 Site Capacity: 350 250 500 400 200
17
18 Cost per cubic-meter kilometer $ 0.10
19
20 Site expansion amount 100
21 Number of sites to expand 1
22
23 Site Assignments
24 Disposal Site
25 Sector 1 2 3 4 5 Sum
26 1 0 1 0 0 0 1
27 2 1 0 0 0 0 1
28 3 1 0 0 0 0 1
29 4 0 0 1 0 0 1
30 5 0 0 1 0 0 1
31 6 0 0 0 0 1 1
32 7 0 0 0 1 0 1
33 8 0 0 1 0 0 1
34 9 1 0 0 0 0 1
35 10 0 0 0 1 0 1
36 Snow Quantity 436 153 375 246 129 Sum
37 1000 Snow-Kilometers 983.4 214.2 1459.7 1498.2 786.9 4942.4
38
39 1 2 3 4 5 Sum
40 Expand site? 1 0 0 0 0 1
41 Expanded size 450 250 500 400 200
42
43 Total Cost $ 494,240
Values
snow-expand.xls
A B C D E F G
1 Montreal Snow Removal
2
3 Kilometer Distances Estimated
4 Disposal Site Snow
5 Sector 1 2 3 4 5 Amount
6 1 3.4 1.4 4.9 7.4 9.3 153
7 2 2.4 2.1 8.3 9.1 8.8 152
8 3 1.4 2.9 3.7 9.4 8.6 154
9 4 2.6 3.6 4.5 8.2 8.9 138
10 5 1.5 3.1 2.1 7.9 8.8 127
11 6 4.2 4.9 6.5 7.7 6.1 129
12 7 4.8 6.2 9.9 6.2 5.7 111
13 8 5.4 6 5.2 7.6 4.9 110
14 9 3.1 4.1 6.6 7.5 7.2 130
15 10 3.2 6.5 7.1 6 8.3 135
16 Site Capacity: =350 =250 =500 =400 =200
17
18 Cost per cubic-meter kilometer 0.1
19
20 Site expansion amount 100 G23:G32 constrained = 1
21 Number of sites to expand Changing Cells, constrained binary 1
22
23 Site Assignments
24 Disposal Site
25 Sector 1 2 3 4 5 Sum
26 1 1.2490009027033E-16 1 0 0 0 =SUM(B26:F26)
27 2 1 0 0 0 0 =SUM(B27:F27)
28 3 0.999999999993339 0 0 0 0 =SUM(B28:F28)
29 4 3.09740365307866E-22 0 1 0 0 =SUM(B29:F29)
30 5 8.61612005544903E-22 0 1 0 0 =SUM(B30:F30)
31 6 -6.6613381477073E-12 0 0 0 1 =SUM(B31:F31)
32 7 1.12269088638024E-21 0 0 1 0 =SUM(B32:F32)
33 8 0 0 0.999999999993339 0 0 =SUM(B33:F33)
34 9 1 0 0 0 0 =SUM(B34:F34)
35 10 0 0 0 1 0 =SUM(B35:F35)
36 Snow Quantity =SUMPRODUCT(B26:B35,$G6:$G15) =SUMPRODUCT(C26 =SUMPRODUCT(D26 =SUMPRODUCT(E26:=SUMPRODUCT(F26: Sum
37 1000 Snow-Kilometers =SUMPRODUCT(B26:B35,B6:B15,$G6:$G15) =SUMPRODUCT(C26 =SUMPRODUCT(D26 =SUMPRODUCT(E26:=SUMPRODUCT(F26: =SUM(B37:F37)
38 Changing Cells, constrained binary
39 1 2 3 4 5 Sum
40 Expand site? 1 0 0 0 0 =SUM(B40:F40)
41 Expanded size =B16+D$20*B40 =C16+E$20*C40 =D16+F$20*D40 =E16+G$20*E40 =F16+H$20*F40
42
43 Total Cost =D18*1000*G37
44
45
46 Note: C36:F37 contain copies of B36:B37 (I made the B36:F36 constrained <= B41:F41 Objective, Minimize
47 columns narrower for printing clarity)
48
Formulas
### -------------------------------------------------------
### Parameters of model. Actual values come from .dat file
### -------------------------------------------------------
### --------------------------------------------------
### Decision variables
### --------------------------------------------------
### --------------------------------------------------
### Objective function
### --------------------------------------------------
minimize totalCost:
sum {i in SECTOR, j in SITE}
1000 * 0.1 * snowAmount[i] * distance[i,j] * x[i,j];
### ---------------------------------------------------------------
### Constraints (binary constraints already defined with variables)
### ---------------------------------------------------------------
param distance:
Site1 Site2 Site3 Site4 Site5 :=
Sec1 3.4 1.4 4.9 7.4 9.3
Sec2 2.4 2.1 8.3 9.1 8.8
Sec3 1.4 2.9 3.7 9.4 8.6
Sec4 2.6 3.6 4.5 8.2 8.9
Sec5 1.5 3.1 2.1 7.9 8.8
Sec6 4.2 4.9 6.5 7.7 6.1
Sec7 4.8 6.2 9.9 6.2 5.7
Sec8 5.4 6.0 5.2 7.6 4.9
Sec9 3.1 4.1 6.6 7.5 7.2
Sec10 3.2 6.5 7.1 6.0 8.3 ;
### -------------------------------------------------------
### Parameters of model. Actual values come from .dat file
### -------------------------------------------------------
### --------------------------------------------------
### Decision variables
### --------------------------------------------------
### --------------------------------------------------
### Objective function
### --------------------------------------------------
minimize totalCost:
sum {i in SECTOR, j in SITE}
1000 * 0.1 * snowAmount[i] * distance[i,j] * x[i,j];
### ---------------------------------------------------------------
### Constraints (binary constraints already defined with variables)
### ---------------------------------------------------------------
subject to numExpansions:
sum {j in SITE} y[j] <= numToExpand;
data;
param distance:
Site1 Site2 Site3 Site4 Site5 :=
Sec1 3.4 1.4 4.9 7.4 9.3
Sec2 2.4 2.1 8.3 9.1 8.8
Sec3 1.4 2.9 3.7 9.4 8.6
Sec4 2.6 3.6 4.5 8.2 8.9
Sec5 1.5 3.1 2.1 7.9 8.8
Sec6 4.2 4.9 6.5 7.7 6.1
Sec7 4.8 6.2 9.9 6.2 5.7
Sec8 5.4 6.0 5.2 7.6 4.9
Sec9 3.1 4.1 6.6 7.5 7.2
Sec10 3.2 6.5 7.1 6.0 8.3 ;