21.3 Major release (January 19, 2004)

GAMS System

Model Library

  • Models from the "Handbook of Computible General Equilibrium Modeling", University of Tokyo Press, Tokyo (to appear) have been added to the model library.
  • Several QCP models have been added
  • A series of models that illustrate the BCH (Branch-and-Cut-and-Heuristic) Facility have been added


  • New library of models developed for testing and quality control:
    • Solver correctness
    • Base module features
    • Performance
  • Designed for use by GAMS staff and our solver providers
  • Allows any user to reproduce our tests
  • To retrieve models from testlib: > testlib ....


  • The tabs showing the file names in the editor are maintainded in sorted order using the full path name.
  • Support for regular expressions in search, search and replace and search in files
  • When searching text using Ctrl-F, the word under the cursor will be used as the text to search for.
  • Added a viewer for reference files. A reference file is created using the rf option in the gams call. The IDE assumes that the file extension for the reference file is '.ref'
  • An option was added to emulate a subset of the Epsilon keyboard mapping.

GDX Utilities

  • GDXMerge added; a utility to combine multiple gdx files into a single gdx file.
  • GDX2Veda added; a utility to export GAMS data into the [VErsatile Data Analyst (VEDA)] (http://www.kanors-emr.org/software).

GAMS Branch-and-Cut-and-Heuristic (BCH) facility

  • The GAMS Branch-and-Cut-and-Heuristic (BCH) facility allows GAMS users to interact with a running MIP/MINLP solver by supplying specialized GAMS programs to generate cutting planes and good integer feasible solutions. This allows GAMS users to apply complex solution stragies without having to have intimate knowledge about the inner workings of a specific MIP system. BCH strategies can now be implemented rapidly and reliably within a matter of days rather than weeks. Details and examples can be found here.

Quadratically Constrained Program Types QCP, MIQCP and RMIQCP

  • New model types for quadratically constrained problems are:
    • QCP: Quadratically Constrained Programs
    • MIQCP: Mixed Integer Quadratically Constrained Programs
    • RMIQCP: Relaxed Mixed Integer Quadratically Constrained Programs
  • These model types are like NLP, MINLP and RMINLP with nonlinearities restricted to be quadratic forms. QCP problems can be solved with existing nonlinear solvers and large-scale LP solvers that offer quadratic extensions. For examples, look at the models qalan, qcp1, qdemo7, and qsambal in the model library.

Solver Link Options SOLVELINK

  • This new option allows you to control the way solver's or subsystems are invoked. This may be helpful when solving a large number of models that are relatively small compared to the size of the overall database.
  • The new options values are:
    • 0: Make an automatic save/restart for each solve (default - old behavior)
    • 1: Calls the subsystem using the shell method
    • 2: Call the subsystem using the spawn method
  • This option can be specified as a gams parameter (> gams ... solvelink=n), as part of an option statement (option solvelink=n;) or specified as a model attribute (mymodel.solvelink=n;) Some demo limits removed
  • The demo version size restriction on the number of symbols and number of unique set elements has been removed. Previously, the demo/student versions were limited to 2000 symbols.

Save Point Options SAVEPOINT

  • This new option directs GAMS to write solutions to GDX files for later use in the same or other programs. This may be helpful in cases when we want to provide good starting points or process large number of solutions at a later stage. The new option values are:
    • 0: Do not write point files (default)
    • 1: Write the solution the GDX file <workdir><modelname>_p.gdx
    • 2: Write the solution the GDX file <workdir><modelname>_p<solvenumber>.gdx
  • This option can be specified as a gams parameter (> gams ... savepoint=n), as part of an option statement (option savepoint=n;) or specified as a model attribute (mymodel.savepoint=n;). The execute_loadpoint allows you to merge solution points into any GAMS database.

Relaxed MCP and MPEC syntax

  • A variable can now appear in more than one equ.var pair in the model list, however, in the final instance of the model, all mappings have to be unique.


  • execute_load
    • gamspar = gdxvar.xx: xx can be l m ...
    • gamsvar.xx = gdxvar.xx
  • execute_unload:
    • no arguments means dump all
    • allow multiple occurrence of the same symbol x.l x.up x a a
    • x.l=a: a is the complete x variable


  • This new command execute_loadpoint is similar to EXECUTE_LOAD, however, the new values are merged with the old values. If no arguments besides the name of the GDX file are given, all variables and equations that match variables and equations of the calling GAMS programs will be merged with the GDX level and marginal values. Bounds, scales and priorities will remain unchanged. This can be very useful in connection with the SAVEPOINT facility.

Nested GAMS parameter PF=xxx

  • The command line include parameter can now handle nested includes

New Functions

A number of new functions have been added.

  • TimeStart: Accumulated restart time
  • TimeComp: Compilation time in seconds
  • TimeExec: Execution time in seconds
  • TimeClose: accumulated save time
  • Frac: frac(x) is the fractional part of x
  • ErrorLevel: Returns code of the most recently called external program
  • HeapSize: Current Heap size in Mbytes
  • Fact: Factorial
  • UniformInt: Uniform integer random number between UniformInt(low,high)
  • PI: The famous constant 3.14....
  • NcpF: NcpF(x,y,c) = sqrt(sqr(x) + sqr(y) + 2*c) - x - y Fisher
  • NcpCM: NcpCM(x,y,c) = x - c*ln(1+exp((x-y)/c) Chen-Mangasarian
  • Entropy: entropy(x) = -x*log(x)
  • Sigmoid: sigmoid(x) = 1/(1+exp(-x))
  • Log2: logarithm base 2
  • IfThen: ifthen(condition,true expression,false expression)
  • Edist: Edist(x,y,..) = sqrt(sqr(x)+sqr(y)+..)
  • CEntropy: centropy(x,c) = x*ln(x/c) Cross Entropy

Set Table

  • Allows to enter set data in tabular form similar to parameter data. The data entries can be numbers and special values including yes/no. To allow data tables to be interpreted as Parameters or sets, the special values of NO and YES will be interpreted as 0 and 1 respectively.

Some new minor and exotic features

  • Dynamic reinterpretation of real powers. When using automatic translation it may be helpful to treat a real power as an integer power if the exponent is constant and within e-12 of an integer value. This can be enabled by setting Option sys10=1; and disabled by setting option sys10=0; (default).
  • File Name Casing. File names as passed to the operating system maintain the original casing. This can be changed with the GAMS parameter FILECASE=n, where
    • n=0 means to retain original casing (default)
    • n=1 uppercase the filename, and
    • n=2 will lowercase the filename.
  • $CLEARERROR clear all compilation errors
  • $TERMINATE terminates compilation and skips executions
  • $SETNAMES filename filepath filename fileextension separates the string filename into its three components and stores then as GAMS environment variables. For example, $setname d:\gams\xxx.txt fp fn fe creates/updates three string variables fp, fn, fe which will combine into the original filename string by %fp%%fn%%fe%.
  • $SETCOMPS s1.s2.s3.. first second third separates the string s1.s2... into its components and stores them in the environment variables first, second,..
  • $IF WARNINGS command
  • $REMARK comment with string substitution
  • $ON/OFFUNDF allows the use of the special value UNDF in data statements and expression.
  • System.xxx and %system.xxx% have been enhanced and unified. The complete list is:
      ,VERSION PLATFORM, LP, NLP, ...all model types, LICE1, LICE2, GSTRING,
    The system.xxx form is used in PUT statements, the %system.xxx% form is used for string substitutions during compilation.
  • Fast Projections and Aggregations The GAMS executions engine performs poorly on certain large data structures. This can be overcome with telling GAMS to 'pipeline' certain operations via an OPTION statement.
    Option left < right, left <= right,..;
    Where left and right are GAMS identifiers with conforming domain declarations. The dimensionality of the left symbol has to be equal or less than the dimensionality of the right side. If the left dimensionality is less than the right one, the operation performed is an aggregation or projection depending on the data type of the left side. In all cases, indices are permuted according to the domain definitions. If a symbol has identical domain definitions they are permuted right to left (<) or left to right (<=). For example, assume we have
    Set i, fromto(i,i), tofrom(i,i); 
    parameter in(i), out(i); 
    option tofrom < fromto, in < fromto, out <= fromto;
    is equivalent to
    tofrom(i,ii) = fromto(ii,i); 
    in(i) = sum(fromto(ii,i),1); 
    out(i) = sum(fromto(i,ii), 1);



  • Improved memory management
  • Default bounds are new +/- infinity
  • CONOPT run not required to get marginals
  • Several algorithmic improvements


  • GAMS/Cplex is now based on Cplex 9.0. In addition to performance improvements and enhancements of existing features, support is provided for the new GAMS model types QCP and MIQCP. Because of some compatibility issues, we still ship CPLEX 8.1 for Digital Unix. Details can be found here.

Large scale QCP Solvers

  • MOSEK handles QCP and MIQCP models
  • CPLEX handles QCP and MIQCP models.
  • XPRESS handles QCP with quadratic term in the objective only.
  • SBB handles MIQCP models.
  • PATHNLP takes advantage of quadratic forms for QCP models.

NLP solvers capable of solving QCPs

  • All NLP solvers (CONOPT, MINOS, SNOPT, ...) handle QCP and RMIQCP models.

AMPL and Lingo Wrappers are now part of the GAMS distribution



  • Improved reporting of formulation errors
  • There are new rules for choosing proper labels and identifiers in MPSGE models. The MPSGE engine was initially designed around the old 10-character limit for labels and identifiers imposed by GAMS/Base. When GAMS/Base relaxed these limits to 31 characters, a flag was added to check for compatibility with the old rules to avoid breaking MPSGE. We've now removed the check in GAMS/Base - the MPSGE engine makes its own check now. This means we can use long labels and identifiers under the new rules.
  • The testlib models mpsge01 * mpsge10 document and test the rules for identifiers in MPSGE models. E.g. do
       testlib mpsge01
       gams mpsge01