Title: | 'lp_solve' Plugin for the 'R' Optimization Infrastructure |
---|---|
Description: | Enhances the 'R' Optimization Infrastructure ('ROI') package with the 'lp_solve' solver. |
Authors: | Florian Schwendinger [aut, cre] |
Maintainer: | Florian Schwendinger <[email protected]> |
License: | GPL-3 |
Version: | 1.0-0 |
Built: | 2025-01-24 05:24:51 UTC |
Source: | https://github.com/roigrp/roi.plugin.lpsolve |
The control variables are all optional, but can in some cases be used to improve the solving time and the solutions.
basis |
an optional named list used to set the initial basis of the
|
branch.mode |
an optional list used to set the branch and bound mode,
e.g.,
|
branch.weights |
an optional numeric vector giving the weights for the decision variables.
The length of the |
verbose |
a character string (for more information see lp.control). |
anti.degen |
a character vector (for more information see |
basis.crash |
a character string (for more information see |
bb.depthlimit |
a integer giving the maximum branch-and-bound depth (for more information see |
bb.floorfirst |
a character string (for more information see |
bb.rule |
a character vector giving the branch-and-bound rule (for more information see |
break.at.first |
a logical controlling whether the branch-and-bound algorithm should be
stopped at the first solution or the branch-and-bound algorithm continuous
until an optimal solution is found
(for more information see |
break.at.value |
a numeric, if given the branch-and-bound algorithm stops
when the objective function becomes smaller than the specified value.
(for more information see |
epslevel |
a character string giving the type of thresholds
(for more information see |
epsb |
a numeric giving the tolerance for the right-hand-side
(for more information see |
epsd |
a numeric
(for more information see |
epsel |
a numeric
(for more information see |
epsint |
a numeric
(for more information see |
epsperturb |
a numeric
(for more information see |
epspivot |
a numeric
(for more information see |
improve |
a character vector
(for more information see |
infinite |
a numeric
(for more information see |
maxpivot |
a integer
(for more information see |
mip.gap |
a numeric vector
(for more information see |
negrange |
a numeric
(for more information see |
obj.in.bas |
a logical
(for more information see |
pivoting |
a character vector
(for more information see |
presolve |
a character vector
(for more information see |
scalelimit |
a numeric
(for more information see |
scaling |
a character vector
(for more information see |
simplextype |
a character vector which an take one of the following values
|
timeout |
a integer giving the number of seconds till a timeout occurs
(for more information see |
library(ROI) mat <- matrix(c(3, 4, 2, 2, 1, 2, 1, 3, 2), nrow=3, byrow=TRUE) x <- OP(objective = c(2, 4, 3), constraints = L_constraint(L = mat, dir = c("<=", "<=", "<="), rhs = c(60, 40, 80)), maximum = TRUE) opt <- ROI_solve(x, solver = "lpsolve") opt ## Optimal solution found. ## The objective value is: 7.666667e+01 solution(opt) ## [1] 0.000000 6.666667 16.666667
library(ROI) mat <- matrix(c(3, 4, 2, 2, 1, 2, 1, 3, 2), nrow=3, byrow=TRUE) x <- OP(objective = c(2, 4, 3), constraints = L_constraint(L = mat, dir = c("<=", "<=", "<="), rhs = c(60, 40, 80)), maximum = TRUE) opt <- ROI_solve(x, solver = "lpsolve") opt ## Optimal solution found. ## The objective value is: 7.666667e+01 solution(opt) ## [1] 0.000000 6.666667 16.666667
Read a optimization problem from a file.
read.lp(file, type=c("lp", "mps", "freemps"))
read.lp(file, type=c("lp", "mps", "freemps"))
file |
a character giving the name of the file the optimization problem is read from. |
type |
a character giving the name of the file format the optimization problem is stored in. |
The optimization problems can be read from the three file formats "lp"
,
"mps"
and "freemps"
.
Where it seems important to note that the "lp"
format refers to
lpsolves
native file format
(http://lpsolve.sourceforge.net/5.5/lp-format.htm)
and not to the CPLEX LP format
.
## Not run: op <- read.lp("optimization_problem.lp") sol <- ROI_solve(op) solution(sol) ## End(Not run)
## Not run: op <- read.lp("optimization_problem.lp") sol <- ROI_solve(op) solution(sol) ## End(Not run)
Write a optimization problem to a file.
write.lp(x, file, type=c("lp", "mps", "freemps"))
write.lp(x, file, type=c("lp", "mps", "freemps"))
x |
an object of type |
file |
a character giving the name of the file the optimization problem is written to. |
type |
a character giving the name of the file format used to store the optimization problem. |
The optimization problems can be written to the three file formats "lp"
,
"mps"
and "freemps"
.
Where it seems important to note that the "lp"
format refers to
lpsolves
native file format
(http://lpsolve.sourceforge.net/5.5/lp-format.htm)
and not to the CPLEX LP format
.
## Not run: mat <- matrix(c(3, 4, 2, 2, 1, 2, 1, 3, 2), nrow=3, byrow=TRUE) x <- OP(objective = c(2, 4, 3), constraints = L_constraint(L = mat, dir = c("<=", "<=", "<="), rhs = c(60, 40, 80)), bounds = V_bound(ui = seq_len(3), ub = c(1000, Inf, 1000), nobj = 3), maximum = TRUE) write.lp(x, "optimization_problem.lp") ## End(Not run)
## Not run: mat <- matrix(c(3, 4, 2, 2, 1, 2, 1, 3, 2), nrow=3, byrow=TRUE) x <- OP(objective = c(2, 4, 3), constraints = L_constraint(L = mat, dir = c("<=", "<=", "<="), rhs = c(60, 40, 80)), bounds = V_bound(ui = seq_len(3), ub = c(1000, Inf, 1000), nobj = 3), maximum = TRUE) write.lp(x, "optimization_problem.lp") ## End(Not run)