Registers COIN-OR Clp with the R Optimization Infrastructure, through the coinclp package.
This revives ROI.plugin.clp,
archived from CRAN on 2022-01-08 — not for any fault of its own, but
because the clpAPI package it depended on had been archived
six weeks earlier. The solver is now called "coinclp"
rather than "clp", since ROI takes the solver name from the
package name.
Clp itself is a system library; install it first (nothing to do on Windows, where Rtools supplies it).
# install.packages("remotes")
remotes::install_github("SamLovick/coinclp")
remotes::install_github("SamLovick/ROI.plugin.coinclp")Loading the package is the whole setup:
library(ROI)
library(ROI.plugin.coinclp)
op <- OP(objective = c(143, 60),
constraints = L_constraint(rbind(c(120, 210), c(110, 30), c(1, 1)),
rep("<=", 3), c(15000, 4000, 75)),
maximum = TRUE)
res <- ROI_solve(op, solver = "coinclp")
solution(res) # 21.875 53.125
solution(res, "objval") # 6315.625
solution(res, "dual") # 0.0000 1.0375 28.8750
solution(res, "aux") # $primal row activities, $dual reduced costs
solution(res, "msg") # the full coinclp result, including iterationsConstraints held as a simple_triplet_matrix, which is
how ROI stores them, go to Clp in sparse form — nothing is densified on
the way.
| Control | Meaning |
|---|---|
log_level |
Clp’s message level, 0 (silent, default) to 4 |
max_iterations |
iteration limit |
max_seconds |
time limit in seconds |
algorithm |
"auto", "primal", "dual",
"barrier", "barrier_nocross" |
presolve |
run Clp’s presolve, TRUE by default |
primal_tolerance, dual_tolerance |
simplex tolerances |
scaling |
0 off, 1 equilibrium, 2 geometric, 3 auto, 4 dynamic |
ROI_solve(op, solver = "coinclp", algorithm = "barrier", max_seconds = 30)The names the 2018 plugin used — amount,
verbosity_level, iterations,
seconds — are still accepted, so scripts written for it
keep working after changing the solver name.
algorithm, presolve, tolerance and
scaling controls are new.Eclipse Public License, matching COIN-OR and the original plugin. The code is independent of ROI.plugin.clp by Benoit Thieurmel (datastorm-open), whose control names are kept for compatibility.