Closed chris13337 closed 2 years ago
👋 Please provide a reproducible example (https://reprex.tidyverse.org/) if possible, then it is easier to find the problem. A good debugging strategy is make the model as small as possible and then to add constraints one by one to see which one breaks.
Hi,
I am using the OMPR package for a few months now and I, first of all, would like to thank you for the great effort you put into this! I am having a problem while formulating a problem. This is a working code example from me:
` add_constraint(sum_expr(x[i]* help_matrix[i,1],i = 1:length(projection$proj_total)) <= 3) %>%
add_constraint(sum_expr(x[i]* help_matrix[i,2],i = 1:length(projection$proj_total)) <= 3) %>%
add_constraint(sum_expr(x[i]* help_matrix[i,3],i = 1:length(projection$proj_total)) <= 3) %>%
add_constraint(sum_expr(x[i]* help_matrix[i,4],i = 1:length(projection$proj_total)) <= 3) %>%
add_constraint(sum_expr(x[i]* help_matrix[i,5],i = 1:length(projection$proj_total)) <= 3) %>% `
is there a more efficient way to do it? ( I am sure there is one, but I am not able to implement it. I tried this:
add_constraint(sum_expr(x[i]* help_matrix[i,j],i = 1:length(projection$proj_total)) <= 3,j <- 1:5) %>%
but I get an error for this: Fehler in check_for_unknown_vars_impl(model, the_ast) : The expression contains a variable that is not part of the model.
how can this be solved? I am looking forward to your answer!
Kind regards,
Christian Schumacher