# GAMS Support Wiki

### Site Tools

gams:should_i_use_bounds_or_singleton_equations

# Differences

This shows you the differences between two versions of the page.

 gams:should_i_use_bounds_or_singleton_equations [2007/10/20 07:44]Franz Nelissen gams:should_i_use_bounds_or_singleton_equations [2020/05/28 15:16]Michael Bussieck Both sides previous revision Previous revision 2020/05/28 15:29 Michael Bussieck 2020/05/28 15:16 Michael Bussieck 2020/05/27 16:17 Lutz Westermann format and link to documentation2007/10/20 07:44 Franz Nelissen 2007/09/28 13:30 external edit Next revision Previous revision 2020/05/28 15:29 Michael Bussieck 2020/05/28 15:16 Michael Bussieck 2020/05/27 16:17 Lutz Westermann format and link to documentation2007/10/20 07:44 Franz Nelissen 2007/09/28 13:30 external edit Last revision Both sides next revision Line 7: Line 7: and and <​code>​ <​code>​ - equation ​xmin(i); + Equation ​xmin(i); xmin(i) .. x(i) =g= 1000; xmin(i) .. x(i) =g= 1000; ​ Line 16: Line 16: and and <​code>​ <​code>​ - equation ​xinit; + Equation ​xinit; xinit .. x('​i0'​) =e= 777; xinit .. x('​i0'​) =e= 777; ​ Line 22: Line 22: 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. 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. + 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 [[https://​www.gams.com/​latest/​docs/​UG_GamsCall.html#​GAMSAOholdfixed|.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. + + Nonlinear solvers usually do not violate bounds, because bounds describe the region where function and derivative calculations are possible, e.g. ''​log(x)''​ with ''​x.lo=1e-6;''​. A constraint ''​xlo.. x =g= 1e-6;''​ can in principle be violated by the solvers feasibility tolerance. If this tolerance is larger than 1e-6 then the 0 (and negative numbers) becomes part of the region where the solver can evaluate points and hence might triggers evaluation errors.