Skip to main content

Binary distribution of the CBC MILP solver (COIN-OR Branch and Cut)

Project description

cbcbox

cbcbox is a Python wheel distribution of pre-built, self-contained binaries for the CBC MILP solver (COIN-OR Branch and Cut), built from the latest master branch of the COIN-OR repositories.

All dynamic dependencies (OpenBLAS, libgfortran, etc.) are bundled inside the wheel — no system libraries or separate installation steps are needed.

Highlights

  • Parallel branch-and-cut — built with --enable-cbc-parallel. Use -threads=N to solve with multiple threads. CBC distributes the branch-and-bound tree across threads, giving significant speedups on multi-core machines for hard MIP instances.

  • AMD fill-reducing ordering — SuiteSparse AMD is compiled in, enabling the high-quality UniversityOfFlorida Cholesky factorization for Clp's barrier (interior point) solver. Compared to the built-in native Cholesky, AMD reordering produces much less fill-in on large sparse problems, making barrier substantially faster. Activate it with -barrier -cholesky UniversityOfFlorida (see barrier usage below).

  • Optimised BLAS — linked against OpenBLAS for fast dense linear algebra.

Supported platforms

Platform Wheel tag
Linux x86_64 manylinux2014_x86_64
Linux aarch64 manylinux2014_aarch64
macOS arm64 (Apple Silicon) macosx_11_0_arm64
macOS x86_64 macosx_10_9_x86_64
Windows AMD64 win_amd64

Installation

Note: cbcbox is now available on PyPI — pip install cbcbox. Pre-built wheel artifacts are also available from the CI runs (see below).

Installing from a pre-built wheel (recommended)

  1. Go to the Actions tab of this repository.

  2. Open the latest successful workflow run.

  3. Download the artifact matching your platform:

    Artifact name Platform
    cibw-wheels-Linux-X64 Linux x86_64
    cibw-wheels-Linux-ARM64 Linux aarch64
    cibw-wheels-macOS-ARM64 macOS Apple Silicon
    cibw-wheels-macOS-X64 macOS x86_64
    cibw-wheels-Windows-X64 Windows AMD64
  4. Unzip the artifact and install the .whl file:

    pip install cbcbox-*.whl
    

Installing from PyPI

pip install cbcbox

Usage

Command line

Invoke the CBC solver directly via the Python module entry point:

python -m cbcbox mymodel.lp -solve -quit
python -m cbcbox mymodel.mps.gz -solve -quit
python -m cbcbox mymodel.mps -seconds 60 -timem elapsed -solve -quit
python -m cbcbox mymodel.mps -dualp pesteep -solve -quit

CBC accepts LP, MPS and compressed MPS (.mps.gz) files. Pass -help for the full list of options, or -quit to exit after solving.

Parallel branch-and-cut

This build includes parallel branch-and-cut (--enable-cbc-parallel). Use -threads=N to distribute the search tree across N threads:

python -m cbcbox mymodel.mps -threads=4 -timem elapsed -solve -quit

Use -timem elapsed when running parallel so that time limits and reported times reflect wall-clock seconds rather than CPU-time (which would be ~N× the wall time).

Barrier (interior-point) solver

Clp's barrier solver can be faster than simplex for large LP relaxations. This build includes SuiteSparse AMD, which enables the high-quality UniversityOfFlorida Cholesky factorization — significantly reducing fill-in compared to the built-in native Cholesky:

# Solve LP relaxation with barrier + AMD Cholesky, then crossover to simplex basis
python -m cbcbox mymodel.mps -barrier -cholesky UniversityOfFlorida -solve -quit

# Useful as a root-node strategy inside MIP (let CBC use simplex for B&B):
python -m cbcbox mymodel.mps -barrier -cholesky UniversityOfFlorida -solve -quit

Without AMD, only -cholesky native (less efficient) is available.

Python API

The package exposes helpers to locate the installed files:

import cbcbox
import subprocess

# Path to the cbc binary (cbc.exe on Windows).
cbcbox.cbc_bin_path()
# e.g. '/home/user/.venv/lib/python3.13/site-packages/cbcbox/cbc_dist/bin/cbc'

# Directory containing the static and dynamic libraries.
cbcbox.cbc_lib_dir()
# e.g. '.../cbcbox/cbc_dist/lib'

# Directory containing the COIN-OR C/C++ headers.
cbcbox.cbc_include_dir()
# e.g. '.../cbcbox/cbc_dist/include/coin'

