1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/examples/transp.mod Mon Dec 06 13:09:21 2010 +0100
1.3 @@ -0,0 +1,63 @@
1.4 +# A TRANSPORTATION PROBLEM
1.5 +#
1.6 +# This problem finds a least cost shipping schedule that meets
1.7 +# requirements at markets and supplies at factories.
1.8 +#
1.9 +# References:
1.10 +# Dantzig G B, "Linear Programming and Extensions."
1.11 +# Princeton University Press, Princeton, New Jersey, 1963,
1.12 +# Chapter 3-3.
1.13 +
1.14 +set I;
1.15 +/* canning plants */
1.16 +
1.17 +set J;
1.18 +/* markets */
1.19 +
1.20 +param a{i in I};
1.21 +/* capacity of plant i in cases */
1.22 +
1.23 +param b{j in J};
1.24 +/* demand at market j in cases */
1.25 +
1.26 +param d{i in I, j in J};
1.27 +/* distance in thousands of miles */
1.28 +
1.29 +param f;
1.30 +/* freight in dollars per case per thousand miles */
1.31 +
1.32 +param c{i in I, j in J} := f * d[i,j] / 1000;
1.33 +/* transport cost in thousands of dollars per case */
1.34 +
1.35 +var x{i in I, j in J} >= 0;
1.36 +/* shipment quantities in cases */
1.37 +
1.38 +minimize cost: sum{i in I, j in J} c[i,j] * x[i,j];
1.39 +/* total transportation costs in thousands of dollars */
1.40 +
1.41 +s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i];
1.42 +/* observe supply limit at plant i */
1.43 +
1.44 +s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j];
1.45 +/* satisfy demand at market j */
1.46 +
1.47 +data;
1.48 +
1.49 +set I := Seattle San-Diego;
1.50 +
1.51 +set J := New-York Chicago Topeka;
1.52 +
1.53 +param a := Seattle 350
1.54 + San-Diego 600;
1.55 +
1.56 +param b := New-York 325
1.57 + Chicago 300
1.58 + Topeka 275;
1.59 +
1.60 +param d : New-York Chicago Topeka :=
1.61 + Seattle 2.5 1.7 1.8
1.62 + San-Diego 2.5 1.8 1.4 ;
1.63 +
1.64 +param f := 90;
1.65 +
1.66 +end;