I'm currently implementing Gaussian Belief Space Planning with Model Predictive Control. Currently my solver for the Belief Space Planner is getting the following error if I put my time horizon (N) above 3 (i.e. 4 and onwards). Below my objective function behaves as expected.
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...: 65
Number of nonzeros in inequality constraint Jacobian.: 0
Number of nonzeros in Lagrangian Hessian.............: 27
Error evaluating objective gradient at user provided starting point.
No scaling factor for objective function computed!
Number of Iterations....: 0
Number of objective function evaluations = 0
Number of objective gradient evaluations = 1
Number of equality constraint evaluations = 0
Number of inequality constraint evaluations = 0
Number of equality constraint Jacobian evaluations = 1
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations = 0
Total CPU secs in IPOPT (w/o function evaluations) = 0.000
Total CPU secs in NLP function evaluations = 0.000
EXIT: Invalid number in NLP function or derivative detected.
CasADi - 2020-12-15 13:05:42 WARNING("solver:nlp_grad_f failed: NaN detected for output grad_f_x, at (row 15, col 0).") [.../casadi/core/oracle_function.cpp:265]
CasADi - 2020-12-15 13:05:42 WARNING("solver:nlp_grad_f failed: NaN detected for output grad_f_x, at (row 15, col 0).") [.../casadi/core/oracle_function.cpp:265]
I'm aware that part of my code uses SQRT (e.g. sigmoid(sqrt((mu['x'] - mu[lms[i]])**2 + (mu['y'] - mu[lms[i+1]])**2) - t_max, alpha)) but should never evaluate to negative as everything gets squared before sqrt is taken.
Any suggestions what is going wrong? How can I debug what exactly happens in the OBJ gradient in Row 15 (i.e. NaN detected for output grad_f_x, at (row 15, col 0))? I tried the 'printme' function, but that can't be easily inserted on the gradient of the objective right?
Let me know if you need anymore information (i.e. specific lines of code / functions) to get an accurate assessment of my situation.