Getting error when using parameter set_value function rather than just setting a constant

208 views
Skip to first unread message

A.S

unread,
Aug 24, 2020, 7:52:28 AM8/24/20
to CasADi
Hi Joris,

I have the following type of code: (I am using the bonmin solver, that contain both noninteger, and integer variables)

self.c = self.opti.parameter(1,1)
self.opti.set_value(self.c,  value)
self.opti.subject_to(2  >= self.c)

When I run my code, I get this error:

CasADi - 2020-08-24 13:43:09 WARNING("solver:nlp_grad failed: NaN detected for output grad_gamma_p, at (row 27, col 0).") [.../casadi/core/oracle_function.cpp:265]
CasADi - 2020-08-24 13:43:09 WARNING("Failed to calculate multipliers") [.../casadi/core/nlpsol.cpp:606]


However, if I don't use a parameter variable, and instead just set self.c = some constant value, then I no longer get the error. The behavior using the parameter versus not using the parameter seem the same, but seeing this error is still getting me nervous. 
thanks for any help on this,
Alex

A.S

unread,
Aug 24, 2020, 7:57:40 AM8/24/20
to CasADi
just to fix a mistake above, but instead of the constant 2, it's a variable (otherwise the code wouldn't make sense). 

Joris Gillis

unread,
Aug 28, 2020, 6:42:55 AM8/28/20
to CasADi
Dear Alex,

Could you produce some code to reproduce the issue on our end?

Best regards,
  Joris
Reply all
Reply to author
Forward
0 new messages