CUTEstProblem.slagjac

CUTEstProblem.slagjac(x, v=None)

Evaluate sparse gradient of objective or Lagrangian, and sparse Jacobian of constraints.

# objective gradient and Jacobian
g, J = problem.slagjac(x)
# Lagrangian gradient and Jacobian
g, J = problem.slagjac(x, v=v)

The vector g and matrix J are of type scipy.sparse.coo_matrix.

For unconstrained problems, J is None.

For small problems, problem.lagjac returns dense matrices.

This calls CUTEst routine CUTEST_csgr.

Note: in CUTEst, the sign convention is such that the Lagrangian = objective + lagrange_multipliers * constraints

Parameters:
  • x (numpy.ndarray with shape (n,)) – input vector

  • v (numpy.ndarray with shape (m,), optional) – vector of Lagrange multipliers

Returns:

sparse gradient of objective or Lagrangian, and sparse Jacobian of constraints

Return type:

(scipy.sparse.coo_matrix(n,), scipy.sparse.coo_matrix(m,n))