write.lp: Write Optimization Problem

Description Usage Arguments Details Examples

View source: R/plugin.R

Description

Write a optimization problem to a file.

Usage

1
write.lp(x, file, type=c("lp", "mps", "freemps"))

Arguments

x

an object of type OP.

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.

Details

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)

ROI.plugin.lpsolve documentation built on Aug. 30, 2020, 3:01 a.m.