[Ipopt] Eliminated fixed variables

Stefan Vigerske stefan at math.hu-berlin.de
Tue Feb 22 04:54:44 EST 2011


> I have a NLP with about 2n variables, of which (n'<  n) are fixed (x_l =
> x_u).
> The number of constraints are m+n, of which m are linear inequality
> constraints and n are nonlinear equality constraints.
> My understanding is that IPOPT makes those fixed variables parameters
> instead. Leaving about 2n-n' variables to the solver.
> I get a slightly different result though:
> "Too few degrees of freedom (n_x = 8993, n_c = 17906)"
> I don't know which part of the problem (the nonlinear part only?, or just
> the equality equations?) corresponds to these n_x and n_c numbers.
> I only see n-n' variables for n_x where I expect n_x = 2n-n' = 8993 +17906
> = 26899.
> The number of constraints (n_c) don't include m either, leaving me partially
> confused.
> Perhaps to help me better debug this problem, one can suggest how to access
> the id's of the eliminated variables?
> This way I can make sure if any of the variables are incorrectly eliminated
> (presumably due to my own mistake).

You can look at the ResortX method in IpTNLPAdapter. That one 
reformulates a primal point from the Ipopt internal formulation into the 
TNLP formulation of the users.
P_x_full_x_->CompressedPosIndices() should give you a mapping from your 
TNLP to the one where fixed variables have been eliminated.
Whenever P_x_full_x_->CompressedPosIndices()[i] == -1, then variable i 
in your TNLP was eliminated by Ipopt. If it's not -1, then it gives you 
the index of the variable in the original formulation.
I don't know if there is a public method to access this information, 
maybe you need to modify Ipopt code a bit.

Note that implementing TNLP::get_var_con_metadata allows you to give 
variable and constraint names to Ipopt. With a high enough print level, 
you could then see which variables are still present in the internal 

Note also the fixed_variable_treatment parameter,


> Thanks,
> - Aydin
> _______________________________________________
> Ipopt mailing list
> Ipopt at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/ipopt

More information about the Ipopt mailing list