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