Giter VIP home page Giter VIP logo

rcbc's Introduction

CBC bindings for R

Lifecycle: experimental R-CMD-check-Ubuntu R-CMD-check-Windows R-CMD-check-macOS Documentation Coverage Status CRAN status

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.

Installation

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")

Windows

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.

Linux

Debian/Ubuntu

The following system command can be used to install dependences.

sudo apt-get install coinor-libcbc-dev coinor-libclp-dev

Fedora

The following system command can be used to install dependencies.

sudo yum install coin-or-Cbc-devel coin-or-Clp-devel

macOS

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.

brew tap coin-or-tools/coinor
brew install coin-or-tools/coinor/cbc
brew link cbc --force
brew link coinutils --force
brew link osi --force
brew link clp --force
brew link cgl --force

Usage

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

ROI plugin

There is now a work in progress ROI plugin.

Contribution

Feel free to open issues and send pull requests.

Citation

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, and Hanson JO (2022) rcbc: COIN CBC
  MILP Solver Bindings. R package version 0.1.0.9001.
  https://github.com/dirkschumacher/rcbc

  Forrest J and Lougee-Heimer R (2005) CBC User Guide. In Emerging
  theory, Methods, and Applications (pp. 257--277). INFORMS,
  Catonsville, MD.

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)'.

rcbc's People

Contributors

actions-user avatar byapparov avatar dirkschumacher avatar jeffreyhanson avatar jeroen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rcbc's Issues

Pass control argumnets with rcbc

I have tried to get the first feasible solution from my model but the limit parameters suggested in https://projects.coin-or.org/CoinBinary/export/1059/OptimizationSuite/trunk/Installer/files/doc/cbcCommandLine.pdf seem to not be recognized by the ROI.
This is what i get
Warning message:
In ROI::ROI_solve(op, solver, ...) :
the control arguments c("MAXN", "SEC") are not available in solver 'cbc'

I thought i found the solution here https://cvxr.rbind.io/cvxr_examples/cvxr_parameters/ but it turns to be a demo of how ROI ignores invalid parameters parsing. What I actually seek is a set parameters which are capable to reduce the search and branch'n'cut iterations.
Any suggestions?

Binary variables

Is there any option to incorporate binary variable spec into the problem formulation? As far as I understand we can either specify continous or integer but doesn’t seem possible to pass the binary option. Thanks for any hints

no match for threads argument

Hi, thanks for the package.

I have installed and tried the example code, but it appears not to recognise the threads argument in cbc_args

The last three lines on the console after running the code below are (although a solution is found):

command line - problem -threads 1 -verbose 2 -solve -quit (default strategy 1)
No match for threads - ? for list of commands
No match for 1 - ? for list of commands

I'd like to run with multiple threads and be sure that this is happending. Thanks for any help.

This is with cbc version 2.10.5 Build Date Apr 1 2021; rcbc 0.1.0.9001; r 4.1.1. installed on Windows 10 64bit.

Here is a reproducible example:

remotes::install_github("dirkschumacher/rcbc")
library(rcbc)

## test cbc
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(threads = "1", verbose = "2"))

Installation Fails on Mac OS X 10.15, with R 4.0

