Scippy

SCIP

Solving Constraint Integer Programs

Building SCIP with CMake

CMake is a build system generator that can create, e.g., Makefiles for UNIX and Mac or Visual Studio project files for Windows.

CMake provides an extensive documentation explaining available features and use cases as well as an FAQ section. It's recommended to use the latest stable CMake version available. cmake --help is also a good first step to see available options and usage information.

Platform independent build instructions:

cmake -Bbuild -H. [-DSOPLEX_DIR=/path/to/soplex]
cmake --build build --config Release

Linux/macOS Makefile-based build instructions:

mkdir build
cd build
cmake .. [-DSOPLEX_DIR=/path/to/soplex]
make
# optional: run a quick check on some instances
make check
# optional: install scip executable, library, and headers
make install

CMake uses an out-of-source build, i.e., compiled binaries and object files are separated from the source tree and located in another directory. Usually this directory is called build or debug or whatever you prefer. From within this directory, run cmake <path/to/SCIP> to configure your build, followed by make to compile the code according to the current configuration (this assumes that you chose Linux Makefiles as CMake Generator). By default, SCIP searches for Soplex as LP solver. If SoPlex is not installed systemwide, the path to a CMake build directory of SoPlex must be specified (ie one that contains "soplex-config.cmake"). Alternatively, a different LP solver can be specified with the LPS variable, see Modifying a CMake configuration and Available implementations of the LP solver interface.

Afterwards, successive calls to make are going to recompile modified source code, without requiring another call to cmake. The initial configuration step checks your environment for available third-party libraries and packages and sets up the configuration accordingly, e.g., disabling support for GMP if not installed.

The generated executable and libraries are put in directories bin and lib respectively and will simply be named scip or libscip.so. This is different from the naming convention of the previous Makefile setup that appended the configuration details like OS and third party dependencies directly to the name of the binary or library. The CMake setup tries to follow the established Linux/UNIX compilation conventions to facilitate the use of the libraries in other applications. The previously generated sub-libraries like liblpi.so or libobjscip.so are not created by default anymore. They can be built using the respective targets liblpi, libobjscip, etc. The main library libscip.so will contain all SCIP sources and won't have dependencies to the other sub-libs.

Modifying a CMake configuration

There are several options that can be passed to the cmake <path/to/SCIP> call to modify how the code is built. For all of these options and parameters you have to use -D<Parameter_name>=<value>. Following a list of available options, for the full list run

cmake <path/to/SCIP> -LH
CMake option Available values Makefile equivalent Remarks
CMAKE_BUILD_TYPE Release, Debug, ... OPT=[opt, dbg]
GMP on, off GMP=[true, false] specify GMP_DIR if not found automatically
IPOPT on, off IPOPT=[true,false] requires IPOPT version >= 3.12.0; specify IPOPT_DIR if not found automatically
LPS spx, cpx, grb, xprs, ... LPS=... See Available implementations of the LP solver interface for a complete list; specify SOPLEX_DIR, CPLEX_DIR, MOSEK_DIR, ... if LP solver is not found automatically
SYM bliss, none for bliss, specify BLISS_DIR
WORHP on, off WORHP=[true,false] should worhp be linked; specify WORHP_DIR if not found automatically
ZIMPL on, off ZIMPL=[true, false] specify ZIMPL_DIR if not found automatically
READLINE on, off READLINE=[true, false]
..._DIR <custom/path/to/.../package> e.g. IPOPT_DIR, CPLEX_DIR, WORHP_DIR, Readline_DIR ...
CMAKE_INSTALL_PREFIX <path> INSTALLDIR=<path>
SHARED on, off SHARED=[true, false]
CXXONLY on, off use a C++ compiler for all source files
COVERAGE on, off use with gcc, lcov, gcov in debug mode
COVERAGE_CTEST_ARGS ctest argument string see ctest --help for arguments
DEBUGSOL on, off DEBUGSOL=[true,false] specify a debugging solution by setting the "misc/debugsol" parameter of SCIP
LPSCHECK on, off LPSCHECK=[true,false] double check SoPlex results with CPLEX
NOBLKMEM on, off NOBLKMEM=[true,false]
NOBUFMEM on, off NOBUFMEM=[true,false]
NOBLKBUFMEM on, off NOBLKBUFMEM=[true,false]
MT on, off use static runtime libraries for Visual Studio compiler on Windows
PARASCIP on, off PARASCIP=[true,false] thread safe compilation
SANITIZE_... on, off enable sanitizer in debug mode if available
TPI tny, omp, none TPI=[tny,omp,none] enable task processing interface required for concurrent solver

Parameters can be set all at once or in subsequent calls to cmake - extending or modifying the existing configuration.

Testing with CTest

There is an extensive test suite written for CTest, that may take a while to complete. To perform a quick test to see whether the compilation was really successful you may run make check. To see all available tests, run

ctest -N

and to perform a memory check, run

ctest -T MemCheck

If Criterion is installed (set custom path with -DCRITERION_DIR=<path>) the target unittests can be used to compile and run the available unit tests.

A coverage report for the entire test suite can be generated. This requires a modification of the compilation process. Two variables govern the report generation, COVERAGE and COVERAGE_CTEST_ARGS. It is recommended to use the Debug build type.

cmake .. -DCOVERAGE=on -DCOVERAGE_CTEST_ARGS="-R MIP -E stein -j4" -DCMAKE_BUILD_TYPE=Debug

In this example, coverage is enabled in combination with the build type Debug. In addition, only the coverage for tests with "MIP" in the name are run, excluding those that have "stein" in the name. The tests are performed in parallel using 4 cores.

Use the coverage target, e.g., make coverage, to build the coverage report. The generated report can be found under "coverage/index.html".

Installation

CMake uses a default directory for installation, e.g., /usr/local on Linux. This can be modified by either changing the configuration using -DCMAKE_INSTALL_PREFIX as explained in Modifying a CMake configuration or by setting the environment variable DESTDIR during or before the install command, e.g., DESTDIR=<custom/install/dir> make install.

Additional targets

There are several further targets available, which can be listed using make help. For instance, there are some examples that can be built with make examples or by specifying a certain one: make <example-name>.

CMake target Description Requirements
scip build SCIP executable
applications build executables for all applications
examples build executables for all examples
unittests build unit tests the Criterion package, see Testing with CTest
all_executables build all of the above
libscip build the SCIP library
install install SCIP, see Installation
coverage run the test suite and create a coverage report build flag -DCOVERAGE=on
liblpi build the LPI library
libnlpi build the NLPI library
libobjscip build the ObjSCIP library for the C++ wrapper classes