APIs - Application Programming Interfaces to GAMS

High-Level APIs

There are three versions of the object-oriented GAMS API: .NET, Java, Python. These APIs work with .NET framework 4 (Visual Studio 2010), Java SE 5 and up, as well as Python 2.7. The object-oriented GAMS API allows the seamless integration of GAMS into an application by providing appropriate classes for the interaction with GAMS. The GAMSDatabase class for in-memory representation of data can be used for convenient exchange of input data and model results. Models written in GAMS can be run with the GAMSJob class and by using the GAMSModelInstance class a sequence of closely related model instances can be solved in the most efficient way.

For each API, there exists a document containing a tutorial and a reference manual:

Expert-Level APIs to GAMS Component Libraries

In addition to the object-oriented GAMS API, there exist expert-level (or low-level) APIs to some component libraries of the GAMS system. These APIs are used internally in GAMS for a long time and help in the deployment of GAMS models. While they offer high performance and flexibility, they also require advanced knowledge and it is recommended that the object-oriented GAMS API is used if possible. The expert-level APIs are offered for C, C++, C#, Delphi, Fortran, Java, Python, and Visual Basic.

The DCT, GEV, and GMO components are mainly used to build solver links to GAMS (see, e.g., the GAMSLinks project at COIN-OR for the interfaces to Bonmin, Cbc, Couenne, Ipopt, and SCIP). In fact, all professional GAMS solver links are based on these components. They provide access to an instance of a model generated by a solve statement. If you plan to build advanced algorithms for models or need to solve a sequence of very similar models these components might represent an alternative to an implementing using the GAMS language.

While we also strive for backward compatibility with our component libraries, but programming interfaces are commonly subject to change, so programs based on these APIs might require adjustment when updating to a new GAMS version. The GAMS release notes have a section on these API changes.

Overviews of the exported function in pseudo code are available in the following summary pages:


There are several examples for the different programming languages available with the distribution in [Path/To/GAMS]/apifiles/. In that directory, the file readme.txt describes how to build and execute these examples. A GAMS script to compile and execute each example is available with the distribution in [Path/To/GAMS]/apilib_ml/ or on-line at GAMS API library.

To execute GAMS directly from other applications see Executing GAMS from other Environments

Supported Platforms

APIs/Platform availability - 24.7   
  x86 32bit
MS Windows
x86 64bit
MS Windows
x86 64bit
x86 64bit
x86 64bit
Sparc 64bit
IBM Power 64bit
GAMS.NET x x x x      
GAMS Java x x x x x x  
GAMS Python x x x 2.7 and 3.4 only      
Low-level/Expert APIs              
       C x x x x x x x
       C++ x x x x x x  
       C# x x          
       Delphi x            
       Fortran1) x x x x x x x
       Java x x x x x x x
       Python x x x 2.7, 3.4 and src only src only src only src only
       VBA x x          
       VB.NET x x          
1) Fortran API files are based on C code to load dynamic libraries. For Windows pure Fortran API files for Intel and Lahey Fortran compilers are included