CUTEstProblem.lag

CUTEstProblem.lag(x, v, gradient=False)

Evaluate Lagrangian function value and its gradient if requested.

# Lagrangian function value
l      = problem.lag(x, v)
# Lagrangian function value and Lagrangian gradient
l, g   = problem.lag(x, v, gradient=True)

For unconstrained problems, this returns None.

This calls CUTEst routine CUTEST_clfg.

For large problems, problem.slagjac returns a sparse Lagrangian gradient.

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

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

  • gradient (bool, optional) – whether to also return Lagrangian gradient (default=False)

Returns:

value of Lagrangian function, and optionally gradient of Lagrangian at x

Return type:

float or (float, numpy.ndarray(n,))