For variables and constraints, we can use the function getindex(m, :x) to get the variable or constraints.
But for @NLparameter defined in a model, getindex doesn’t work for me. Does anyone know how to get the NLparameter in a model. Many thanks!
p = :x
JuMP.registerobject(m, p, eval(p), "Warning: $(p) has already been registered.")
Although, I am not sure if that is the recommended way of doing things.
Also, make sure that you surround code with backticks, particularly when you are referring to a macro. Otherwise somebody called NLparameter might get pinged (not very likely in this case, but it could happen in general).