Change default value of variable attributes

Hi

Is there any way to change the default values of variable attributes? E.g. levels defaulting to 0 and bounds to ± inf.
Specifically, I suspect we could simplify a lot of code by setting levels to NA or UNDF.
Alternatively, setting default bounds to 0 would allow us to fix sparse high-dimensional variables without creating a huge memory footprint.

Best,
Martin

GAMS does not allow you to change the defaults of a variable. The only thing that it allows are the different variables types, like positive, negative, … which all have different bounds.

I know about the issue with model that do x.fx(i,j,k,l,m,n) = 0; and then you only “free” the ones you are using in your model. This is indeed a bad idea. GAMS has dynamic sets that allow you to only access index tuples that make sense in your model. So instead of using sum((i,j,k,l,m,n), x(i,j,k,l,m,n)) ... and fix the irrelavant x to 0, you just sum over the relevant x: sum(ijklmn(i,j,k,l,m,n), x(ijklmn)).... Obviously, this does not just to be an ijklmn but you can have multiple dynamic sets driving the x variable, e.g. sum((ij(i,j),k,lmn(l,m,n))$(ik(i,k), x(i,j,k,l,m,n)) .... If you don’t want to repeat the logic to limit the x indexes you can supply a set in the model statement that limits the x indexes, see Limited domain for variables. This set then can also be used for bound assignment, e,g. x.up(ijklmn) = 15;

Good luck.
-Michael

Thanks for replying.
Our solution will probably be defining a subset for each variable, and using those to limit their domain in the model.