lemon-project-template-glpk

diff deps/glpk/examples/fctp.mod @ 9:33de93886c88

Import GLPK 4.47
author Alpar Juttner <alpar@cs.elte.hu>
date Sun, 06 Nov 2011 20:59:10 +0100
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/deps/glpk/examples/fctp.mod	Sun Nov 06 20:59:10 2011 +0100
     1.3 @@ -0,0 +1,93 @@
     1.4 +/* FCTP, Fixed-Charge Transportation Problem */
     1.5 +
     1.6 +/* Written in GNU MathProg by Andrew Makhorin <mao@gnu.org> */
     1.7 +
     1.8 +/* The Fixed-Charge Transportation Problem (FCTP) is obtained from
     1.9 +   classical transportation problem by imposing a fixed cost on each
    1.10 +   transportation link if there is a positive flow on that link. */
    1.11 +
    1.12 +param m, integer, > 0;
    1.13 +/* number of sources */
    1.14 +
    1.15 +param n, integer, > 0;
    1.16 +/* number of customers */
    1.17 +
    1.18 +set I := 1..m;
    1.19 +/* set of sources */
    1.20 +
    1.21 +set J := 1..n;
    1.22 +/* set of customers */
    1.23 +
    1.24 +param supply{i in I}, >= 0;
    1.25 +/* supply at source i */
    1.26 +
    1.27 +param demand{j in J}, >= 0;
    1.28 +/* demand at customer j */
    1.29 +
    1.30 +param varcost{i in I, j in J}, >= 0;
    1.31 +/* variable cost (a cost per one unit shipped from i to j) */
    1.32 +
    1.33 +param fixcost{i in I, j in J}, >= 0;
    1.34 +/* fixed cost (a cost for shipping any amount from i to j) */
    1.35 +
    1.36 +var x{i in I, j in J}, >= 0;
    1.37 +/* amount shipped from source i to customer j */
    1.38 +
    1.39 +s.t. f{i in I}: sum{j in J} x[i,j] = supply[i];
    1.40 +/* observe supply at source i */
    1.41 +
    1.42 +s.t. g{j in J}: sum{i in I} x[i,j] = demand[j];
    1.43 +/* satisfy demand at customer j */
    1.44 +
    1.45 +var y{i in I, j in J}, binary;
    1.46 +/* y[i,j] = 1 means some amount is shipped from i to j */
    1.47 +
    1.48 +s.t. h{i in I, j in J}: x[i,j] <= min(supply[i], demand[j]) * y[i,j];
    1.49 +/* if y[i,j] is 0, force x[i,j] to be 0 (may note that supply[i] and
    1.50 +   demand[j] are implicit upper bounds for x[i,j] as follows from the
    1.51 +   constraints f[i] and g[j]) */
    1.52 +
    1.53 +minimize cost: sum{i in I, j in J} varcost[i,j] * x[i,j] +
    1.54 +               sum{i in I, j in J} fixcost[i,j] * y[i,j];
    1.55 +/* total transportation costs */
    1.56 +
    1.57 +data;
    1.58 +
    1.59 +/* These data correspond to the instance bal8x12 from [Balinski]. */
    1.60 +
    1.61 +/* The optimal solution is 471.55 */
    1.62 +
    1.63 +param m := 8;
    1.64 +
    1.65 +param n := 12;
    1.66 +
    1.67 +param supply := 1 15.00,  2 20.00,  3 45.00,  4 35.00,
    1.68 +                5 25.00,  6 35.00,  7 10.00,  8 25.00;
    1.69 +
    1.70 +param demand := 1 20.00,  2 15.00,  3 20.00,  4 15.00,
    1.71 +                5  5.00,  6 20.00,  7 30.00,  8 10.00,
    1.72 +                9 35.00, 10 25.00, 11 10.00, 12  5.00;
    1.73 +
    1.74 +param varcost
    1.75 +      :   1    2    3    4    5    6    7    8    9    10   11   12  :=
    1.76 +      1  0.69 0.64 0.71 0.79 1.70 2.83 2.02 5.64 5.94 5.94 5.94 7.68
    1.77 +      2  1.01 0.75 0.88 0.59 1.50 2.63 2.26 5.64 5.85 5.62 5.85 4.94
    1.78 +      3  1.05 1.06 1.08 0.64 1.22 2.37 1.66 5.64 5.91 5.62 5.91 4.94
    1.79 +      4  1.94 1.50 1.56 1.22 1.98 1.98 1.36 6.99 6.99 6.99 6.99 3.68
    1.80 +      5  1.61 1.40 1.61 1.33 1.68 2.83 1.54 4.26 4.26 4.26 4.26 2.99
    1.81 +      6  5.29 5.94 6.08 5.29 5.96 6.77 5.08 0.31 0.21 0.17 0.31 1.53
    1.82 +      7  5.29 5.94 6.08 5.29 5.96 6.77 5.08 0.55 0.35 0.40 0.19 1.53
    1.83 +      8  5.29 6.08 6.08 5.29 5.96 6.45 5.08 2.43 2.30 2.33 1.81 2.50 ;
    1.84 +
    1.85 +param fixcost
    1.86 +      :   1    2    3    4    5    6    7    8    9    10   11   12  :=
    1.87 +      1  11.0 16.0 18.0 17.0 10.0 20.0 17.0 13.0 15.0 12.0 14.0 14.0
    1.88 +      2  14.0 17.0 17.0 13.0 15.0 13.0 16.0 11.0 20.0 11.0 15.0 10.0
    1.89 +      3  12.0 13.0 20.0 17.0 13.0 15.0 16.0 13.0 12.0 13.0 10.0 18.0
    1.90 +      4  16.0 19.0 16.0 11.0 15.0 12.0 18.0 12.0 18.0 13.0 13.0 14.0
    1.91 +      5  19.0 18.0 15.0 16.0 12.0 14.0 20.0 19.0 11.0 17.0 16.0 18.0
    1.92 +      6  13.0 20.0 20.0 17.0 15.0 12.0 14.0 11.0 12.0 19.0 15.0 16.0
    1.93 +      7  11.0 12.0 15.0 10.0 17.0 11.0 11.0 16.0 10.0 18.0 17.0 12.0
    1.94 +      8  17.0 10.0 20.0 12.0 17.0 20.0 16.0 15.0 10.0 12.0 16.0 18.0 ;
    1.95 +
    1.96 +end;