Title: | Symphony integer linear programming solver in R |
---|---|
Description: | This package was derived from Rsymphony_0.1-17 from CRAN. These packages provide an R interface to SYMPHONY, an open-source linear programming solver written in C++. The main difference between this package and Rsymphony is that it includes the solver source code (SYMPHONY version 5.6), while Rsymphony expects to find header and library files on the users' system. Thus the intention of lpsymphony is to provide an easy to install interface to SYMPHONY. For Windows, precompiled DLLs are included in this package. |
Authors: | Vladislav Kim [aut, cre], Ted Ralphs [ctb], Menal Guzelsoy [ctb], Ashutosh Mahajan [ctb], Reinhard Harter [ctb], Kurt Hornik [ctb], Cyrille Szymanski [ctb], Stefan Theussl [ctb], Mike Smith [ctb] |
Maintainer: | Vladislav Kim <[email protected]> |
License: | EPL |
Version: | 1.35.0 |
Built: | 2024-10-30 08:38:19 UTC |
Source: | https://github.com/bioc/lpsymphony |
High level R interface to the COIN-OR SYMPHONY solver for linear as well as mixed integer linear programming problems (MILPs).
lpsymphony_solve_LP(obj, mat, dir, rhs, bounds = NULL, types = NULL, max = FALSE, verbosity = -2, time_limit = -1, node_limit = -1, gap_limit = -1, first_feasible = FALSE, write_lp = FALSE, write_mps = FALSE)
lpsymphony_solve_LP(obj, mat, dir, rhs, bounds = NULL, types = NULL, max = FALSE, verbosity = -2, time_limit = -1, node_limit = -1, gap_limit = -1, first_feasible = FALSE, write_lp = FALSE, write_mps = FALSE)
obj |
a vector with the objective coefficients |
mat |
a vector or a matrix of the constraint coefficients |
dir |
a character vector with the directions of the constraints.
Each element must be one of |
rhs |
the right hand side of the constraints |
bounds |
|
types |
a character vector giving the types of the objective
variables, with |
max |
a logical giving the direction of the optimization.
|
verbosity |
an integer defining the level of verbosity,
|
time_limit |
an integer defining the time limit in seconds,
|
node_limit |
an integer defining the limit in number of iterations,
|
gap_limit |
when the gap between the lower and the upper bound
reaches this point, the solution process will stop and the best
solution found to that point will be returned,
|
first_feasible |
a logical defining if the solution process
should stop after the first feasible solution has been found,
|
write_lp |
a logical value indicating if an LP representation
of the problem should be written for debugging purposes,
|
write_mps |
a logical value indicating if an MPS representation
of the problem should be written for debugging purposes,
|
SYMPHONY is an open source solver for solving mixed integer linear programs (MILPs). The current version can be found at https://projects.coin-or.org/SYMPHONY. Package lpsymphony uses the C interface of the callable library provided by SYMPHONY, and supplies a high level solver function in R using the low level C interface.
A list containing the optimal solution, with the following components.
solution |
the vector of optimal coefficients |
objval |
the value of the objective function at the optimum |
status |
an integer with status information about the solution returned: 0 if the optimal solution was found, a non-zero value otherwise. |
Reinhard Harter, Kurt Hornik and Stefan Theussl
SYMPHONY development home page (https://projects.coin-or.org/SYMPHONY/wiki).
lp
in package lpSolve;
Rglpk_solve_LP
in package Rglpk.
## Simple linear program. ## maximize: 2 x_1 + 4 x_2 + 3 x_3 ## subject to: 3 x_1 + 4 x_2 + 2 x_3 <= 60 ## 2 x_1 + x_2 + x_3 <= 40 ## x_1 + 3 x_2 + 2 x_3 <= 80 ## x_1, x_2, x_3 are non-negative real numbers obj <- c(2, 4, 3) mat <- matrix(c(3, 2, 1, 4, 1, 3, 2, 2, 2), nrow = 3) dir <- c("<=", "<=", "<=") rhs <- c(60, 40, 80) max <- TRUE lpsymphony_solve_LP(obj, mat, dir, rhs, max = max) ## Simple mixed integer linear program. ## maximize: 3 x_1 + 1 x_2 + 3 x_3 ## subject to: -1 x_1 + 2 x_2 + x_3 <= 4 ## 4 x_2 - 3 x_3 <= 2 ## x_1 - 3 x_2 + 2 x_3 <= 3 ## x_1, x_3 are non-negative integers ## x_2 is a non-negative real number obj <- c(3, 1, 3) mat <- matrix(c(-1, 0, 1, 2, 4, -3, 1, -3, 2), nrow = 3) dir <- c("<=", "<=", "<=") rhs <- c(4, 2, 3) max <- TRUE types <- c("I", "C", "I") lpsymphony_solve_LP(obj, mat, dir, rhs, types = types, max = max) ## Same as before but with bounds replaced by ## -Inf < x_1 <= 4 ## 0 <= x_2 <= 100 ## 2 <= x_3 < Inf bounds <- list(lower = list(ind = c(1L, 3L), val = c(-Inf, 2)), upper = list(ind = c(1L, 2L), val = c(4, 100))) lpsymphony_solve_LP(obj, mat, dir, rhs, types = types, max = max, bounds = bounds)
## Simple linear program. ## maximize: 2 x_1 + 4 x_2 + 3 x_3 ## subject to: 3 x_1 + 4 x_2 + 2 x_3 <= 60 ## 2 x_1 + x_2 + x_3 <= 40 ## x_1 + 3 x_2 + 2 x_3 <= 80 ## x_1, x_2, x_3 are non-negative real numbers obj <- c(2, 4, 3) mat <- matrix(c(3, 2, 1, 4, 1, 3, 2, 2, 2), nrow = 3) dir <- c("<=", "<=", "<=") rhs <- c(60, 40, 80) max <- TRUE lpsymphony_solve_LP(obj, mat, dir, rhs, max = max) ## Simple mixed integer linear program. ## maximize: 3 x_1 + 1 x_2 + 3 x_3 ## subject to: -1 x_1 + 2 x_2 + x_3 <= 4 ## 4 x_2 - 3 x_3 <= 2 ## x_1 - 3 x_2 + 2 x_3 <= 3 ## x_1, x_3 are non-negative integers ## x_2 is a non-negative real number obj <- c(3, 1, 3) mat <- matrix(c(-1, 0, 1, 2, 4, -3, 1, -3, 2), nrow = 3) dir <- c("<=", "<=", "<=") rhs <- c(4, 2, 3) max <- TRUE types <- c("I", "C", "I") lpsymphony_solve_LP(obj, mat, dir, rhs, types = types, max = max) ## Same as before but with bounds replaced by ## -Inf < x_1 <= 4 ## 0 <= x_2 <= 100 ## 2 <= x_3 < Inf bounds <- list(lower = list(ind = c(1L, 3L), val = c(-Inf, 2)), upper = list(ind = c(1L, 2L), val = c(4, 100))) lpsymphony_solve_LP(obj, mat, dir, rhs, types = types, max = max, bounds = bounds)