Cbc
COIN-OR Branch-and-Cut solver
Install / Use
/learn @coin-or/CbcREADME
Cbc
Projects such as this one are maintained by a small group of volunteers under the auspices of the non-profit COIN-OR Foundation and we need your help! Please consider sponsoring our activities or volunteering to help!
This file is auto-generated from config.yml using the generate_readme script. To make changes, please edit config.yml or the generation scripts here and here.
Cbc (Coin-or branch and cut) is an open-source mixed integer linear programming solver written in C++. It can be used as a callable library or using a stand-alone executable. It can be used in a wide variety of ways through various modeling systems, packages, etc.
- Stand-alone modeling languages and systems
- AIMMS (via the AIMMSlinks project),
- AMPL (natively),
- CMPL,
- GAMS (through the GAMSlinks project),
- Mathematica,
- Matlab (https://inverseproblem.co.nz/OPTI/)
- MiniZinc,
- MPL (through the CoinMP project),
- R (https://rdrr.io/github/yuehmeir2/myFormAssembler/man/cbc.html)
- Python-based modeling languages and extensions
- Extensions in other languages
- JuMP (Julia),
- rust-lp-modeler (Rust)
- good_lp (Rust)
- Spreadsheet extensions
Cbc is developed by John Forrest, now retired from IBM Research, and others. The project is currently managed by John Forrest, Ted Ralphs, Stefan Vigerske, Haroldo Gambini Santos, and the rest of the Cbc team.
Cbc is written in C++ and is released as open source under the Eclipse Public License 2.0.
It is distributed under the auspices of the COIN-OR Foundation.
The Cbc development site is https://github.com/coin-or/Cbc.
CITE
CURRENT BUILD STATUS
DOWNLOAD
What follows is a quick start guide for obtaining or building Cbc on common platforms. More detailed information is available here.
Docker image
There is a Docker image that provides Cbc, as well as other projects in the COIN-OR Optimization Suite here
Binaries
For newer releases, binaries will be made available as assets attached to releases in Github here. Older binaries are archived as part of Cbc here.
-
Linux (see https://repology.org/project/coin-or-cbc/versions for a complete listing):
- arch:
$ sudo pacman -S coin-or-cbc - Debian/Ubuntu:
$ sudo apt-get install coinor-cbc coinor-libcbc-dev - Fedora/Redhat/CentOS:
$ sudo dnf install coin-or-Cbc coin-or-Cbc-devel - freebsd:
$ sudo pkg install math/cbc - linuxbrew:
$ brew install cbc
- arch:
-
Windows: The easiest way to get Cbc on Windows is to download an archive as described above.
-
Mac OS X: The easiest way to get Cbc on Mac OS X is through Homebrew.
$ brew tap coin-or-tools/coinor $ brew install coin-or-tools/coinor/cbc -
conda (cross-platform):
$ conda install coin-or-cbc
Due to license incompatibilities, pre-compiled binaries lack some functionality. If binaries are not available for your platform for the latest version and you would like to request them to be built and posted, feel free to open a discussion on Github.
Source
Source code can be obtained either by
- Downloading a snapshot of the source code for the latest release version of Cbc from the releases page,
- Cloning this repository from Github, or
- Using the coinbrew script to get the project and all dependencies (recommended, see below).
Dependencies
Cbc has a number of dependencies, which are detailed in
config.yml. Dependencies on other COIN-OR projects are
automatically downloaded when obtaining the source with coinbrew. For some
of the remaining third-party dependencies, automatic download scripts and
build wrappers are provided (and will also be automatically run for required
and recommended dependencies), while other libraries that are aeasy to obtain
must be installed using an appropriate package manager (or may come with your
OS by default).
BUILDING from source
These quick start instructions assume you are in a bash shell.
Using coinbrew
To download and build Cbc from source, execute the following on the command line.
wget https://raw.githubusercontent.com/coin-or/coinbrew/master/coinbrew
chmod u+x coinbrew
./coinbrew fetch Cbc@master
./coinbrew build Cbc
For more detailed instructions on coinbrew, see https://coin-or.github.io/coinbrew.
The coinbrew script will fetch the additional projects specified in the Dependencies section of config.yml.
Without coinbrew (Expert users)
- Download the source code, e.g., by cloning the git repo https://github.com/coin-or/Cbc
- Download and install the source code for the dependencies listed in config.yml
- Build the code as follows (make sure to set PKG_CONFIG_PTH to install directory for dependencies).
./configure -C
make
make test
make install
With Microsoft Visual Studio
For Microsoft Visual C++ users, there are project files for version 10
available in the MSVisualStudio directory. First, obtain the source code
using either a Windows git client or download a snapshot. In MSVC++ Version
10, open the solution file (this should be converted to whatever version of
MSVC+ you are using) and build the Cbc project. The code should build out of
the box with default settings.
It is also possible to build Cbc with the Visual Studio compiler from the
command line using the procedure for Unix-like environments, using the Msys2
shell or CYGWIN. This is the recommended and best-supported way of building
Cbc in Windows from source. To do so, make sure the cl compiler is in your
path and add --enable-msvc to build command of coinbrew`.
If you want to build a parallel version of CBC using Visual Studio you can following instructions: (thanks to Tobias Stengel and Alexis Guigue).
Assumptions:
- A VS solution with all necessary projects (libCbc, libClp, libCbcSolver,
libCgl, libCoinUtils, libOsi, libOsiCbc, libOsiClp). The project files can
be found inside the
MSVisualStudiofolders.
Steps (based on VS 2013):
-
for each of the lib* projects do: add
CBC_THREADunder Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions (a subset of the lib* projects may be sufficient, but it doesn't hurt to do it for all) -
Link against a pthreads library. PThreadsWin32 works (even in 64 bits systems) and is distributed under the LGPL. If you decide to use the precompiled binaries: both pthreadVC2 and pthreadVS2 seem to work. Otherwise: third party VS project files for pthreads4win can be found on github.
Note: If you use C++/Cli, make sure that no callback (eventHandlers, custom cut generators, custom heuristics, ...) contains managed code. Otherwise your code will crash at runtime with AssembyNotFoundExceptions inside the native threads created by Cbc. Even if not, problems with the GC are likely.
-
If you link statically against pthreads4win, you have to define PTW32_STATIC_LIB when building your program/Cbc (e.g. via Properties -> C/C++/Preprocessor -> Preprocessor Definitions) AND - only if you build pthreads yourself - when building pthreads. Linking pthreads dynamically works without additional preprocessor definitions.
-
pass
-threads yourNumbertoCbcMain1
Doxygen Documentation
If you have Doxygen available, you can build a HTML docume

