$ show coin-or/Cbc
This repository is the COIN-OR Branch and Cut (Cbc) solver, a mature, production-grade mixed-integer linear programming (MIP) solver written in C++. The core engine implements branch-and-cut using LP relaxations, cut generation (via Cgl library), branching rules, and heuristics. The architecture is object-oriented with well-defined abstractions for branching objects, heuristics, cut generators, node selection, and tree management. Key entry points include the CbcModel class for programmatic use, the CbcMain0/CbcMain1 functions for command-line execution, and a comprehensive C API (Cbc_C_Interface.h) for embedding in other languages. The codebase is large (hundreds of source files) and includes numerous specialized heuristics (dive variants, RINS, DINS, feasibility pump, local search, etc.), branching strategies (pseudo-cost, SOS, clique, N-way, orbital), and preprocessing techniques. It integrates with the broader COIN-OR ecosystem (Clp, Osi, CoinUtils, Cgl) and supports parallel execution via threads. Despite its age, the code shows active development with recent additions (conflict graph features, branching ranker, configurable dive heuristics) and a new output framework. However, it carries legacy artifacts: autotools build system, an Attic/ directory with deprecated code, extensive conditional compilation (#ifdef blocks), and some experimental or unfinished features.
The LLM identified 3 files worth highlighting for reuse:
A comprehensive C interface to the Cbc solver. Exposes model creation, solving, parameter setting, and callbacks (cut, incumbent, progress). The design is clean, using opaque handles and callback function pointers. Could be adapted to wrap other MIP solvers with minimal changes, providing a stable ABI for language bindings.
Abstract base class for all Cbc heuristics. Defines the interface with virtual methods solution(), setModel(), clone(), and validate(). The hierarchy demonstrates a reusable pattern for implementing custom heuristics. Although tied to CbcModel, the interface could be extracted as a generic heuristic plugin framework for any branch-and-bound solver.
Implements a reference-counted row cut class (CbcCountRowCut) with an embedded hash for duplicate detection (CbcRowCuts). The pattern of managing cut lifetime via increment/decrement and using a hash set to avoid duplicates is reusable in any cut generation or constraint management system.