alpar@1: # A TRANSPORTATION PROBLEM alpar@1: # alpar@1: # This problem finds a least cost shipping schedule that meets alpar@1: # requirements at markets and supplies at factories. alpar@1: # alpar@1: # References: alpar@1: # Dantzig G B, "Linear Programming and Extensions." alpar@1: # Princeton University Press, Princeton, New Jersey, 1963, alpar@1: # Chapter 3-3. alpar@1: alpar@1: set I; alpar@1: /* canning plants */ alpar@1: alpar@1: set J; alpar@1: /* markets */ alpar@1: alpar@1: param a{i in I}; alpar@1: /* capacity of plant i in cases */ alpar@1: alpar@1: param b{j in J}; alpar@1: /* demand at market j in cases */ alpar@1: alpar@1: param d{i in I, j in J}; alpar@1: /* distance in thousands of miles */ alpar@1: alpar@1: param f; alpar@1: /* freight in dollars per case per thousand miles */ alpar@1: alpar@1: param c{i in I, j in J} := f * d[i,j] / 1000; alpar@1: /* transport cost in thousands of dollars per case */ alpar@1: alpar@1: var x{i in I, j in J} >= 0; alpar@1: /* shipment quantities in cases */ alpar@1: alpar@1: minimize cost: sum{i in I, j in J} c[i,j] * x[i,j]; alpar@1: /* total transportation costs in thousands of dollars */ alpar@1: alpar@1: s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i]; alpar@1: /* observe supply limit at plant i */ alpar@1: alpar@1: s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j]; alpar@1: /* satisfy demand at market j */ alpar@1: alpar@1: data; alpar@1: alpar@1: set I := Seattle San-Diego; alpar@1: alpar@1: set J := New-York Chicago Topeka; alpar@1: alpar@1: param a := Seattle 350 alpar@1: San-Diego 600; alpar@1: alpar@1: param b := New-York 325 alpar@1: Chicago 300 alpar@1: Topeka 275; alpar@1: alpar@1: param d : New-York Chicago Topeka := alpar@1: Seattle 2.5 1.7 1.8 alpar@1: San-Diego 2.5 1.8 1.4 ; alpar@1: alpar@1: param f := 90; alpar@1: alpar@1: end;