Extract the constraint matrix, the right hand side and the directions from a model

extract_constraints(model)

Arguments

model
the model

Value

a list with three named elements. 'matrix' is the constraint matrix. 'rhs' is the right hand side vector in the order of the matrix. 'direction' is a vector of the constraint directions

Examples

library(magrittr) model <- MIPModel() %>% add_variable(x[i], i = 1:3) %>% add_variable(y[i], i = 1:3) %>% add_constraint(x[i] + y[i] <= 1, i = 1:3) extract_constraints(model)
#> $matrix #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 1 0 0 1 0 0 #> [2,] 0 1 0 0 1 0 #> [3,] 0 0 1 0 0 1 #> #> $direction #> [1] "<=" "<=" "<=" #> #> $rhs #> [1] 1 1 1 #>