Name

ampl_eval_sp_g — evaluate the gradient of the objective function and the sparse Jacobian of the constraints of a given AMPL problem

Calling Sequence

[g, spjac] = ampl_eval_sp_g(asl, x)

Parameters

x

the point where we evaluate the gradient and the Jacobian

asl

a structure which handles the pointer to the problem

g

a vector which contains the value of the gradient (length: n_var)

spjac

a sparse matrix which contains the value of the transpose of the Jacobian (dimension: n_var x n_constr)

Description

Evaluate the gradient of the objective function and the sparse Jacobian of the constraintsof a given AMPL problem. Be careful, the "Jacobian matrix" corresponds to the transpose of the reel Jacobian. It has [nb_constr x nb_var] as dimensions.

Examples

 
[asl, x0, bl, bu, v, cl, cu] = ampl_init('demos/data/ASL/ch03.nl');

[g, jac]     = ampl_evalg(asl, x0);
[spg, spjac] = ampl_eval_sp_g(asl, x0);

printf('Difference between Jacobian and sparse Jacobian = %f\n', norm(jac - spjac'));

ampl_free(asl); // free the memory
 

See Also

ampl_init, ampl_free, ampl_evalf, ampl_evalw, ampl_get_size, ampl_get_compl, ampl_write_sol, ampl_evalg

Authors

Yann COLLETTE