dirkschumacher / ompr

R package to model Mixed Integer Linear Programs
https://dirkschumacher.github.io/ompr/
Other
264 stars 35 forks source link

Request Feature: Add Vectorized semantics revisited of MILPModel to MIPModel #445

Open sbmack opened 11 months ago

sbmack commented 11 months ago

From the ompr documentation section MILPModel Vectorized semantics revisited:

n <- 10L
MILPModel() %>% 
  add_variable(x[i, j], i = 1:n, j = 1:n) %>% 
  add_constraint(x[i, j] == 1, i = 1:n, j = 1:n, i == j) %>% 
  add_constraint(x[1:n, 1:n] == 1) # this this equivalent

That code fails with MIPModel but it is a very nice feature also found on commercial model managers. Can it be incorporated into MIPModel? Thanks, SteveM