Cbc.jl

Build Status codecov

Cbc.jl is a wrapper for the COIN-OR Branch and Cut (Cbc) solver.

The wrapper has two components:

Note: This wrapper is maintained by the JuMP community and is not a COIN-OR project.

Installation

Install Cbc.jl using Pkg.add:

import Pkg; Pkg.add("Cbc")

In addition to installing the Cbc.jl package, this will also download and install the Cbc binaries. (You do not need to install Cbc separately.)

To use a custom binary, read the Custom solver binaries section of the JuMP documentation.

Use with JuMP

To use Cbc with JuMP, use Cbc.Optimizer:

using JuMP, Cbc
model = Model(Cbc.Optimizer)
set_optimizer_attribute(model, "logLevel", 1)

Options

Options are, unfortunately, not well documented.

The following options are likely to be the most useful:

  • seconds -- Solution timeout limit.

    For example, set_optimizer_attribute(model, "seconds", 60.0).

  • logLevel -- Set to 1 to enable solution output.

    For example, set_optimizer_attribute(model, "logLevel", 1).

  • maxSolutions -- Terminate after this many feasible solutions have been found.

    For example, set_optimizer_attribute(model, "maxSolutions", 1).

  • maxNodes -- Terminate after this many branch-and-bound nodes have been evaluated.

    For example, set_optimizer_attribute(model, "maxNodes", 1).

  • allowableGap -- Terminate after optimality gap is less than this value (on an absolute scale).

    For example, set_optimizer_attribute(model, "allowableGap", 0.05).

  • ratioGap -- Terminate after optimality gap is smaller than this relative fraction.

    For example, set_optimizer_attribute(model, "ratioGap", 0.05).

  • threads -- Set the number of threads to use for parallel branch & bound.

    For example, set_optimizer_attribute(model, "threads", 2).

The complete list of parameters can be found by running the cbc executable and typing ? at the prompt.

You can start the cbc executable from Julia as follows:

using Cbc_jll
Cbc_jll.cbc() do exe
    run(`$(exe)`)
end