evaluate the sparse Hessian of the objective function and of the constraints of a given AMPL problem
W = ampl_eval_sp_w(asl, v)
the dual variables
a structure which handles the pointer to the problem
a matrix handling the Hessian (dimension: n_var x n_var)
Evaluate the sparse Hessian of the objective function and of the constraintsof a given AMPL problem. The Hessian is evaluated at the last point given to ampl_evalf.
[asl, x0, bl, bu, v, cl, cu] = ampl_init('demos/data/ASL/ch03.nl'); W = ampl_evalw(asl, v); spW = ampl_eval_sp_w(asl, v); printf('Difference between Hessian and sparse Hessian = %f\n', norm(W, spW)); ampl_free(asl); // free the memory | ![]() | ![]() |