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