Replies: 2 comments 1 reply
-
Sounds like a good idea |
Beta Was this translation helpful? Give feedback.
1 reply
-
The most recent version of ROIoptimizer now supports ROI's library(rmpk)
library(ROI.plugin.glpk)
library(ROI)
#> ROI: R Optimization Infrastructure
#> Registered solver plugins: nlminb, glpk, alabama, quadprog.
#> Default solver: auto.
solver <- ROI_optimizer("glpk")
v <- 1:10
w <- 1:10
model <- optimization_model(solver)
x <- model$add_variable("x", type = "binary", i = 1:10)
model$set_objective(sum_expr(v[i] * x[i], i = 1:10), sense = "max")
model$add_constraint(sum_expr(w[i] * x[i], i = 1:10) <= 10)
roi_OP <- as.OP(solver)
f <- tempfile()
ROI::ROI_write(roi_OP, f, "mps_fixed", "glpk")
print(readLines(f))
#> [1] "* Problem:"
#> [2] "* Class: MIP"
#> [3] "* Rows: 1"
#> [4] "* Columns: 10 (10 integer, 10 binary)"
#> [5] "* Non-zeros: 10"
#> [6] "* Format: Fixed MPS"
#> [7] "*"
#> [8] "NAME"
#> [9] "ROWS"
#> [10] " N R0000000"
#> [11] " L R0000001"
#> [12] "COLUMNS"
#> [13] " M0000001 'MARKER' 'INTORG'"
#> [14] " C0000001 R0000000 -1 R0000001 1"
#> [15] " C0000002 R0000000 -2 R0000001 2"
#> [16] " C0000003 R0000000 -3 R0000001 3"
#> [17] " C0000004 R0000000 -4 R0000001 4"
#> [18] " C0000005 R0000000 -5 R0000001 5"
#> [19] " C0000006 R0000000 -6 R0000001 6"
#> [20] " C0000007 R0000000 -7 R0000001 7"
#> [21] " C0000008 R0000000 -8 R0000001 8"
#> [22] " C0000009 R0000000 -9 R0000001 9"
#> [23] " C0000010 R0000000 -10 R0000001 10"
#> [24] " M0000002 'MARKER' 'INTEND'"
#> [25] "RHS"
#> [26] " RHS1 R0000001 10"
#> [27] "BOUNDS"
#> [28] " UP BND1 C0000001 1"
#> [29] " UP BND1 C0000002 1"
#> [30] " UP BND1 C0000003 1"
#> [31] " UP BND1 C0000004 1"
#> [32] " UP BND1 C0000005 1"
#> [33] " UP BND1 C0000006 1"
#> [34] " UP BND1 C0000007 1"
#> [35] " UP BND1 C0000008 1"
#> [36] " UP BND1 C0000009 1"
#> [37] " UP BND1 C0000010 1"
#> [38] "ENDATA" |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Great start for the project. First suggestion: Integrate the ROI_write function so that a model structure can be visually inspected in standard form.
Beta Was this translation helpful? Give feedback.
All reactions