NLP Overconstrained. Too few DOF.

713 views
Skip to first unread message

AA

unread,
Feb 4, 2021, 8:09:34 AM2/4/21
to CasADi
Hi everyone!

I am solving an NLP for a parameter estimation problem.
the system has 12 states and only 6 parameters to estimate.

when I run it, I receive this error:
CasADi -  WARNING("NLP is overconstrained: There are 12 equality constraints but only 6 variables.") [.../casadi/core/nlpsol.cpp:497]
This is Ipopt version 3.12.3, running with linear solver mumps.
NOTE: Other linear solvers might be more efficient (see Ipopt documentation).

Number of nonzeros in equality constraint Jacobian...:       22
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:       21

Exception of type: TOO_FEW_DOF in file "../../../../Ipopt/src/Interfaces/IpIpoptApplication.cpp" at line 887:
 Exception message: status != TOO_FEW_DEGREES_OF_FREEDOM evaluated false: Too few degrees of freedom (rethrown)!

EXIT: Problem has too few degrees of freedom.


any suggestions how to solve this? 
Thank you

Jonas Hjulstad

unread,
Feb 4, 2021, 12:07:24 PM2/4/21
to CasADi
Are you trying to constrain the states and not the parameters?
If you have symbolic variables for the state aswell, you will have to add them to the list of optimization variables.
If you are going to only use 6 variables, you have to build the constraints solely on these variables, I don't think you
can have separately declared mx/sx variables in the mix without adding them to the problem.

Phillip Maree

unread,
Apr 20, 2021, 11:24:15 AM4/20/21
to CasADi
Hi 

Did you manage to solve your warning?

I got a similar issue where it seems it was caused because I have defined parameters as fixed variables in my NLP problem (I pass fixed reference trajectories for my MPC prediction horizon ). 

Ipopt trying to solve the NLP problem issued a warning and prompted I set the Ipopt flag <opts = { 'ipopt.fixed_variable_treatment':'RELAX_BOUNDS'}>.

It seems by using adding additional slack on tight parametric bounds, i.e., param_val <= param <=  param_val + 1e-6 resolves the issue in Casadi.

Maybe there is a better way to defined fixed variables? 
Reply all
Reply to author
Forward
0 new messages