Since I often have students who use both Macs and PCs, I have one of each. Things are find one the Windows size, but having problems when trying to install rcbc on my Mac now and encountering difficulty. Actually, I'm trying to install ROI.plugin.cbc (which then attempts to install rcbc, which fails). Has anyone gotten this to work? I have successfully installed CBC via Homebrew. Thank you. Errors shown below:

  • installing source package ‘rcbc’ ...
    ** using staged installation
    Found pkg-config cflags and libs!
    Using PKG_CFLAGS=-I/usr/local/Cellar/cbc/2.10.3_1/include/cbc/coin -I/usr/local/Cellar/cgl/0.60.2/include/cgl/coin -I/usr/local/Cellar/clp/1.17.3/include/clp/coin -I/usr/local/Cellar/osi/0.108.5/include/osi/coin -I/usr/local/Cellar/coinutils/2.11.3/include/coinutils/coin
    Using PKG_LIBS=-L/usr/local/Cellar/cbc/2.10.3_1/lib -L/usr/local/Cellar/cgl/0.60.2/lib -L/usr/local/Cellar/clp/1.17.3/lib -L/usr/local/Cellar/osi/0.108.5/lib -L/usr/local/Cellar/coinutils/2.11.3/lib -lCbcSolver -lCbc -lCgl -lOsiClp -lClpSolver -lClp -lOsi -lCoinUtils -lbz2 -lz -framework Accelerate -lm
    'config' variable 'CXXCPP' is deprecated
    ------------------------- ANTICONF ERROR ---------------------------
    Configuration failed because cbc was not found. Try installing:
  • deb: coinor-libcbc-dev, coinor-libclp-dev (Debian, Ubuntu, etc)
  • rpm: coin-or-Cbc-devel, coin-or-Clp-devel (Fedora, CentOS, RHEL)
  • brew: coin-or-tools/coinor/cbc (Mac OSX)
    If cbc is already installed, check that 'pkg-config' is in your
    PATH and PKG_CONFIG_PATH contains a cbc.pc file. If pkg-config
    is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'

ERROR: configuration failed for package ‘rcbc’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rcbc’
    Error: Failed to install 'rcbc' from GitHub:
    (converted from warning) installation of package ‘/var/folders/xd/dxggcb056s7__z2nxnp28vzc0000gn/T//RtmpqxKQLK/file2323dc3e6c6/rcbc_0.1.0.9001.tar.gz’ had non-zero exit status

Register native routines

File ‘rcbc/libs/rcbc.so’:
Found no calls to: ‘R_registerRoutines’, ‘R_useDynamicSymbols’
It is good practice to register native routines and to disable symbol
search.

all(is.finite(mat)) throws an error with a sufficiently large matrix

  1. This isn't your responsibility but you probably want to know about it. In cbc_solve() the line
assert_that(all(is.finite(obj)), all(is.finite(mat)))

is throwing a cannot allocate vector of size... error for a large enough matrix. I encountered this with a 252367 x 1011738 matrix with 2018936 non-zero elements. This worked and returned correct results from an earlier commit of the package without this line. R versions 4.1.2 and 4.1.3, both Windows and Linux.

  1. Just FYI. I think this is perfectly legal under the GPL but I have a package that depends on rcbc, and I don't expect many potential users to be able to create their own binaries. Therefore I put one in the releases area of my package with links to the source here and documentation on github.io. The source for my packages is at github.com/mlpeck/lppuw.

rcbc was a huge help to me by the way. I had previously used a library called lpsolve, which I think is no longer maintained and in any event was orders of magnitude slower on these problems.

Sensitivity Analysis

Hi, is there a way to perform sensitivity analysis on an optimization model built using cbc solver in R?

using newer cbc module

hi,

on windows the install code by default downloads cbc v2.9.8. I notice that the the official release is already at 2.10.5. is there anyway to use this newer version?

downloading the module on linux using the code on the readme also only gets v2.9.9.

Row constraints are not being followed by CBC

Hello,

We are trying to solve a very simple problem through rcbc and have been running into some issues.

This is the problem that we are trying to solve

image

and this is the corresponding code to match that

rcbc::cbc_solve( obj = c(0,0), mat = matrix(c(1, 0, 0, 1), ncol = 2, nrow = 2), row_ub = c(2,2), row_lb = c(2,2), is_integer = c(FALSE, FALSE), max = FALSE )

but the solution returned is c(0,0) and the solver says the result is not optimal, and we were wondering why that was. Thanks so much!

use C api of CBC

I think it is better to use the C API of CBC. Less overhead, fewer dependencies.

Failing unit test on Ubuntu 14.04

Travis log file:

