To use the GAMS COIN-OR links, you need a GAMS system and some COIN-OR solvers.

== Main installation steps ==

1. Install a GAMS system, if you do not have one.
2. Download the GAMS I/O libraries for your system.
3. Download the COIN solvers you want to use.
3. Download and install GLPK, if you want to use the GAMS/GLPK link.
4. Modify the site script for the configure call of the GAMSlinks project.
5. Call configure, make, and make install.
6. Install the GAMS/COIN-OR links in your GAMS system.


== Detailed instructions ==

= Installation of a GAMS system =

For the installation under Linux, a GAMS system is currently required, since it contains some libraries that are required for 
linking. (This requirement might be relaxed in the future.)
A GAMS demonstration system can be downloaded at http://www.gams.com.
The demonstrations limits are:
* Number of constraints: 300
* Number of variables: 300
* Number of nonzero elements: 2000 (of which 1000 nonlinear)
* Number of discrete variables: 50 (including semi continuous, semi integer and member of SOS-Sets)


= Installation of GAMS I/O libraries =

In the directory ThirdParty/GAMSIO you find scripts that downloads (precompiled) GAMS I/O libraries.
According to the kind of system you use, you have to choose a script with the correct acronym.
Currently available are:
* LX3: Linux systems on a 32-bit Intel or AMD CPU.
* VIS: Windows XP, Windows Server 2003, and compatible on AMD- or Intel-based (x86) architectures.
* DAR: Darwin systems on Macintosh


= COIN-OR Solvers =

In the main directory you find the files get.CoinCbc and get.CoinGlpk.
These scripts download the COIN packages required for building the COIN-OR/GAMS links.
If you want to use the Cbc and the Glpk link, call get.CoinCbc.
If you need only the Glpk link, it is sufficient to call get.CoinGlpk.
These scripts apply also the patch osiglpk.patch which simplifies the handling of the logging output for Glpk.


= GLPK =

In the directory ThirdParty/GLPK you find two scripts which downloads, configure and install the GNU Linear Programming Toolkit.
* The script get.glpk.linux seem to work on Linux systems.
  It uses the configure system of the glpk packages to setup, compile, and install glpk.
  If you want to set option for your configure call, you can adjust site script glpk/share/config.site
  (see also https://projects.coin-or.org/BuildTools/wiki/user-configure#ConfigDotSiteFile for information about site-files)
* If you use a Windows system with mingw and Microsoft C compiler (cl) but without gnu tools,
  you can use the script get.glpk.cl.
* If you use a Darwin system, you can use the script get.glpk.darwin.

Note that you will still need to set --with-glpk-incdir and --with-glpk-lib to the corresponding directory and library, resp., when you call the configure script for the GAMSlinks.


= Setup configure call =

For the GAMSlinks under Windows we suggest to compile the code in a different place than where the source code is using the VPATH feature of the build system.
See https://projects.coin-or.org/BuildTools/wiki/user-configure#VpathCompilation for details.

You should consider whether you need to the following options of the configure script (either as arguments in your configure call or by setting up a site-file):

* When the gams system is in the search path, it will automatically found by the GAMSlinks configure script.
  Otherwise if you work under Linux you have to provide a path with the --with-gamssystem option.

* If you do not install the GAMS I/O libraries in ThirdParty/GAMSIO, you can use the option --gams-io to set the path of the GAMS I/O libraries.

* If you want to use the GAMS/GLPK interface, you need to tell configure the path of the GLPK include files (--with-glpk-incdir option) and the arguments for linking with GLPK (--with-glpk-lib).
  Note that you also need to set these parameters when you installed GLPK in ThirdParty/GLPK.

When compiling under Windows with the Microsoft C-compiler, you might need to set also the following variables:

* The GAMS I/O libraries are compiled with the Microsoft C-compiler and linked against LIBC.
  Unfortunately, the COIN-OR buildsystem links by default against LIBCMT when compiling with the Microsoft compiler (cl).
  In this case you need to change the CXXFLAGS used then compiling the COIN-OR packages:
    ADD_CXXFLAGS="-nologo -EHsc -GR"
    DBG_CXXFLAGS=" "
    OPT_CXXFLAGS="-O2 -DNDEBUG"

* MAKE is the name of the make program to use. For me, I had to set it to gmake.

When compiling under Darwin, I had a problem to create the default shared libraries version. Hence, you might consider to use static linking:

* Set the parameters "enable_shared=no" and "enable_static=yes" in your site script,
  or configure with "--enable-shared=no" and "--enable-static=yes".


= Configure and make COIN-OR/GAMS links =

Now you just call
* configure (for VPATH-installations, see https://projects.coin-or.org/BuildTools/wiki/user-configure#VpathCompilation)
* make (or the make program that you prefer, e.g., gmake)
* make install (or using the make program that you prefer, e.g., gmake install)

This should setup the Makefiles, compile all COIN-OR packages and install binaries for the COIN-OR/GAMS links in the subdirectory bin.


= Install COIN-OR solvers in GAMS system =

The "make install" call also created the files gmscc_.zip and gmscg_.zip which contain the GAMS/CoinCbc and GAMS/CoinGLPK links.
To install them in your GAMS system, you copy these files into the gams system directory and call gamsinst there.
gamsinst will then unpack the files and get known about the new solvers.

To use the Cbc and Glpk solver under GAMS, you give the arguments MIP=Cbc or MIP=Glpk to your gams call.
Note, that there are also CoinCbc and CoinGlpk available under gams.
This are the COIN-OR solvers as they are distributed within the gams distribution, not the one that you have just compiled.


