nan in jac_g_x Warning and fabs() issues

805 views
Skip to first unread message

Kai Brands

unread,
Jul 6, 2018, 1:22:02 PM7/6/18
to CasADi
Hello Guys,
great work with CasADi. I am a student and have to work with it and I pretty like it.
Now to my questions. I get the following warning:
CasADi -  WARNING("solver:nlp_jac_g failed: NaN detected for output jac_g_x, at nonzero index 1 (row 2, col 0).") [.../casadi/core/oracle_function.cpp:249]
I'm not sure what it is about and would like to know it. Have anybody an idea, where I can search for the error or solution?
Is it the g array or an issue in the boundaries?

Another question and maybe the solution for the first, but I don't know if it is related, is my fabs() calculation.
I have a constrain, that the input has to be between 20 and 80. Another constrain in g is, that the input has to be 5 away from a integer number between the 20 and 80. Is it possible, that for example, if the integer is 50, the optimizer is looking for a solution from 30 upwarts with the gradient, and get stuck at 45 without checking, if the costfunction has a smaller value, higher than 55?


Joel Andersson

unread,
Jul 7, 2018, 2:45:54 PM7/7/18
to CasADi
Hi Kai,

Your first question is probably due to some square root, division or the like, with an undefined derivative value for the given inputs. Look into the equations and potentially add NLP constraints to avoid evaluation at points where the Jacobian is ill-defined.

I don't quite understand your second question. Anyway, please try to stick to one question per post.

Joel
Reply all
Reply to author
Forward
0 new messages