Table of Contents
This use-case is still in development and may be incomplete. Please excuse any inconveniences.
Using the GAMS interface
In this use case, we use GCG to solve a problem which is modeled in the GAMS modeling language. First we run GAMS with GCG as external solver. Depending on our GAMS problem, GCG can be called multiple times. For a problem which does not run the solver multiple times, we then use GCG and read in the problem information from the GAMS file. This way, we can easily use the interactive menu of GCG to explore the detection information.
Our problems in GAMS
Define some problem. Clarify, that solve using mip
is needed. For GCG reading *.gms file, only one solve statement is allowed.
Here is an example file (TODO) for a complex GAMS program. Here is an example file (https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_bid.html) for a GAMS program defining a model and solving it once.
Use GAMS with GCG as solver
This part is interesting for you if you want to run a GAMS program using GCG as solver. You can run a complex GAMS program with multiple solve statements, but you will not be able to use the interactive menu of GCG to see, whats going on inside GCG.
1) Install GAMS
Follow the installation notes on the GAMS webpage. You will install GAMS into a directory (called GAMS system directory), this could be e.g. /opt/gams/gams24.3_linux_x64_64_sfx
, /opt/gams
or /home/username/gams/gams30.3_linux_x64_64_sfx
. For clarity, we will here refer to this GAMS system directory with /path/to/gams
. After installing GAMS, you should be able to run GAMS to solve your problem with
/path/to/gams/gams problem.gms
2) Install GCG
In order to use GCG as solver in GAMS, GCG and SCIP need to be built with SHARED=true READLINE=false
. Please follow the installation guide using Makefiles under Easy Installation, Manual Installation or Git Installation and use the Makefile arguments SHARED=true READLINE=false
.
3) Install the GAMSlinks project
In order to link GCG as a solver for GAMS we need the GAMSlinks project. You can download or clone the code from the coin-or/GAMSlinks repository. We will refer to the GAMSlinks base directory with /path/to/GAMSlinks
.
Go to the GAMSlinks directory:
cd /path/to/GAMSlinks
Run the configuration script with the options given below:
./configure\ --with-scip-cflags="-I/path/to/scip/src -DNO_CONFIG_HEADER"\ --with-scip-lflags="-L/path/to/scip/lib/shared -lscipsolver"\ --with-gcg-cflags="-I/path/to/gcg/src -DNO_CONFIG_HEADER"\ --with-gcg-lflags="-L/path/to/gcg/lib/shared -lgcg -L/path/to/scip/lib/shared -lscipsolver"\ --with-soplex-cflags="-I/path/to/soplex/src -DNO_CONFIG_HEADER"\ --with-soplex-lflags="-L/path/to/soplex/lib -lsoplex"\ --with-gams=/path/to/gams
If you want to debug the code in the GAMSlinks project, use the additional flag
--enable-debug
Export SCIP, GCG and SoPlex library path:
export LD_LIBRARY_PATH=/path/to/scip/lib/shared:/path/to/gcg/lib/shared:/path/to/soplex/lib
Build GAMSlinks with
make (sudo) make install
Copy the prepared GAMS configuration file <prefix>/share/gamslinks/gamsconfig.yaml into the GAMS system directory. You can find <prefix> in file config.log
under "Output variables", "prefix=".
Now GAMS can access GCG with SOLVER=GCG
. You can now solve your problem with GAMS using GCG as solver:
/path/to/gams/gams problem.gms SOLVER=GCG
If you encounter any problems, please look into the README of the GAMSlinks project or contact ... .
Build GCG with reader for GAMS files
This part is interesting for you if you use GAMS only to model your problem but do not use advanced commands. Especially, you can only have one solve statement, since GCG expects one modeled problem, that it then solves once. It is not capable of parsing whole GAMS programs.
Since you run GCG, you have your familiar interactive menu.
1. Install GAMS
Follow the guide given above.
2. Download and configure GAMSlinks
GCG uses code from the GAMSlinks project to read in *.gms files. Therefore, you need the files from the GAMSlinks project, but you do not need to install it.
For that, download (or clone) the GAMSlinks project and run ./configure
with the flags given above.
./configure
is needed, since it creates the file config.h
with the correct defines for GCG. This is needed for the GCG specific reading functionality. Without the GCG defines in the config.h
, *.gms files can be read, but the GCG code inside GAMSlinks, which e.g. extracts information for GCG's GAMS classifiers will not be compiled, when building GCG in the next step.
You can omit the make
and make install
.
This is because only the source and header files are needed and are built with GCG in the next step.
3. Install GCG
In order to use GCG with the reader for *.gms files, build SCIP without any Makefile arguments and build GCG with GAMS=true
. Please follow the installation guide using Makefiles under Easy Installation, Manual Installation or Git Installation and use the Makefile arguments SHARED=true READLINE=false
.
You will be asked for softlinks to GAMS and GAMSlinks.
Enter soft-link target file or directory for "lib/include/gams" (return if not needed):
is the promt to enter the directory where the GAMS source files are. This directory will then be linked in the library directory of GCG /lib/include/gams
. Enter the path to your GAMS installation:
/path/to/gams
Analoguously the promt for the GAMSlinks source directory is
Enter soft-link target file or directory for "lib/include/gamslinks" (return if not needed):
Enter the path to your GAMSlinks directory:
/path/to/GAMSlinks
Use classifiers
There are two constraint classifiers and two variable classifiers, which use structural information from the read in *.gms file. For further information have a look at the classifier descriptions under Classifiers.
You can turn on the GAMS classifiers in the interactive menu with the following commands:
set detection classification consclassifier gamsdomain enabled set detection classification consclassifier gamssymbol enabled set detection classification varclassifier gamsdomain enabled set detection classification varclassifier gamssymbol enabled
TODO: Is it possible to change settings if GCG is used as solver in GAMS? Try to use the interactive menu there. That seems to be possible, but I need to find out how...
Implement other classifiers, get information from reader_gmo.cpp
Should we have this here? It's actually not that complicated, since on the reader side everything can be done isolated in one place and the classifier itself can almost be copied (they all look the same).
It will definitely be on the project page. But is this maybe also interesting for others?