gams:should_i_use_bounds_or_singleton_equations

Q: *What is the difference with respect to model size between*

x.lo(i) = 1000;

and

equation xmin(i); xmin(i) .. x(i) =g= 1000;

and between

x.fx('i0') = 777;

and

equation xinit; xinit .. x('i0') =e= 777;

In general bounds (i.e. `x.lo`

, and `x.up`

) are more efficient than equations: a bound does not make the model bigger while an equation does. For solvers with good presolvers this advantage is less pronounced, as the presolver will convert “singleton equations” like x(i) =g= 1000; into bounds automatically.

Similarly preferably you should not generate many `.fx`

fixed variables. In many cases you can use dollar conditions in the model so that GAMS will not generate them. You can also use the `.holdfixed`

model suffix; this will cause GAMS to consider fixed variables as constants. Again, for a solver with a good presolver many fixed variables are not an issue; they will be removed from the model automatically.

gams/should_i_use_bounds_or_singleton_equations.txt · Last modified: 2007/10/20 05:44 by franz