with_ROI: Configures a solver based on 'ROI'

Description Usage Arguments Value References Examples

View source: R/with-roi.R

Description

This function makes all solvers in the R package 'ROI' available to solve 'ompr' models.

Usage

1
with_ROI(solver, ...)

Arguments

solver

the 'ROI' solver name (character vector of length 1)

...

optional parameters passed to ROI_solve

Note: it does only support column duals. It currently does not export row duals.

Value

a function: Model -> Solution that can be used together with solve_model. You can find ROI's original solver message and status information in <return_value>$ROI. The ompr status code is "success" if ROI returns code = 0 and is "error" otherwise.

References

Kurt Hornik, David Meyer, Florian Schwendinger and Stefan Theussl (2016). ROI: R Optimization Infrastructure. <https://CRAN.R-project.org/package=ROI>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
library(magrittr)
library(ompr)
library(ROI)
library(ROI.plugin.glpk)
add_variable(MIPModel(), x, type = "continuous") %>%
 set_objective(x, sense = "max") %>%
 add_constraint(x <= 5) %>%
 solve_model(with_ROI(solver = "glpk", verbose = TRUE))

## End(Not run)

ompr.roi documentation built on Jan. 27, 2022, 5:09 p.m.

Related to with_ROI in ompr.roi...