# Run CBC programmatically.
result = subprocess.run(
    [cbcbox.cbc_bin_path(), "mymodel.mps", "-solve", "-quit"],
    capture_output=True, text=True,
)
print(result.stdout)

What is built

The build pipeline compiles all components from source inside the CI runner, in the following order:

Component Version / branch Purpose
Cbc master Branch-and-cut MIP solver
Cgl master Cut generation library
Clp master Simplex LP solver (used as the MIP node relaxation)
Osi master Open Solver Interface
CoinUtils master Utility library (shared by all COIN-OR packages)
Nauty 2.8.9 Symmetry detection for MIP presolve
AMD (SuiteSparse v7.12.2) v7.12.2 Sparse matrix fill-reducing ordering
OpenBLAS v0.3.31 Optimised BLAS/LAPACK for LP basis factorisation

All COIN-OR components are linked into both static (.a) and shared (.so / .dylib) libraries on Linux and macOS. On Windows only shared libraries (.dll) are produced — MinGW's autotools does not support building static and DLL simultaneously. The shared libraries are patched with self-relative RPATHs and bundled inside the wheel, making them directly usable via cffi or ctypes without any system installation.

Wheel contents

The wheel installs under cbcbox/cbc_dist/ inside the site-packages directory. The layout is:

cbc_dist/
├── bin/
│   ├── cbc           # CBC MIP solver binary  (cbc.exe on Windows)
│   └── clp           # Clp LP solver binary   (clp.exe on Windows)
├── lib/
│   ├── libCbc.a / libCbc.so            # CBC solver
│   ├── libCbcSolver.a / libCbcSolver.so
│   ├── libClp.a / libClp.so            # Clp LP solver
│   ├── libCgl.a / libCgl.so            # Cut generation
│   ├── libOsi.a / libOsi.so            # Solver interface
│   ├── libOsiClp.a / libOsiClp.so      # Clp OSI binding
│   ├── libOsiCbc.a / libOsiCbc.so      # CBC OSI binding (where available)
│   ├── libCoinUtils.a / libCoinUtils.so
│   ├── libamd.a                        # AMD sparse ordering (static only)
│   ├── libsuitesparseconfig.a          # SuiteSparse config (static only)
│   ├── libnauty.a                      # Nauty (static only)
│   ├── libopenblas.a / libopenblas.so  # OpenBLAS BLAS/LAPACK
│   ├── pkgconfig/                      # .pc files for all libraries
│   └── <bundled runtime shared libs>   # Platform-specific — see below
└── include/
    ├── coin/      # COIN-OR headers (CoinUtils, Osi, Clp, Cgl, Cbc)
    ├── nauty/     # Nauty headers
    └── *.h        # SuiteSparse / AMD headers

Bundled dynamic libraries

Because the static COIN-OR libraries link to OpenBLAS, which in turn links to the Fortran runtime, the following shared libraries are bundled inside the wheel and their paths are rewritten so no system installation is required.

Linux (lib/ directory, RPATH set to $ORIGIN)

Library Description
libopenblas.so.0 OpenBLAS BLAS/LAPACK
libgfortran.so.5 GNU Fortran runtime
libquadmath.so.0 Quad-precision math (dependency of libgfortran)

macOS (lib/ directory, install names rewritten to @rpath/)

Library Description
libopenblas.dylib OpenBLAS BLAS/LAPACK
libgfortran.5.dylib GNU Fortran runtime
libgcc_s.1.1.dylib GCC runtime
libquadmath.0.dylib Quad-precision math

Windows (bin/ directory, DLLs placed next to the executable)

Library Description
libopenblas.dll OpenBLAS BLAS/LAPACK
libgfortran-5.dll GNU Fortran runtime
libgcc_s_seh-1.dll GCC SEH runtime
libquadmath-0.dll Quad-precision math
libstdc++-6.dll C++ standard library (MinGW64)
libwinpthread-1.dll POSIX thread emulation

CI / build pipeline

Wheels are built and tested automatically via GitHub Actions using cibuildwheel. The workflow (.github/workflows/wheel.yml) runs on five separate runners:

Runner Produces
ubuntu-latest manylinux2014_x86_64 wheel
ubuntu-24.04-arm manylinux2014_aarch64 wheel
macos-15 macosx_11_0_arm64 wheel
macos-15-intel macosx_10_9_x86_64 wheel
windows-latest win_amd64 wheel

