GAMS Interface¶
GAMS is a commercial advanced modeling system for mathematical programming problems. GAMS supports a variety of commercial and open source solvers, which can be used to solve optimization problems such as linear programming, nonlinear programming and integer programming, and provides many extended functions, with a wide range of commercial and academic user groups. To facilitate the user to use the Cardinal Optimizer (COPT) in the GAMS modeling environment, we provide the GAMS interface. This chapter will introduce how to use COPT in GAMS.
Setup GAMS interface¶
Before using COPT in GAMS, users need to install and setup GAMS and COPT correctly, please refer to How to install the Cardinal Optimizer for COPT installation and follow the instructions below to setup the GAMS interface of COPT.
Windows¶
For Windows, assume that the GAMS installation path is: "C:\GAMS\win64\27.3"
,
and the COPT installation path is: "C:\Program Files\COPT"
, the GAMS interface files
of COPT are in the subdirectory "lib\gams"
of COPT’s installation path.
Please copy the cptcclib64.dll
file in this directory to the GAMS installation path,
then open the gmscmpNT.txt
file in the subdirectory config
, copy all the contents
and paste it into the gmscmpNT.txt
file under the GAMS installation path.
Linux¶
For Linux, assume that the GAMS installation path is: "/opt/gams"
,
and COPT installation path is: /opt/copt71, the GAMS interface files
of COPT are in the subdirectory "lib/gams"
of COPT’s installation path.
Please copy the libcptcclib64.so
file in this directory to the GAMS installation path,
then open the gmscmpun_unix.txt
file in the subdirectory config
,
copy all the contents and paste it into the gmscmpun.txt
file under
the GAMS installation path.
MacOS¶
For MacOS, it is assumed that the GAMS installation path is: "/Applications/GAMS27.3"
,
and COPT installation path is: /Applications/copt71, the GAMS interface files
of COPT are in the subdirectory "lib/gams"
of COPT’s installation path.
Please copy the libcptcclib64.dylib'' file in this directory to the subdirectory
of the GAMS installation path ``sysdir
, then open the gmscmpun_osx.txt
file
in the subdirectory config
, copy all the contents and paste it into the
gmscmpun.txt
file in the subdirectory sysdir
of the GAMS installation path.
Introduction of features¶
After setup the GAMS interface according to the above instructions, users can check whether the configuration is successful by following operations.
Take using GAMS in command line as an example, open the terminal and execute the following command:
gamslib trnsport
This will get the LP sample model trnsport.gms
that comes with GAMS.
Then execute command bellow to call COPT to solve the LP problem via GAMS interface:
gams trnsport.gms lp=copt
If COPT successfully solve the problem, then the configuration is successful.
The GAMS interface of COPT supports solving LP
, MIP
and RMIP
problems.
For MIP
problems, SOS1
and SOS2
constraints are supported,
and indicator constraints are also supported.
The format of file copt.opt
is consistent with the parameter file format of COPT.
The information of indicator constraints are set by parameter indicatorfile
.
For example, to read information of indicator constraints from file COPT.indic
,
just add the following parameter to parameter file copt.opt
:
indicatorfile COPT.indic
For the indicator constraints support in GAMS, please refer to Indicator constraints in GAMS .
For solution pool of MIP model, the COPT GAMS interface provides two parameters
solnpool
and solnpoolMerge
to control it. If the parameter solnpool
was set, then write solutions in solution pool to file soln_copt_p1.gdx
and so on,
where number represent index in solution pool. If the parameter solnpoolMerge
was set, then COPT will combine solutions in solution pool and then write it to file
specified.