COIN-OR::LEMON - Graph Library

source: lemon-project-template-glpk/deps/glpk/examples/transp.mod

subpack-glpk
Last change on this file was 9:33de93886c88, checked in by Alpar Juttner <alpar@…>, 13 years ago

Import GLPK 4.47

File size: 1.4 KB
RevLine 
[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
11set I;
12/* canning plants */
13
14set J;
15/* markets */
16
17param a{i in I};
18/* capacity of plant i in cases */
19
20param b{j in J};
21/* demand at market j in cases */
22
23param d{i in I, j in J};
24/* distance in thousands of miles */
25
26param f;
27/* freight in dollars per case per thousand miles */
28
29param c{i in I, j in J} := f * d[i,j] / 1000;
30/* transport cost in thousands of dollars per case */
31
32var x{i in I, j in J} >= 0;
33/* shipment quantities in cases */
34
35minimize cost: sum{i in I, j in J} c[i,j] * x[i,j];
36/* total transportation costs in thousands of dollars */
37
38s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i];
39/* observe supply limit at plant i */
40
41s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j];
42/* satisfy demand at market j */
43
44data;
45
46set I := Seattle San-Diego;
47
48set J := New-York Chicago Topeka;
49
50param a := Seattle     350
51           San-Diego   600;
52
53param b := New-York    325
54           Chicago     300
55           Topeka      275;
56
57param d :              New-York   Chicago   Topeka :=
58           Seattle     2.5        1.7       1.8
59           San-Diego   2.5        1.8       1.4  ;
60
61param f := 90;
62
63end;
Note: See TracBrowser for help on using the repository browser.