Gauss-Newton Hessian with Knitro #3110
Replies: 2 comments 4 replies
-
In the 3.6.0 release, there is a new option in the For Knitro, you need to set the "nlp_hess_l" entry of the Syntax should be something like this: # Hessian expression
x = ...
p = ...
lam_f = ...
lam_g = ...
H = ...
# Function that calculates the Hessian of the Lagrangian (upper triangular part only)
nlp_hess_l = Function('nlp_hess_l', [x, p, lam_f, lam_g], [triu(H)], ['x', 'p', 'lam_f', 'lam_g'], ['H'])
# Pass to solver
mysolver = casadi.nlpsol('mysolver', 'knitro', NLP, dict(cache = dict(nlp_hess_l = nlp_hess_l))) Good luck. |
Beta Was this translation helpful? Give feedback.
-
Ugh, I think there is a bug in the code (it's really an internal feature at this point). I think you can work around the bug by adding a ":" at the end of the struct name: options.cache = struct('nlp_hess_l:', nlp_hess_l); |
Beta Was this translation helpful? Give feedback.
-
Hi!
Yet another question related to Knitro: Is there any way to provide Knitro with a user-defined Hessian, e.g. Gauss-Newton? The way via 'hess_lag' is not working for Knitro, only for Ipopt.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions