No Matches

The GAMS namespace provides objects to interact with the General Algebraic Modeling System (GAMS). Objects in this namespace allow convenient exchange of input data and model results (GAMSDatabase), help to create and run GAMS models (GAMSJob), that can be customized by GAMS options (GAMSOptions). Furthermore, it introduces a way to solve a sequence of closely related model instances in the most efficient way (GAMSModelInstance).

The underlying GAMS engine relies to some extent on file based communication (e.g. the listing file) and other unmanaged resources. The use of external resources in the .NET environment requires special attention. Hence, some objects in the GAMS namespace implement the IDisposable interface (e.g. GAMSDatabase) and need to be properly disposed before the .NET garbage collector does its job.

A GAMS program can include other source files (e.g. $include), load data from GDX files (e.g. $GDXIN or execute_load), and create PUT files. All these files can be specified with a (relative) path and therefore an anchor into the file system is required. The base class GAMSWorkspace manages the anchor to the file system. If external file communication is not an issue in a particular .NET solution, temporary directories and files will be managed by objects in the namespace.

With the exception of GAMSWorkspace the objects in the GAMS namespace cannot be accessed across different threads unless the instance is locked. The classes themself are thread safe and multiple objects of the class can be used from different threads (see below for restrictions on solvers that are not thread safe within the GAMSModelInstance class).

Note: If you use multiple instances of the GAMSWorkspace in parallel, you should avoid using the same WorkingDirectory. Otherwise you may end up with conflicting file names.

This version of the GAMS namespace lacks support for the following GAMS components:

Acronyms, support for GAMS compilation/execution errors (GAMSJob.Run just throws an exception), structured access to listing file, and proper support for solver options.

Currently only Cplex, Gurobi, and SoPlex fully utilize the power of solving GAMSModelInstances. Some solvers will not even work in a multi-threaded application using GAMSModelInstances. For some solvers this is unavoidable because the solver library is not thread safe (e.g. MINOS), other solvers are in principle thread safe but the GAMS link is not (e.g. SNOPT). Moreover, GAMSModelInstances are not available for quadratic model types (QCP, MIQCP, RMIQCP).

This API can be used with different .NET languages. There are examples in C#, VB.NET and Microsoft Visual C++ using this API in [GAMS system]\apifiles. It also works using MONO under Linux and Mac OS X.