To compile SHOT you need to have the following component libraries available on your system.
A solver for mixed-integer linear programming (MILP) problems. SHOT supports the open-source solver Cbc (2.10 or newer), and the commercial solvers CPLEX (12.8 or newer) and Gurobi (8.0 or newer). If you are an academic user, you can download free versions of both CPLEX and Gurobi.
A solver for nonlinear programming (NLP) problems. SHOT currently supports only Ipopt (3.12 or newer). If you call SHOT from GAMS or by reading a GAMS-model file in SHOT, you can also use any licensed NLP solver available in GAMS.
Instructions for compiling Cbc available at https://github.com/coin-or/Cbc/.
Instructions for compiling Ipopt available at https://github.com/coin-or/Ipopt.
Clone SHOT with git
git clone https://www.github.com/coin-or/SHOT --recursive
or manually downloading the source code from Github.
SHOT utilizes CMake to generate the build system. The settings for CMake are specified in the file
CMakeLists.txt that is available in the root SHOT folder you downloaded in step 2.
Normally you would not need to edit the
CMakeLists.txt file; instead settings can be provided as arguments when calling CMake.
Compiles SHOT with AMPL interface (ASL), e.g. for use with Pyomo or JuMP.
Compiles SHOT with support for Cbc as MIP solver.
Defines where the Cbc libraries and headers are located.
Compiles SHOT with support for CPLEX as MIP solver.
Defines where the CPLEX libraries and headers are located.
Compiles SHOT with GAMS interface.
Defines where GAMS is installed
Compiles SHOT with support for Gurobi as MIP solver.
Defines where the Gurobi libraries and headers are located.
Compiles SHOT with support for Ipopt as NLP solver.
Defines where the Ipopt libraries and headers are located.
Whether the SHOT executable (or just the libraries) should be generated.
So to compile a completely free version of SHOT you can issue the following commands:
git clone https://www.github.com/coin-or/SHOTcd SHOTmkdir buildcd buildcmake -DCMAKE_BUILD_TYPE=Release \-DHAS_CBC=on -DCBC_DIR=/opt/cbc \-DHAS_IPOPT=on -DIPOPT_DIR=/opt/ipopt ..
Note that compiling SHOT (and its dependencies) on Windows might be challenging. Recommended options on Windows is to either use Windows Subsystem for Linux or MSYS2, for which similar steps as above can be used.
If you want to use MSYS2, instructions are available at https://github.com/coin-or/SHOT/issues/11#issuecomment-569580328.
After compiling SHOT, you can use
make install to install SHOT (including the binary, library and header files) to your system. By default the install is made into
/usr/local on a Linux-system. If you want to change this, you can substitute the call to CMake above with:
cmake --install /path/to/install/dir \-DCMAKE_INSTALL_PREFIX=/path/to/install/dir \-DCMAKE_BUILD_TYPE=Release \-DHAS_CBC=on -DCBC_DIR=/opt/cbc \-DHAS_IPOPT=on -DIPOPT_DIR=/opt/ipopt ..
Note that the
--installneeds to come first.
You can also (only tested on Linux) create installation packages (ZIP or a self-extracting installation program) using CPack (which is a part of CMake).
To create installation files directly in the build directory, just execute the command
make package or
cpackafter the steps above have completed.
Build the SHOT library as in discussed above, but make sure to pass the GAMS system directory to the cmake call via
Then add the following entry to
gmscmpnx.txt on Windows) in the GAMS system directory:
SHOT 1101 5 0001020304 1 0 2 MINLP MIQCPgmsgenus.rungmsgenux.out/path/to/libSHOTSolver.so sht 1 1