GAMS Rev 237  WEX-WEI 23.7.3 x86_64/MS Windows                                                                                                                                                                                         03/13/13 12:32:59 Page 1
THE TRANSPORTATION PROBLEM
C o m p i l a t i o n


   2  ** First, indices are declared and defined.
   3  ** Index I is used to refer to the three origins.
   4  ** Index J is used to refer to the three destinations.
   5  ** Note how the symbol `*' is used to list sets members in a compact way.
   6  SETS
   7  I index of shipping origins
   8  J index of shipping destinations;
   9  ** Vectors of data (U(I) and V(J)) are defined as parameters
  10  ** Data are assigned to vector elements
  11  PARAMETERS
  12  U(I) the amount of good to be shipped from origin I
  13  V(J) the amount of good to be received in destination J
  14  C(I,J) cost of sending a unit from origin I to destination J;
GDXIN   C:\Users\spmo\Documents\Dropbox\DTU\Teaching\curso madrid\PresentacionesCurso\PresentacionesDefinitivas\Curso\ExampleInterfaceMatlabGAMS\InterfaceMatlabGAMS\InputData.gdx
--- LOAD  I = 1:I
--- LOAD  J = 2:J
--- LOAD  U = 3:U
--- LOAD  V = 4:V
--- LOAD  C = 5:C
  18  ** We include the data from the file InputData.gdx
  19   
  20  ** The optimization variables are declared.
  21  ** First, the objective function variable (z) is declared.
  22  ** Next, the remaining variables with controlling indices are declared.
  23  VARIABLES
  24  z objective function variable
  25  x(I,J) the amount of product to be shipped from origin I to destination J;
  26  ** The types of variables are given in the following sentence.
  27  ** In the transportation problem, all the variables are positive except
  28  ** the objective function variable.
  29  POSITIVE VARIABLE x(I,J);
  30  ** The objective function equation is declared.
  31  ** The remaining six equations are declared, in a compact way,
  32  ** as two index-dependent equations.
  33  EQUATIONS
  34  COST objective function equation
  35  SHIP(I) shipping equation
  36  RECEIVE(J) receiving equation;
  37  ** The following sentences formulate the above declared equations.
  38  ** All the constraints are equality constraints (=E=).
  39  ** The first one defines the objective function equation as a summation.
  40  ** The second equation group represents three
  41  ** different single equations depending on index I.
  42  ** The left-hand-side is a sum in J of the unknowns x(I,J), and
  43  ** the right-hand-side is a previously defined vector of data.
  44  ** Similarly to SHIP constraints, the RECEIVE constraints are defined.
  45  COST .. z =E= SUM((I,J), C(I,J)*x(I,J)) ;
  46  SHIP(I) .. SUM(J, x(I,J)) =E= U(I) ;
  47  RECEIVE(J) .. SUM(I, x(I,J)) =E= V(J) ;
  48  ** The next sentence names the model and list its constraints.
  49  MODEL transport /COST,SHIP,RECEIVE/;
  50  ** The next sentence directs GAMS to solve the transportation model using
  51  ** a linear programming solver lp to minimize the objective function.
  52  SOLVE transport USING lp MINIMIZING z;
  53  ** Output file
  54  execute_unload 'OutputFile', z, x;
GAMS Rev 237  WEX-WEI 23.7.3 x86_64/MS Windows                                                                                                                                                                                         03/13/13 12:32:59 Page 2
THE TRANSPORTATION PROBLEM
Include File Summary


   SEQ   GLOBAL TYPE      PARENT   LOCAL  FILENAME

     1        1 INPUT          0       0  C:\Users\spmo\Documents\Dropbox\DTU\Teaching\curso madrid\PresentacionesCurso\PresentacionesDefinitivas\Curso\ExampleInterfaceMatlabGAMS\InterfaceMatlabGAMS\Transportation(MatlabGAMS).gms
     2       15 GDXIN          1      15  C:\Users\spmo\Documents\Dropbox\DTU\Teaching\curso madrid\PresentacionesCurso\PresentacionesDefinitivas\Curso\ExampleInterfaceMatlabGAMS\InterfaceMatlabGAMS\InputData.gdx


COMPILATION TIME     =        0.062 SECONDS      3 Mb  WEX237-237 Aug 23, 2011
GAMS Rev 237  WEX-WEI 23.7.3 x86_64/MS Windows                                                                                                                                                                                         03/13/13 12:32:59 Page 3
THE TRANSPORTATION PROBLEM
Equation Listing    SOLVE transport Using LP From line 52


---- COST  =E=  objective function equation

COST..  z - x(I1,J1) - 2*x(I1,J2) - 3*x(I1,J3) - 2*x(I2,J1) - x(I2,J2) - 2*x(I2,J3) - 3*x(I3,J1) - 2*x(I3,J2) - x(I3,J3) =E= 0 ; (LHS = 0)
     

---- SHIP  =E=  shipping equation

SHIP(I1)..  x(I1,J1) + x(I1,J2) + x(I1,J3) =E= 2 ; (LHS = 0, INFES = 2 ****)
     
SHIP(I2)..  x(I2,J1) + x(I2,J2) + x(I2,J3) =E= 3 ; (LHS = 0, INFES = 3 ****)
     
SHIP(I3)..  x(I3,J1) + x(I3,J2) + x(I3,J3) =E= 4 ; (LHS = 0, INFES = 4 ****)
     

---- RECEIVE  =E=  receiving equation

RECEIVE(J1)..  x(I1,J1) + x(I2,J1) + x(I3,J1) =E= 5 ; (LHS = 0, INFES = 5 ****)
     
RECEIVE(J2)..  x(I1,J2) + x(I2,J2) + x(I3,J2) =E= 2 ; (LHS = 0, INFES = 2 ****)
     
RECEIVE(J3)..  x(I1,J3) + x(I2,J3) + x(I3,J3) =E= 2 ; (LHS = 0, INFES = 2 ****)
     
GAMS Rev 237  WEX-WEI 23.7.3 x86_64/MS Windows                                                                                                                                                                                         03/13/13 12:32:59 Page 4
THE TRANSPORTATION PROBLEM
Column Listing      SOLVE transport Using LP From line 52


---- z  objective function variable

z
                (.LO, .L, .UP, .M = -INF, 0, +INF, 0)
        1       COST


---- x  the amount of product to be shipped from origin I to destination J

x(I1,J1)
                (.LO, .L, .UP, .M = 0, 0, +INF, 0)
       -1       COST
        1       SHIP(I1)
        1       RECEIVE(J1)

x(I1,J2)
                (.LO, .L, .UP, .M = 0, 0, +INF, 0)
       -2       COST
        1       SHIP(I1)
        1       RECEIVE(J2)

x(I1,J3)
                (.LO, .L, .UP, .M = 0, 0, +INF, 0)
       -3       COST
        1       SHIP(I1)
        1       RECEIVE(J3)

REMAINING 6 ENTRIES SKIPPED
GAMS Rev 237  WEX-WEI 23.7.3 x86_64/MS Windows                                                                                                                                                                                         03/13/13 12:32:59 Page 5
THE TRANSPORTATION PROBLEM
Model Statistics    SOLVE transport Using LP From line 52


MODEL STATISTICS

BLOCKS OF EQUATIONS           3     SINGLE EQUATIONS            7
BLOCKS OF VARIABLES           2     SINGLE VARIABLES           10
NON ZERO ELEMENTS            28


GENERATION TIME      =        0.063 SECONDS      4 Mb  WEX237-237 Aug 23, 2011


EXECUTION TIME       =        0.063 SECONDS      4 Mb  WEX237-237 Aug 23, 2011
GAMS Rev 237  WEX-WEI 23.7.3 x86_64/MS Windows                                                                                                                                                                                         03/13/13 12:32:59 Page 6
THE TRANSPORTATION PROBLEM
Solution Report     SOLVE transport Using LP From line 52


               S O L V E      S U M M A R Y

     MODEL   transport           OBJECTIVE  z
     TYPE    LP                  DIRECTION  MINIMIZE
     SOLVER  CPLEX               FROM LINE  52

**** SOLVER STATUS     1 Normal Completion         
**** MODEL STATUS      1 Optimal                   
**** OBJECTIVE VALUE               14.0000

 RESOURCE USAGE, LIMIT          0.016      1000.000
 ITERATION COUNT, LIMIT         5    2000000000

IBM ILOG CPLEX   Jul 14, 2011 23.7.3 WEX 27723.27726 WEI x86_64/MS Windows
Cplex 12.3.0.0

LP status(1): optimal
Optimal solution found.
Objective :          14.000000


                           LOWER          LEVEL          UPPER         MARGINAL

---- EQU COST                .              .              .             1.0000      

  COST  objective function equation

---- EQU SHIP  shipping equation

          LOWER          LEVEL          UPPER         MARGINAL

I1         2.0000         2.0000         2.0000          .          
I2         3.0000         3.0000         3.0000         1.0000      
I3         4.0000         4.0000         4.0000         2.0000      

---- EQU RECEIVE  receiving equation

          LOWER          LEVEL          UPPER         MARGINAL

J1         5.0000         5.0000         5.0000         1.0000      
J2         2.0000         2.0000         2.0000         EPS         
J3         2.0000         2.0000         2.0000        -1.0000      

                           LOWER          LEVEL          UPPER         MARGINAL

---- VAR z                 -INF           14.0000        +INF             .          

  z  objective function variable

---- VAR x  the amount of product to be shipped from origin I to destination J

             LOWER          LEVEL          UPPER         MARGINAL

I1.J1          .             2.0000        +INF             .          
I1.J2          .              .            +INF            2.0000      
I1.J3          .              .            +INF            4.0000      
I2.J1          .             1.0000        +INF             .          
I2.J2          .             2.0000        +INF             .          
I2.J3          .              .            +INF            2.0000      
I3.J1          .             2.0000        +INF             .          
I3.J2          .              .            +INF            EPS         
I3.J3          .             2.0000        +INF             .          


**** REPORT SUMMARY :        0     NONOPT
                             0 INFEASIBLE
                             0  UNBOUNDED
GAMS Rev 237  WEX-WEI 23.7.3 x86_64/MS Windows                                                                                                                                                                                         03/13/13 12:32:59 Page 7
THE TRANSPORTATION PROBLEM
E x e c u t i o n


EXECUTION TIME       =        0.000 SECONDS      3 Mb  WEX237-237 Aug 23, 2011


USER: Produktionstorvet                              A110303:1208AP-GEN
      DTU Management                                             DC8611
      License for teaching and research at degree granting institutions


**** FILE SUMMARY

Input      C:\Users\spmo\Documents\Dropbox\DTU\Teaching\curso madrid\PresentacionesCurso\PresentacionesDefinitivas\Curso\ExampleInterfaceMatlabGAMS\InterfaceMatlabGAMS\Transportation(MatlabGAMS).gms
Output     C:\Users\spmo\Documents\Dropbox\DTU\Teaching\curso madrid\PresentacionesCurso\PresentacionesDefinitivas\Curso\ExampleInterfaceMatlabGAMS\InterfaceMatlabGAMS\Transportation(MatlabGAMS).lst
