CBC#
The COIN Branch and Cut solver (CBC) is an open-source mixed-integer program (MIP) solver written in C++. The driver is built on the MP library, which reformulates logical and other expressions that the solver does not accept natively.
Learn More | Modeling guide | Features | Options | Changes
How to use it#
How to install using amplpy:
# Install Python API for AMPL:
$ python -m pip install amplpy --upgrade
# Install AMPL & solver modules:
$ python -m amplpy.modules install cbc # install CBC
# Activate your license (e.g., free ampl.com/ce or ampl.com/academia licenses):
$ python -m amplpy.modules activate <your-license-uuid>
How to use:
from amplpy import AMPL
ampl = AMPL()
...
ampl.solve(solver="cbc", cbc_options="option1=value1 option2=value2")
Learn more about what we have to offer to implement and deploy Optimization in Python.
ampl: option solver cbc; # change the solver
ampl: option cbc_options 'option1=value1 option2=value2'; # specify options
ampl: solve; # solve the problem
Resources#
Features#
Problem types and algorithms#
Problem types
LP
MILP
Received natively: linear constraints and ranges, SOS. Quadratic objectives are not supported; nonlinear functions are approximated piecewise-linearly; logical constraints become big-M rows.
All constructs: native constraints and expressions by driver.
LP: CLP simplex and barrier
CBC solves LPs with CLP. Barrier settings: bar:... options.
MIP: branch-and-cut
Cut generators: cut:... options, e.g., cut:gomorycuts.
Instrumentation#
For a generic summary of the options and features used most often, see Important features in the MP documentation.
For all models
Model export
Option tech:writemodel. Details
Basis input and output
Option alg:basis. Details
Multiple objectives
Emulated by MP. Option obj:multi. Details
Warm start
Option alg:start. Details
Solver options#
Full list of solver options:
More details on solver options: MP solver options.
Retrieving solutions#
The outcome of the last optimization is stored in the AMPL parameter solve_result_num and the relative message in
solve_result.
display solve_result_num, solve_result;
CBC solve result codes can be obtained by running cbc -! or ampl: shell "cbc -!";:
Solve result table for cbc 2.10.12
0- 99 solved: optimal for an optimization problem,
feasible for a satisfaction problem
100-199 solved? solution candidate returned but error likely
150 solved? MP solution check failed (option sol:chk:fail)
200-299 infeasible
300-349 unbounded, feasible solution returned
350-399 unbounded, no feasible solution returned
400-449 limit, feasible: stopped, e.g., on iterations or Ctrl-C
450-469 limit, problem is either infeasible or unbounded.
Disable dual reductions or run IIS finder for definitive answer.
470-499 limit, no solution returned
500-999 failure, no solution returned
550 failure: numeric issue, no feasible solution
For general information, see MP result codes guide.
Changelog#
- CBC Changelog
- 20251121
- 20251015
- 20250814
- 20250801
- 20250617
- 20250429
- 20250424
- 20250329
- 20250308
- 20250206
- 20241128
- 20241124
- 20240724
- 20240617
- 20240604
- 20240529
- 20240429
- 20240425
- 20240320
- 20240115
- 20231117
- 20231103
- 20231017
- 20230919
- 20230907
- 20230831
- 20230817
- 20230726
- 20230713
- 20230616
- 20230424
- 20230207
- 20221228
- 20221222
- 20221211
- 20221208