gams:fixed_variables_vs._parameters_vs._equations

Q: *I use CONOPT with GAMS for solving a rather tough NLP problem (many nonlinearities in the constraints). I have a question about the recent mailing list discussion on PARAMETERS vs. fixed VARIABLES. Arne Drud mentioned that CONOPT does not simplify the nonlinear equations (yet) when variables are fixed (even with HOLDFIXED set true). If so, does introducing equations of the type:*

EQ_XFIX(’A-1’).. X(’A-1’) =E= 100.0 ;

*simplify my NLP?
That is, does this replace the variable *

`X(’A-1’)`

The model attribute `<modname>.holdfixed`

is relevant to the GAMS compiler only; if holdfixed is set on, then variables whose upper and lower bounds are equal are removed from the model before it is passed on to the solver (i.e. they are treated as parameters). Thus, in order to simplify the NLP (or any model, for any solver), you would want to set the variable bounds, for example: `X.fx(’A-1’) = 100.0;`

In general, doing something like this is a good idea. The following example illustrates different ways of fixing variables.

* begin holdfixed.gms SET J / 1 * 10 /; PARAMETER a(J); a(J) = uniform(1,10); VARIABLES x(J),z; EQUATIONS f(J), objdef; objdef.. z =e= sum{J, power(x(J)-4,2)}; f(J) .. x(J) =e= a(J); model foo / objdef /; model bar / objdef, f /; option nlp = conopt; * this model has many constraints, many free variables * the solver has freedom in presolving/removing them (if it can) or not * in the listing, the nonzero marginals are on the equation f(J) solve bar using nlp minimizing z; * this model has one constraint, many variables * the solver has freedom in presolving/removing them (if it can) or not * in the listing, the nonzero marginals are on the variables x(J) x.fx(J) = a(J); solve foo using nlp minimizing z; * with holdfixed on, the solver sees only one constraint, one variable * it doesn’t even know the variable x exists * in the listing, you won’t see any marginals for x, * since the solver never saw x x.m(J) = 0; foo.holdfixed = 1; solve foo using nlp minimizing z; * end holdfixed.gms

gams/fixed_variables_vs._parameters_vs._equations.txt · Last modified: 2007/08/10 09:11 (external edit)