I have an integer optimization problem of the form:
I would like to model each the uncoupled constraints A_{i}x_{i}\leq b_{i} by passing the data \{A_{i},b_{i}\} and decision variable \{x_{i}\} to a function, say add_A_b_constraint
and then implementing these constraints by calling the function add_A_b_constraint
r times in a loop. In the JuMP documentation I see an example at https://jump.dev/JuMP.jl/stable/tutorials/getting_started/design_patterns_for_larger_models/#Generalize-constraints-and-objectives where we can access each registered variable by passing the JuMP model, say model
itself to the function add_A_b_constraint
and then accessing the registered variable in the function by calling syntax such as model[:x_i]
, but then this does not work for all x_i uniformly.
My question is in such a situation what would be the best practice to pass the data \{A_{i},b_{i}\} and decision variable \{x_{i}\} to a JuMP function to model A_{i}x_{i}\leq b_{i}? Thanks in advance.