On JuMP, I have a model
m = Model()
@variable(m, x[1:2])
By passing m to a function, can I obtain the variable x to define a new model with x?
On JuMP, I have a model
m = Model()
@variable(m, x[1:2])
By passing m to a function, can I obtain the variable x to define a new model with x?
can I obtain the variable x
Yes m[:x].
to define a new model with x?
No. x belongs to the model m.
Do you want to make a variable with the same name? Or bounds? Or indices? If so, just pass the necessary data to build the variable rather than the model and actual variable.
Solved in the other post.