You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.4 KiB

2 months ago
  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. set I;
  11. /* canning plants */
  12. set J;
  13. /* markets */
  14. param a{i in I};
  15. /* capacity of plant i in cases */
  16. param b{j in J};
  17. /* demand at market j in cases */
  18. param d{i in I, j in J};
  19. /* distance in thousands of miles */
  20. param f;
  21. /* freight in dollars per case per thousand miles */
  22. param c{i in I, j in J} := f * d[i,j] / 1000;
  23. /* transport cost in thousands of dollars per case */
  24. var x{i in I, j in J} >= 0;
  25. /* shipment quantities in cases */
  26. minimize cost: sum{i in I, j in J} c[i,j] * x[i,j];
  27. /* total transportation costs in thousands of dollars */
  28. s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i];
  29. /* observe supply limit at plant i */
  30. s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j];
  31. /* satisfy demand at market j */
  32. data;
  33. set I := Seattle San-Diego;
  34. set J := New-York Chicago Topeka;
  35. param a := Seattle 350
  36. San-Diego 600;
  37. param b := New-York 325
  38. Chicago 300
  39. Topeka 275;
  40. param d : New-York Chicago Topeka :=
  41. Seattle 2.5 1.7 1.8
  42. San-Diego 2.5 1.8 1.4 ;
  43. param f := 90;
  44. end;