add_constraint {ompr} | R Documentation |
Add one or more constraints to the model using quantifiers.
add_constraint(.model, .constraint_expr, ..., .show_progress_bar = TRUE) add_constraint_( .model, .constraint_expr, ..., .dots, .show_progress_bar = TRUE )
.model |
the model |
.constraint_expr |
the constraint. Must be a linear (in)equality with operator "<=", "==" or ">=". |
... |
quantifiers for the indexed variables. For all combinations of bound variables a new constraint is created. In addition you can add filter expressions |
.show_progress_bar |
displays a progressbar when adding multiple constraints |
.dots |
Used to work around non-standard evaluation. |
a Model with new constraints added
library(magrittr) MIPModel() %>% add_variable(x[i], i = 1:5) %>% add_constraint(x[i] >= 1, i = 1:5) # creates 5 constraints