1package com.gams.examples.transport;
 
   21    public static void main(String[] args)  {
 
   27        File workingDirectory = 
new File(System.getProperty(
"user.dir"), 
"Transport3");
 
   28        workingDirectory.mkdir();
 
   42        opt.
defines(
"gdxincname", 
"tdata");
 
   47            System.out.println(
"x(" + rec.getKey(0) + 
", " + rec.getKey(1) + 
"): level=" + rec.getLevel() + 
" marginal=" + rec.getMarginal());
 
   61            System.out.println(
"x(" + rec.getKey(0) + 
", " + rec.getKey(1) + 
"): level=" + rec.getLevel() + 
" marginal=" + rec.getMarginal());
 
   67               "  i   canning plants   / seattle, san-diego /                    \n" +
 
   68               "  j   markets          / new-york, chicago, topeka / ;           \n" +
 
   71               "  a(i)  capacity of plant i in cases                             \n" +
 
   73               "                          san-diego   600  /                     \n" +
 
   75               "  b(j)  demand at market j in cases                              \n" +
 
   76               "                     /    new-york    325                        \n" +
 
   78               "                          topeka      275  / ;                   \n" +
 
   80               "Table d(i,j)  distance in thousands of miles                     \n" +
 
   81               "               new-york       chicago      topeka                \n" +
 
   82               "  seattle          2.5           1.7          1.8                \n" +
 
   83               "  san-diego        2.5           1.8          1.4  ;             \n" +
 
   85               "Scalar f  freight in dollars per case per thousand miles  /90/ ; \n ";
 
   87     static String model = 
"Sets                                                           \n" +
 
   88               "      i   canning plants                                                   \n" +
 
   92               "      a(i)   capacity of plant i in cases                                  \n" +
 
   93               "      b(j)   demand at market j in cases                                   \n" +
 
   94               "      d(i,j) distance in thousands of miles                                \n" +
 
   95               " Scalar f  freight in dollars per case per thousand miles;                 \n" +
 
   97               "$if not set gdxincname $abort 'no include file name for data file provided'\n" +
 
   98               "$gdxin %gdxincname%                                                        \n" +
 
   99               "$load i j a b d f                                                          \n" +
 
  102               " Parameter c(i,j)  transport cost in thousands of dollars per case ;       \n" +
 
  104               "            c(i,j) = f * d(i,j) / 1000 ;                                   \n" +
 
  107               "       x(i,j)  shipment quantities in cases                                \n" +
 
  108               "       z       total transportation costs in thousands of dollars ;        \n" +
 
  110               " Positive Variable x ;                                                     \n" +
 
  114               "      cost        define objective function                                \n" +
 
  115               "      supply(i)   observe supply limit at plant i                          \n" +
 
  116               "      demand(j)   satisfy demand at market j ;                             \n" +
 
  118               "  cost ..        z  =e=  sum((i,j), c(i,j)*x(i,j)) ;                       \n" +
 
  120               "  supply(i) ..   sum(j, x(i,j))  =l=  a(i) ;                               \n" +
 
  122               "  demand(j) ..   sum(i, x(i,j))  =g=  b(j) ;                               \n" +
 
  124               " Model transport /all/ ;                                                   \n" +
 
  126               " Solve transport using lp minimizing z ;                                   \n" +
 
  128               " Display x.l, x.m ;                                                        \n" +
 
 
GAMSVariable getVariable(String identifier)
 
void defines(String defStr, String asStr)
 
void setSystemDirectory(String directory)
 
void setWorkingDirectory(String directory)
 
GAMSJob addJobFromString(String source)
 
String workingDirectory()
 
This example shows how to set a non-default working directory, to read data from string,...