extract_constraints: Extract the constraint matrix, the right hand side and the...

View source: R/model-api.R

extract_constraintsR Documentation

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

Description

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

Usage

extract_constraints(model)

Arguments

model

the model

Value

a list with three named elements. 'matrix' the (sparse) constraint matrix from the Matrix package. 'rhs' is the right hand side vector in the order of the matrix. 'sense' is a vector of the constraint senses

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)

ompr documentation built on Sept. 9, 2023, 9:06 a.m.