Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 53 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,99 @@
[![Build Status](https://github.com/jump-dev/Cbc.jl/workflows/CI/badge.svg?branch=master)](https://github.com/jump-dev/Cbc.jl/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/jump-dev/Cbc.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/jump-dev/Cbc.jl)

`Cbc.jl` is a wrapper for the [COIN-OR Branch and Cut (Cbc)](https://projects.coin-or.org/Cbc)
[Cbc.jl](https://github.com/jump-dev/Cbc.jl) is a wrapper for the [COIN-OR Branch and Cut (Cbc)](https://projects.coin-or.org/Cbc)
solver.

The wrapper has two components:

* a thin wrapper around the complete C API
* an interface to [MathOptInterface](https://github.com/jump-dev/MathOptInterface)
* an interface to [MathOptInterface](https://github.com/jump-dev/MathOptInterface.jl)

## Affiliation

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

## License

*Note: This wrapper is maintained by the JuMP community and is not a COIN-OR
project.*
`Cbc.jl` is licensed under the [MIT License](https://github.com/jump-dev/Cbc.jl/blob/master/LICENSE.md).

The underlying solver, [coin-or/Cbc](https://github.com/coin-or/Cbc), is
licensed under the [Eclipse public license](https://github.com/coin-or/Cbc/blob/master/LICENSE).

## Installation

Install Cbc.jl using `Pkg.add`:
Install Cbc using `Pkg.add`:
```julia
import Pkg; Pkg.add("Cbc")
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.)
install the Cbc binaries. You do not need to install Cbc separately.

To use a custom binary, read the [Custom solver binaries](https://jump.dev/JuMP.jl/stable/developers/custom_solver_binaries/)
section of the JuMP documentation.

## Use with JuMP

To use Cbc with [JuMP](https://github.com/jump-dev/JuMP.jl), use `Cbc.Optimizer`:
To use Cbc with JuMP, use `Cbc.Optimizer`:
```julia
using JuMP, Cbc
model = Model(Cbc.Optimizer)
set_optimizer_attribute(model, "logLevel", 1)
set_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.
## MathOptInterface API

For example, `set_optimizer_attribute(model, "seconds", 60.0)`.
The COIN Branch-and-Cut (Cbc) optimizer supports the following constraints and attributes.

* `logLevel` -- Set to 1 to enable solution output.
List of supported objective functions:

For example, `set_optimizer_attribute(model, "logLevel", 1)`.
* [`MOI.ObjectiveFunction{MOI.ScalarAffineFunction{Float64}}`](@ref)

* `maxSolutions` -- Terminate after this many feasible solutions have been found.
List of supported variable types:

For example, `set_optimizer_attribute(model, "maxSolutions", 1)`.
* [`MOI.Reals`](@ref)

* `maxNodes` -- Terminate after this many branch-and-bound nodes have been evaluated.
List of supported constraint types:

For example, `set_optimizer_attribute(model, "maxNodes", 1)`.
* [`MOI.ScalarAffineFunction{Float64}`](@ref) in [`MOI.EqualTo{Float64}`](@ref)
* [`MOI.ScalarAffineFunction{Float64}`](@ref) in [`MOI.GreaterThan{Float64}`](@ref)
* [`MOI.ScalarAffineFunction{Float64}`](@ref) in [`MOI.Interval{Float64}`](@ref)
* [`MOI.ScalarAffineFunction{Float64}`](@ref) in [`MOI.LessThan{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.EqualTo{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.GreaterThan{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.Integer`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.Interval{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.LessThan{Float64}`](@ref)
* [`MOI.VariableIndex`](@ref) in [`MOI.ZeroOne`](@ref)
* [`MOI.VectorOfVariables`](@ref) in [`MOI.SOS1{Float64}`](@ref)
* [`MOI.VectorOfVariables`](@ref) in [`MOI.SOS2{Float64}`](@ref)

* `allowableGap` -- Terminate after optimality gap is less than this value (on an absolute scale).
List of supported model attributes:

For example, `set_optimizer_attribute(model, "allowableGap", 0.05)`.
* [`MOI.ObjectiveSense()`](@ref)

* `ratioGap` -- Terminate after optimality gap is smaller than this relative fraction.
## Options

For example, `set_optimizer_attribute(model, "ratioGap", 0.05)`.
Options are, unfortunately, not well documented.

* `threads` -- Set the number of threads to use for parallel branch & bound.
The following options are likely to be the most useful:

For example, `set_optimizer_attribute(model, "threads", 2)`.
| Parameter | Example | Explanation |
| -------------- | ------- | ------------------------------------------------- |
| `seconds` | `60.0` | Solution timeout limit |
| `logLevel` | `2` | Set to 0 to disable solution output |
| `maxSolutions` | `1` | Terminate after this many feasible solutions have been found |
| `maxNodes` | `1` | Terminate after this many branch-and-bound nodes have been evaluated |
| `allowableGap` | `0.05` | Terminate after optimality gap is less than this value (on an absolute scale) |
| `ratioGap` | `0.05` | Terminate after optimality gap is smaller than this relative fraction |
| `threads` | `1` | Set the number of threads to use for parallel branch & bound |

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:
Start the `cbc` executable from Julia as follows:
```julia
using Cbc_jll
Cbc_jll.cbc() do exe
Expand Down