compute the Hessian of the Lagrangian times vector p
of a given AMPL problem
hv = ampl_eval_hvcomp(asl, p[, OW[, Y]])
a structure which handles the pointer to the problem
a vector of size n_var
an optional parameter which contains weights for the objective function. Must be of the same size as the number of objective functions
an optional parameter which contains weights for the constraints. Must be of the same size as the number of constraints functions
the Hessian of the Lagrangian times vector p
.
stores in hv
(a full vector of length
n_var) the Hessian of the Lagrangian times
vector p
. In other words, ampl_eval_hvcomp
computes
where W is the Lagrangian Hessian.
where f and c correspond to the objective functions and constraints functions
W is evaluated at the point where the objective(s) and constraints were most recently computed
Normally one computes gradients before dealing with W, and if necessary, the gradient computing routines first recompute the objective(s) and constraints at the point specified in their argument lists. The Hessian computations use partial derivatives stored during the objective and constraint evaluations.
[asl, x0, bl, bu, v, cl, cu] = ampl_init('demos/data/ASL/ch03.nl'); W = ampl_evalw(asl, v); HV = ampl_eval_hvcomp(asl, ones(x0)); ampl_free(asl); // free the memory