This example looks at a use of an exact hessian for the NLP solvers
View output (PDF) | source (python)
- See also
35 obj = (1-x)**2+100*(y-x**2)**2
37 nlp={
'x':vertcat(x,y),
'f':obj,
'g':constr}
41 solver =
nlpsol(
'solver',
'ipopt', nlp)
42 sol = solver(lbx=-10, ubx=10, lbg=0, ubg=1)
43 print(
'Optimal solution (exact Hessian): %s' % sol[
'x'])
47 solver =
nlpsol(
'solver',
'ipopt', nlp, {
'ipopt.hessian_approximation':
'limited-memory'})
48 sol = solver(lbx=-10, ubx=10, lbg=0, ubg=1)
49 print(
'Optimal solution (BFGS): %s' % sol[
'x'])
CASADI_EXPORT Function nlpsol(const std::string &name, const std::string &solver, const SXDict &nlp, const Dict &opts=Dict())