CUTEstProblem.obj

CUTEstProblem.obj(x, gradient=False)

Evaluate the objective (and optionally its gradient).

# objective
f    = problem.obj(x)
# objective and gradient
f, g = problem.obj(x, gradient=True)

This calls CUTEst routine CUTEST_uofg or CUTEST_cofg.

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

  • gradient (bool, optional) – whether to return objective and gradient, or just objective (default=False; i.e. objective only)

Returns:

objective value f, or tuple (f,g) of objective and gradient at x

Return type:

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