checking tests ... ERROR
  Running ‘testthat.R’
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
  Total iterations:               0
  Time (CPU seconds):             0.00
  Time (Wallclock seconds):       0.00
  
  presolve has value on
  maxSolutions was changed from 9999999 to 23
  logLevel was changed from 1 to 1
  Total time (CPU seconds):       0.00   (Wallclock seconds):       0.00
  
  testthat results ================================================================
  OK: 19 SKIPPED: 0 FAILED: 1
  1. Failure: cbc_solve: handles unbounded problems (@test-cbc-solver.R#71) 
  
  Error: testthat unit tests failed
  Execution haltedchecking compiled code ... NOTE

Installation fails with R-devel

R-devel has deprecated the CXXCPP flags.

Support in R CMD config for F77, FCPIFCPLAGS, CPP, CXXCPP and CXX98 and similar is deprecated. (CPP is found from the system make and may well not be set.)

Use $CC -E and $CXX -E instead of CPP and CXXCPP.

As a consequence, the rcbc package will not install on R-devel and throws the following error (see here for full log file):

2021-02-25T06:28:12.4819365Z Downloading GitHub repo dirkschumacher/rcbc@HEAD
2021-02-25T06:28:15.0031698Z 
2021-02-25T06:28:15.2400222Z   
2021-02-25T06:28:15.2415310Z    checking for file ‘/tmp/RtmpRW27Ml/remotes41766d8b8a0e/dirkschumacher-rcbc-1c78b0b/DESCRIPTION’ ...
2021-02-25T06:28:15.2498198Z   
2021-02-25T06:28:15.2500340Z ✔  checking for file ‘/tmp/RtmpRW27Ml/remotes41766d8b8a0e/dirkschumacher-rcbc-1c78b0b/DESCRIPTION’
2021-02-25T06:28:15.2560005Z 
2021-02-25T06:28:15.2592458Z   
2021-02-25T06:28:15.2594754Z ─  preparing ‘rcbc’:
2021-02-25T06:28:15.2605134Z 
2021-02-25T06:28:15.2607323Z   
2021-02-25T06:28:15.2691473Z    checking DESCRIPTION meta-information ...
2021-02-25T06:28:15.2725028Z   
2021-02-25T06:28:15.2726542Z ✔  checking DESCRIPTION meta-information
2021-02-25T06:28:15.2737390Z 
2021-02-25T06:28:15.2806982Z   
2021-02-25T06:28:15.2808078Z ─  cleaning src
2021-02-25T06:28:15.2809224Z ─  running ‘cleanup’
2021-02-25T06:28:15.3074250Z 
2021-02-25T06:28:15.3127668Z   
2021-02-25T06:28:15.3130293Z ─  checking for LF line-endings in source and make files and shell scripts
2021-02-25T06:28:15.3142181Z 
2021-02-25T06:28:15.3174079Z   
2021-02-25T06:28:15.3176693Z ─  checking for empty or unneeded directories
2021-02-25T06:28:15.3206736Z ─  building ‘rcbc_0.1.0.9001.tar.gz’
2021-02-25T06:28:15.3273515Z 
2021-02-25T06:28:15.3276704Z   
2021-02-25T06:28:15.3278235Z    
2021-02-25T06:28:15.3402756Z Installing package into ‘/home/runner/work/_temp/Library’
2021-02-25T06:28:15.3404019Z (as ‘lib’ is unspecified)
2021-02-25T06:28:15.5712540Z * installing *source* package ‘rcbc’ ...
2021-02-25T06:28:15.5715309Z ** using staged installation
2021-02-25T06:28:15.5893498Z 
2021-02-25T06:28:15.5895644Z Found pkg-config cflags and libs!
2021-02-25T06:28:15.5897074Z Using PKG_CFLAGS=-I/usr/include/coin
2021-02-25T06:28:15.5899445Z Using PKG_LIBS=-lCbcSolver -lCbc -lpthread -lrt -lCgl -lOsiClp -lClpSolver -lClp -lOsi -lCoinUtils -lbz2 -lz -llapack -lblas -lm
2021-02-25T06:28:15.6150251Z 'config' variable 'CXXCPP' is defunct
2021-02-25T06:28:15.6772924Z ------------------------- ANTICONF ERROR ---------------------------
2021-02-25T06:28:15.6773930Z Configuration failed because cbc was not found. Try installing:
2021-02-25T06:28:15.6775395Z  * deb: coinor-libcbc-dev, coinor-libclp-dev (Debian, Ubuntu, etc)
2021-02-25T06:28:15.6776607Z  * rpm: coin-or-Cbc-devel, coin-or-Clp-devel (Fedora, CentOS, RHEL)
2021-02-25T06:28:15.6777606Z  * brew: coin-or-tools/coinor/cbc (Mac OSX)
2021-02-25T06:28:15.6779209Z If cbc is already installed, check that 'pkg-config' is in your
2021-02-25T06:28:15.6780310Z PATH and PKG_CONFIG_PATH contains a cbc.pc file. If pkg-config
2021-02-25T06:28:15.6781241Z is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
2021-02-25T06:28:15.6782494Z R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
2021-02-25T06:28:15.6783683Z --------------------------------------------------------------------
2021-02-25T06:28:15.6798414Z ERROR: configuration failed for package ‘rcbc’
2021-02-25T06:28:15.6806126Z * removing ‘/home/runner/work/_temp/Library/rcbc’

Note that the specified coin-or dependencies were previously installed:

2021-02-25T06:26:32.5042028Z Selecting previously unselected package coinor-libclp-dev.
2021-02-25T06:26:32.5297113Z Preparing to unpack .../08-coinor-libclp-dev_1.17.5+repack1-1_amd64.deb ...
2021-02-25T06:26:32.5312407Z Unpacking coinor-libclp-dev (1.17.5+repack1-1) ...
...
2021-02-25T06:26:32.8135563Z Selecting previously unselected package coinor-libcbc-dev.
2021-02-25T06:26:32.8449195Z Preparing to unpack .../10-coinor-libcbc-dev_2.10.3+repack1-1build1_amd64.deb ...
2021-02-25T06:26:32.8462032Z Unpacking coinor-libcbc-dev (2.10.3+repack1-1build1) ...

Would it be possible to update the rcbc package so that it is compatible with future versions of R? If it would be helpful, I would be happy to look into submitting a PR to fix this issue?

solver returns not integer decision variables

Dear developers,
I tried to use your package for a personal project I'm working on.
I specified the model as follows:

       result <- rcbc::cbc_solve(
            is_integer = c(FALSE, rep.int(TRUE, n_total - 1)),
            col_lb = rep.int(0, n_total),
            col_ub = c(Inf, rep.int(1, n_total - 1)),
            max = FALSE,
            cbc_args = list("SEC" = "10"),
            obj = c(1, rep.int(0, n_total-1),
            mat = <large matrix with n_total columns and n_row rows>,
            row_lb = <vector with n_rows elements>
       )

The solver says that it found an optimal solution, but when I try to retrieve the solution I get non-integer values for all the variables.
For example, I have negative values and values bigger than one with some decimals.
I tried to use rep.int() instead of rep() because in the default values for the arguments you used it.
Can you explain why this happens?
Should I take only the absolute values of the results and round them to 0 or 1?
I used cbc with other interfaces before and I didn't have this problem.

Reduce dependencies

It seems that not all stated coin dependencies are needed. The package should only require the minimal amount of external libraries.

Make package cross platform

What is the best way to make the package work on Windows and the other supported CRAN platforms? Ideally we would not need to bundle the cbc code with the package.

Installation fails (Windows 10, R v4.0, RTools v4.0.0)

I'm unable to get installation to work properly under the 4.0 versions of R and RTools. After executing > install_github('dirkschumacher/rcbc'), I eventually get:

"C:/rtools40/mingw32/bin/"gcc -I"C:/PROGRA1/R/R-401.0/include" -DNDEBUG -I../windows/cbc-2.9.8/include/coin -I'C:/Users/{user}/Documents/R/win-library/4.0/Rcpp/include' -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c rcbc-init.c -o rcbc-init.o
C:/rtools40/mingw32/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o rcbc.dll tmp.def RcppExports.o cpp_cbc_solve.o rcbc-init.o -L../windows/cbc-2.9.8/lib-8.3.0/i386 -lCbcSolver -lClpSolver -lOsiCbc -lCbc -lCgl -lOsiClp -lClp -lOsi -lCoinUtils -lz -lm -LC:/PROGRA1/R/R-401.0/bin/i386 -lR
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lCbcSolver
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lClpSolver
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lOsiCbc
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lCbc
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lCgl
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lOsiClp
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lClp
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lOsi
C:/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lCoinUtils
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'rcbc'

(Apologies for the automatic Markdown formatting)

Any suggestions? I've tested with R v3.63 and RTools v3.5 and it installed without problem.

C++ code throws warning during CRAN checks

I just tried testing the package on WinBuilder (based on latest commit, 739d51f), and for some reason it throws a warning about the C++ code. I'll see if I can come up with an alternative that avoids this issue (see below for full results)

  • checking whether package 'rcbc' can be installed ... WARNING
    Found the following significant warnings:
    cpp_cbc_solve.cpp:48:29: warning: ISO C++ forbids variable length array 'argList' [-Wvla]
    See 'd:/RCompile/CRANguest/R-release/rcbc.Rcheck/00install.out' for details.

* using log directory 'd:/RCompile/CRANguest/R-release/rcbc.Rcheck'
* using R version 4.0.5 (2021-03-31)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'rcbc/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'rcbc' version '0.1.0.9001'
* package encoding: UTF-8
* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Dirk Schumacher <XXXX>'

New submission

Version contains large components (0.1.0.9001)

License components with restrictions and base license permitting such:
  GPL-3 + file LICENSE
File 'LICENSE':
  Cbc, Cgl, Osi, and Clp are licensed under the Eclipse Public License.
  Rcpp is licensed under GPL.

Possibly mis-spelled words in DESCRIPTION:
  MILP (3:17)
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking serialization versions ... OK
* checking whether package 'rcbc' can be installed ... WARNING
Found the following significant warnings:
  cpp_cbc_solve.cpp:48:29: warning: ISO C++ forbids variable length array 'argList' [-Wvla]
See 'd:/RCompile/CRANguest/R-release/rcbc.Rcheck/00install.out' for details.
* checking installed package size ... OK
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking 'build' directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* loading checks for arch 'i386'
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
** checking whether the namespace can be loaded with stated dependencies ... OK
** checking whether the namespace can be unloaded cleanly ... OK
** checking loading without being on the library search path ... OK
** checking use of S3 registration ... OK
* loading checks for arch 'x64'
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
** checking whether the namespace can be loaded with stated dependencies ... OK
** checking whether the namespace can be unloaded cleanly ... OK
** checking loading without being on the library search path ... OK
** checking use of S3 registration ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... [6s] OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in shell scripts ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking use of PKG_*FLAGS in Makefiles ... OK
* checking use of SHLIB_OPENMP_*FLAGS in Makefiles ... OK
* checking pragmas in C/C++ headers and code ... OK
* checking compiled code ... OK
* checking installed files from 'inst/doc' ... OK
* checking files in 'vignettes' ... OK
* checking examples ...
** running examples for arch 'i386' ... [3s] OK
** running examples for arch 'x64' ... [3s] OK
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
** running tests for arch 'i386' ... [4s] OK
  Running 'testthat.R' [4s]
** running tests for arch 'x64' ... [4s] OK
  Running 'testthat.R' [4s]
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in 'inst/doc' ... OK
* checking re-building of vignette outputs ... [4s] OK
* checking PDF version of manual ... OK
* checking for detritus in the temp directory ... OK
* DONE
Status: 1 WARNING, 1 NOTE

Cannot install

Although it gives Found INCLUDE_DIR and/or LIB_DIR!
I keep getting
`------------------------- [ANTICONF ERROR] ----------------------------------
Configuration failed because cbc was not found. Try installing:

  • deb: coinor-libcbc-dev, coinor-libclp-dev (Debian, Ubuntu, etc)
  • rpm: coin-or-Cbc-devel, coin-or-Clp-devel (Fedora, CentOS, RHEL)
  • brew: coin-or-tools/coinor/cbc (Mac OSX)
    If cbc is already installed, check that 'pkg-config' is in your
    PATH and PKG_CONFIG_PATH contains a cbc.pc file. If pkg-config
    is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'`

I have tried everything, setting the path in my .sh file, setting within R session and also passing the environment path inside the intall_github
remotes::install_github("dirkschumacher/rcbc", configure.vars=c("LIB_DIR='/path/lib' INCLUDE_DIR='/path/include'"))

Could you help me fixing it?

inconsistency in example for cbc_solve()

hi @dirkschumacher thx for this package, hope that it lands on cran soon.

i just spotted a small inconsistency: in the example for cbc_solve(), the mathematical formulation (eqn 1a) in line 172 is
1 * x + 2 * y + 0.5 * z while the objective coefficients used in the example (line 184) is obj = c(1, 2, 3)

Failed installation on MacOS due to missing CBC

I have the same issue as has been described before in what seems to be a closed (ad perhaps solved?) issue: https://bit.ly/3BXa9Wj

When I try to install the package the link to CBC fails, although this has been installed successfully installed using Homebrew.

The specific console output of the failure is exactly the same as in the earlier closed issue: https://bit.ly/3BXa9Wj

Was there a solution to this issue?

Many thanks !

"MILP" in package title throws NOTE in CRAN checks

The current package title (i.e. "COIN CBC MILP Solver Bindings") throws a NOTE in the CRAN checks (on WinBuilder) because "MILP" is not recognized as a word (see below). To help reduce friction when submitting this package to CRAN, I wonder if it's worth tweaking the package title to avoid this note? What do you think @dirkschumacher? This is just a suggestion -- I personally think the package title is perfectly fine -- I just want to help avoid wasting your time during CRAN submission?

If you think it's worth changing the title, what would you like to change it to? Possible options could include "COIN CBC Solver Bindings" or "COIN CBC Mixed Integer Linear Programming Solver Bindings"? If you want to change the title, please let me know and I can submit a PR with the relevant changes?


* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Dirk Schumacher <XXXXX>'

New submission

Version contains large components (0.1.0.9001)

License components with restrictions and base license permitting such:
  GPL-3 + file LICENSE
File 'LICENSE':
  Cbc, Cgl, Osi, and Clp are licensed under the Eclipse Public License.
  Rcpp is licensed under GPL.

Possibly mis-spelled words in DESCRIPTION:
  MILP (3:17)

Cannot be installed behind proxy

Could you provide a built tar.gz file for installation?
I noticed that it requires installation of cbc, could you provide steps of manual installation?
I appreciated.

Compilation failure on Windows CI and R devel

2022-01-13T08:45:40.5951209Z rm -f rcbc.dll RcppExports.o cpp_cbc_solve.o rcbc-init.o
2022-01-13T08:45:40.5951715Z "C:/R/bin/x64/Rscript.exe" "../tools/winlibs.R"
2022-01-13T08:45:40.5952953Z g++ -std=gnu++11 -I"C:/R/include" -DNDEBUG -I../windows/cbc-2.10.5/include/coin -I'D:/a/_temp/Library/Rcpp/include' -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -c RcppExports.cpp -o RcppExports.o
2022-01-13T08:45:40.5954230Z g++ -std=gnu++11 -I"C:/R/include" -DNDEBUG -I../windows/cbc-2.10.5/include/coin -I'D:/a/_temp/Library/Rcpp/include' -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -c cpp_cbc_solve.cpp -o cpp_cbc_solve.o
2022-01-13T08:45:40.5955705Z gcc -I"C:/R/include" -DNDEBUG -I../windows/cbc-2.10.5/include/coin -I'D:/a/_temp/Library/Rcpp/include' -I"c:/rtools42/x86_64-w64-mingw32.static.posix/include" -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -Wall -pedantic -c rcbc-init.c -o rcbc-init.o
2022-01-13T08:45:40.5957053Z g++ -std=gnu++11 -shared -s -static-libgcc -o rcbc.dll tmp.def RcppExports.o cpp_cbc_solve.o rcbc-init.o -L../windows/cbc-2.10.5/lib-10.3.0/x64 -L../windows/cbc-2.10.5/lib/x64 -lCbcSolver -lClpSolver -lOsiCbc -lCbc -lCgl -lOsiClp -lClp -lOsi -lCoinUtils -lz -lm -Lc:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -Lc:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/R/bin/x64 -lR
2022-01-13T08:45:40.5958485Z C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/cbc-2.10.5/lib/x64/libCbcSolver.a(CbcSolver.o):(.text+0x16e49): undefined reference to __imp___iob_func' 2022-01-13T08:45:40.5959379Z C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/cbc-2.10.5/lib/x64/libCbcSolver.a(CbcSolver.o):(.text+0x17a36): undefined reference to __imp___iob_func'
2022-01-13T08:45:40.5962279Z C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/cbc-2.10.5/lib/x64/libCbcSolver.a(CbcSolver.o):(.text+0x17e6e): undefined reference to __imp___iob_func' 2022-01-13T08:45:40.5963787Z C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/cbc-2.10.5/lib/x64/libCbcSolver.a(CbcSolver.o):(.text+0x19154): undefined reference to __imp___iob_func'
2022-01-13T08:45:40.5964692Z C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/cbc-2.10.5/lib/x64/libCbcSolver.a(CbcSolver.o):(.text+0x3b8d5): undefined reference to __imp___iob_func' 2022-01-13T08:45:40.5965979Z C:/rtools40/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../windows/cbc-2.10.5/lib/x64/libCbcSolver.a(CbcSolver.o):(.text.startup+0x1e): more undefined references to __imp___iob_func' follow
2022-01-13T08:45:40.5967991Z collect2.exe: error: ld returned 1 exit status
2022-01-13T08:45:40.5968586Z no DLL was created
2022-01-13T08:45:40.5969394Z ERROR: compilation failed for package 'rcbc'
2022-01-13T08:45:40.5970245Z * removing 'C:/Users/RUNNER~1/AppData/Local/Temp/RtmpgJy71j/Rinst15384e762ac6/rcbc'

Enable parallel by default --enable-cbc-parallel

The best way seems to be to download the source and compile it with --enable-cbc-parallel

Otherwise you cannot use multiple threads.

wget http://www.coin-or.org/download/source/Cbc/Cbc-2.9.8.tgz
gunzip Cbc-2.9.8.tgz
tar xvf Cbc-2.9.8.tar
cd Cbc-2.9.8
mkdir build
cd build
../configure --enable-cbc-parallel
make install
export PKG_CONFIG_PATH="/path/to/build/lib/pkgconfig";
export LD_LIBRARY_PATH="/path/to/build/lib"
Rscript -e "devtools::install_github('dirkschumacher/rcbc')"

see also https://github.com/JuliaOpt/Cbc.jl

Add warmstart

Investigate how and if we can use a warm-start (or hot-start) from a given feasible solution.

using rcbc in a shiny app / windows

I've been working with rcbc under windows 10 for some time now and it works perfectly. I was able to install it using devtools. Now, I would like to test a shiny app I developed that makes use of rcbc. When I try to deploy the app (using RStudio) I got the following error:

------------------------- ANTICONF ERROR ---------------------------
Configuration failed because cbc was not found. Try installing:

  • deb: coinor-libcbc-dev, coinor-libclp-dev (Debian, Ubuntu, etc)
  • rpm: coin-or-Cbc-devel, coin-or-Clp-devel (Fedora, CentOS, RHEL)
  • brew: coin-or-tools/coinor/cbc (Mac OSX)
    If cbc is already installed, check that 'pkg-config' is in your
    PATH and PKG_CONFIG_PATH contains a cbc.pc file. If pkg-config
    is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
    R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'

In general I can understand what the error message is telling but I have no idea how to get rid of it. I would appreciate any ideas. Thanks, Christian.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.