[9] | 1 | # A TRANSPORTATION PROBLEM |
---|
| 2 | # |
---|
| 3 | # This problem finds a least cost shipping schedule that meets |
---|
| 4 | # requirements at markets and supplies at factories. |
---|
| 5 | # |
---|
| 6 | # References: |
---|
| 7 | # Dantzig G B, "Linear Programming and Extensions." |
---|
| 8 | # Princeton University Press, Princeton, New Jersey, 1963, |
---|
| 9 | # Chapter 3-3. |
---|
| 10 | |
---|
| 11 | set I; |
---|
| 12 | /* canning plants */ |
---|
| 13 | |
---|
| 14 | set J; |
---|
| 15 | /* markets */ |
---|
| 16 | |
---|
| 17 | param a{i in I}; |
---|
| 18 | /* capacity of plant i in cases */ |
---|
| 19 | |
---|
| 20 | param b{j in J}; |
---|
| 21 | /* demand at market j in cases */ |
---|
| 22 | |
---|
| 23 | param d{i in I, j in J}; |
---|
| 24 | /* distance in thousands of miles */ |
---|
| 25 | |
---|
| 26 | param f; |
---|
| 27 | /* freight in dollars per case per thousand miles */ |
---|
| 28 | |
---|
| 29 | param c{i in I, j in J} := f * d[i,j] / 1000; |
---|
| 30 | /* transport cost in thousands of dollars per case */ |
---|
| 31 | |
---|
| 32 | var x{i in I, j in J} >= 0; |
---|
| 33 | /* shipment quantities in cases */ |
---|
| 34 | |
---|
| 35 | minimize cost: sum{i in I, j in J} c[i,j] * x[i,j]; |
---|
| 36 | /* total transportation costs in thousands of dollars */ |
---|
| 37 | |
---|
| 38 | s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i]; |
---|
| 39 | /* observe supply limit at plant i */ |
---|
| 40 | |
---|
| 41 | s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j]; |
---|
| 42 | /* satisfy demand at market j */ |
---|
| 43 | |
---|
| 44 | data; |
---|
| 45 | |
---|
| 46 | set I := Seattle San-Diego; |
---|
| 47 | |
---|
| 48 | set J := New-York Chicago Topeka; |
---|
| 49 | |
---|
| 50 | param a := Seattle 350 |
---|
| 51 | San-Diego 600; |
---|
| 52 | |
---|
| 53 | param b := New-York 325 |
---|
| 54 | Chicago 300 |
---|
| 55 | Topeka 275; |
---|
| 56 | |
---|
| 57 | param d : New-York Chicago Topeka := |
---|
| 58 | Seattle 2.5 1.7 1.8 |
---|
| 59 | San-Diego 2.5 1.8 1.4 ; |
---|
| 60 | |
---|
| 61 | param f := 90; |
---|
| 62 | |
---|
| 63 | end; |
---|