Scope of variables in optimisation

Thank you both @tomerarnon and @odow

Very helpful. There are few points that I would like to clarify, if you don’t mind:

a. The model[:x] trick would return variable x. I cannot see any example of how to access value of variables x and y using this trick.

Using this symbol trick how optimisation results i.eJuMP.value.(x) and JuMP.value.(y) can be accessed?

As, in my code,

Generator = BuildModel(MXData,Threshold)
Generator[:x] # This would return variable x rater than JuMP.value.(x)

I have figured out how to access the values by making the optimisation function to return variables x and y.
c. With regards to using set_upper_bound function, would the following be a correct way of applying it?

for Threshold = -0.2:0.01:3
set_upper_bound(y, Threshold)
Generator = BuildModel(MXData,Threshold)

Thanks again for helping out