Other possible conventions

Top  Previous  Next

In addition one may develop a number of other conventions.  Paul Leiby at Oak Ridge National Laboratory sent me the following

Establish some convention (any convention) on the use of upper and lower case letters.  GAMS may be case insensitive, but it will preserve your use of case for documentation purposes.  I usually use lower case for text, comments, and variable descriptors, and upper case for GAMS reserved words and variable and parameter names.
In declaring variables and parameters, always indicate the units in the variable descriptor: ie instead of

 

 PARAMETER VEHSALES(r)  REGIONAL VEHICLE SALES

 use

 PARAMETER VEHSALES(r)  "Regional vehicle sales ($ millions/yr)"

 

 This will cause the units to be shown with every DISPLAY statement for that parameter or variable, and can be a time-saver when interpreting results or entering data.

Make a habit of always surrounding the explanatory text with quotes

Allowing the use of special characters, such as "$", "-" or "&"

Applying a distinct separator for the Descriptor field, demarking it and emphasizing that it is a text string

Maintain a file modification log at the top of each file (Modification date, version number, modification made, and by whom.

With respect to the last suggestion above such a log can be entered in GAMS statements as is done in the FASOM model using a set specified like

 

 version(*,*,*,*)

 

and accompanied by commands in the code like

 

version("filename","may","19","2002")=yes;

 

then in final model I display the set version so it shows me the time of alterations in the various model components and allows me to make sure my version is synchronized with others.

 

display version;

 

One other suggestion

In assigning item names consider adopting a convention starting all sets with s_, all data with d_, all variables with v_, all equations with e_ etc.