CUTEstProblem.lagjac

CUTEstProblem.lagjac(x, v=None)

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

# objective gradient and the Jacobian of constraints
g, J = problem.lagjac(x)
# Lagrangian gradient and the Jacobian of constraints
g, J = problem.lagjac(x, v=v)

For unconstrained problems, J is None.

For large problems, problem.slagjac returns sparse matrices.

This calls CUTEst routine CUTEST_cgr.

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) – input vector of Lagrange multipliers

Returns:

gradient of objective or Lagrangian, and Jacobian of constraints

Return type:

(numpy.ndarray(n,), numpy.ndarray(m,n))