After each wheel is built, the test suite in tests/ is run against the installed wheel to verify correctness.

Integration tests

The test suite (pytest) solves two MIP instances and checks the optimal objective values, both in single-threaded and parallel (2-thread) modes:

Test Instance Expected optimal
test_solve[pp08a] pp08a.mps.gz (240×182) 7350
test_solve[sprint_hidden06_j] sprint_hidden06_j.mps.gz (3694×10210) 130
test_solve_parallel[pp08a] same, -threads=3 7350
test_solve_parallel[sprint_hidden06_j] same, -threads=3 130

The parallel tests verify that --enable-cbc-parallel is functional.

Publishing to PyPI

Note: cbcbox is not yet registered on PyPI. When ready, trigger the workflow manually and select pypi (or testpypi) in the Publish input. Trusted Publisher (OIDC) authentication is used — no API tokens are stored as secrets.

License

CBC and all COIN-OR components are distributed under the Eclipse Public License 2.0. OpenBLAS is distributed under the BSD 3-Clause licence. SuiteSparse AMD is distributed under the BSD 3-Clause licence. Nauty is distributed under the Apache 2.0 licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cbcbox-2.902-py3-none-win_amd64.whl (41.9 MB view details)

Uploaded Python 3Windows x86-64

cbcbox-2.902-py3-none-manylinux2014_x86_64.whl (56.6 MB view details)

Uploaded Python 3

cbcbox-2.902-py3-none-manylinux2014_aarch64.whl (51.1 MB view details)

Uploaded Python 3

cbcbox-2.902-py3-none-macosx_11_0_arm64.whl (42.9 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

cbcbox-2.902-py3-none-macosx_10_13_x86_64.whl (49.2 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

Details for the file cbcbox-2.902-py3-none-win_amd64.whl.

File metadata

  • Download URL: cbcbox-2.902-py3-none-win_amd64.whl
  • Upload date:
  • Size: 41.9 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cbcbox-2.902-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 5d5407939815b178559820071f56ce69dc8d42d3faaa04a87e0475a9a62f0c1b
MD5 2a6c1d591e7b6958640e3966e1795faf
BLAKE2b-256 d8299db2707cb7ccb4fb44f157bcee30464cb2e9a62509966b8ec7592f9e267a

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbcbox-2.902-py3-none-win_amd64.whl:

Publisher: wheel.yml on h-g-s/cbcbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cbcbox-2.902-py3-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cbcbox-2.902-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f9f9d948eaaf97453e5fcd476effd90df9c7a4e58fe8673fff50304a1a15995a
MD5 4dc41872aa248f667a5af29afaecdc7f
BLAKE2b-256 d6fc9b2d6dc679027ae4f99a1771801a8e87fb660e787a36bd98e0ca258ba39b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbcbox-2.902-py3-none-manylinux2014_x86_64.whl:

Publisher: wheel.yml on h-g-s/cbcbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cbcbox-2.902-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for cbcbox-2.902-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a4e3e7f286a3359fa5bb062afeb9920d03bc93862481b36171c97b40a2410f2
MD5 ae30ba0fc59bb3d514d0aa6afbbfaacc
BLAKE2b-256 6edd064b75c617b7fce85327a25f6a0b98ca05c4659dd284f04883415dc68cf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbcbox-2.902-py3-none-manylinux2014_aarch64.whl:

Publisher: wheel.yml on h-g-s/cbcbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cbcbox-2.902-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cbcbox-2.902-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2003d9cdc20c5bb4d9610c403b94d0e7e782d092c90f2ceb05ab747424fbb36b
MD5 d9c7ceeea0fe528eef0915233dbbb605
BLAKE2b-256 a5afc7f28a6ed537e961db2d5927ecbdd6f84067a1f1d404654cbd9653edd0a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbcbox-2.902-py3-none-macosx_11_0_arm64.whl:

Publisher: wheel.yml on h-g-s/cbcbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cbcbox-2.902-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for cbcbox-2.902-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 eb7f2a5ed2e7bdff111c61d7e97f204d197442a7c959908bd37183a02b0a3f78
MD5 89159bc7baf34a573f7a4f1362a767db
BLAKE2b-256 6a1a32f438ade249ff6f238078f2500df30f12fc32e3cf0950086a7066cedda1

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbcbox-2.902-py3-none-macosx_10_13_x86_64.whl:

Publisher: wheel.yml on h-g-s/cbcbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page