Running GAMS on XMATH

The following discussion describes (very briefly) how to run GAMS for the first time at UCDHSC.
  1. If you are unfamiliar with Unix, you should first spend some time learning some basics of Unix. The following are some nice unix tutorials that are available online. I recommend starting with the first one, but you will also need to learn to use an editor to create files. I highly recommend the emacs editor, which is described in the second tutorial from Idaho State.
  2. GAMS is currently installed on the "xmath" server. So to run GAMS you will need to log on to "xmath". But to do that, you first have to log on to "math" and then issue the following two commands: > ssh_pass > ssh xmath The first command "ssh_pass" sets up your account for a "password_less" log-in to xmath. You only have to run that command once. Thereafter, to get to xmath you will only need to run the second command alone ("ssh xmath").
  3. To run GAMS, you first need to create an input file, which should have a suffix of ".gms". Click here to see an example input file called whouse.gms.
  4. The next step is to run GAMS by typing "gams yourfilename" at the command prompt. When I did this with the whouse.gms file, I got an error message. Here's what my screen looked like:
    > gams whouse
    GAMS Rev 133  Copyright (C) 1987-2002 GAMS Development. All rights reserved
    Licensee: Stephen Billups-Mathematics Dept.              G021028:0915AS-LNX
              University of Colorado at Denver                           DC1553
    --- Starting compilation
    --- whouse.gms(45) 1 Mb 2 Errors
    *** Status: Compilation error(s)
    >
    
  5. When you get such an error message, you can use the .lst file generated by GAMS to figure out where your error was. Click here to see the whouse.lst file that was generated by the above call to GAMS. About 45 lines down in this file, you will see the following:
      43  Model swp simple warehouse problem / all /;
      44
      45  Solve swp minimizing cost using lp;
    ****                          $246     $257
      46
    
    This indicates two errors that were detected when the GAMS interpreter reached the solve statement. The error codes $246 and $257 are described later in the file:
    Error Messages
    
    
    246  Objective variable is not a free variable
    257  Solve statement not checked because of previous errors
    
    **** 2 ERROR(S)   0 WARNING(S)
    
    
    COMPILATION TIME     =        0.012 SECONDS      3 Mb  LEX220-143 Jul 27, 2005
    
    Here we see from error message $246 that we should not have declared the objective variable cost to be a positive variable. So we need to go back and fix this in the whouse.gms file. I.e., we should change the line
    Positive Variables stock,sell,buy,cost
    
    to
    Positive Variables stock,sell,buy
    
  6. After fixing the error, we can rerun gams:
    > gams whouse
    GAMS Rev 133  Copyright (C) 1987-2002 GAMS Development. All rights reserved
    Licensee: Stephen Billups-Mathematics Dept.              G021028:0915AS-LNX
              University of Colorado at Denver                           DC1553
    --- Starting compilation
    --- whouse2.gms(45) 1 Mb
    --- Starting execution
    --- whouse2.gms(41) 1 Mb
    --- Generating model swp
    --- whouse2.gms(45) 1 Mb
    ---    5 rows, 13 columns, and 28 non-zeroes.
    --- Executing CPLEX
    
    GAMS/Cplex    Jun 14, 2002 LNX.CP.CP 20.7 022.024.040.LNX For Cplex 7.5
    Cplex 7.5.0, GAMS Link 22 
    Licensed for 1 use of lp, mip and barrier.
    
    Reading data ...
    Starting Cplex...
    Tried aggregator 1 time.
    LP Presolve eliminated 5 rows and 13 columns.
    All rows and columns eliminated.
    Presolve time =    0.00 sec.
    
    Optimal solution found.
    
    Objective :        -600.000000
    
    --- Restarting execution
    --- whouse.gms(45) 0 Mb
    --- Reading solution for model swp
    *** Status: Normal completion
    >
    
    Success! You can now look at the .lst to see the output. Click here to see the new whouse.lst file.