The rcbc package provides an interface to the CBC (COIN-OR branch and cut) solver. Specifically, CBC is an open-source mixed integer programming solver that is developed as part of the Computational Infrastructure for Operations Research (COIN-OR) project. By interfacing with the CBC solver, the rcbc package can be used to generate optimal solutions to optimization problems. Please note that this package is under active development and is still a work in progress.
The package is not yet available on The Comprehensive R Archive Network. To install this package, please use the following R code to install it from the source code repository on GitHub. Please note that CBC solver header and library files also need be installed prior to installing this R package (see below for details).
if (!require(remotes))
install.packages("remotes")
remotes::install_github("dirkschumacher/rcbc")
The package can be installed from source when the Rtools software is installed. Specifically, the CBC solver header and library files are automatically downloaded from RWinLib.
The following system command can be used to install dependencies using Homebrew package manager. After installing CBC and its dependencies, they need to linked in order to install the rcbc package. Please note that if you have previously installed these software, then they will be overwritten with the newer versions.
Here we will provide a brief example showing how the package can be used to solve an optimization problem (see package vignette for more details).
# load package
library(rcbc)
# define optimization problem and solve it
## max 1 * x + 2 * y
## s.t.
## x + y <= 1
## x, y binary
result <- cbc_solve(
obj = c(1, 2),
mat = matrix(c(1, 1), ncol = 2, nrow = 1),
is_integer = c(TRUE, TRUE),
row_lb = -Inf, row_ub = 1, max = TRUE,
col_lb = c(0, 0), col_ub = c(1, 1),
cbc_args = list("SEC" = "1"))
# extract solution status
solution_status(result)
#> [1] "optimal"
# extract solution values
column_solution(result)
#> [1] 0 1
# extract objective value for solution
objective_value(result)
#> [1] 2
There is now a work in progress ROI plugin.
Please cite the rcbc R package and the CBC solver in publications.
To cite the rcbc package in publications, use:
Schumacher D, Ooms J, Yapparov B, Hanson JO (2024). _rcbc: COIN CBC
MILP Solver Bindings_. R package version 0.1.0.9002,
<https://github.com/dirkschumacher/rcbc>.
Forrest J, Lougee-Heimer R (2005). "CBC User Guide." In _Emerging
theory, Methods, and Applications_, 257-277.
<https://doi.org/10.1287/educ.1053.0020>.
Please cite both COIN-OR CBC and this package.
To see these entries in BibTeX format, use 'print(<citation>,
bibtex=TRUE)', 'toBibtex(.)', or set
'options(citation.bibtex.max=999)'.