Problem Interface

Having built a problem, PyCUTEst returns an instance of class CUTEstProblem (for fixed variables, its behaviour can be set with the drop_fixed_variables flag for import_problem()).

Problem Methods

The methods available for each CUTEstProblem instance are:

For large-scale problems, you may want to get vectors/matrices as sparse matrices. We have the following methods which return sparse matrices:

Full documentation for each method above is given by clicking on it.

Problem Attributes

Each CUTEstProblem instance has the following attributes:

  • name: CUTEst problem name (string)

  • n: number of variables (equal to n_free if drop_fixed_variables=True, otherwise n_full)

  • m: number of constraints

  • x0: starting point for optimization routine (NumPy array of shape (n,))

  • sifParams: dict of parameters passed to sifdecode

  • sifOptions: list of extra options passed to sifdecode

  • vartype: array of variable types (NumPy array size n, entry vartype[i] indicates that x[i] is real(0), boolean(1), or integer(2))

  • nnzh: number of nonzero entries in upper triangular part of objective Hessian (for all variables, including fixed)

  • nonlinear_vars_first: flag if all nonlinear variables are listed before linear variables

  • bl: array of lower bounds on input (unconstrained -> -1e20), as NumPy array of shape (n,)

  • bu: array of upper bounds on input (unconstrained -> 1e20), as NumPy array of shape (n,)

  • n_full: total number of variables in CUTEst problem (n_free + n_fixed)

  • n_free: number of free variables

  • n_fixed: number of fixed variables

For constrained problems, we also have (these are all set to None for unconstrained problems):

  • eq_cons_first: flag if equality constraints are listed before inequality constraints

  • linear_cons_first: flag if linear constraints are listed before nonlinear constraints

  • nnzj: number of nonzero entries in constraint Jacobian (for all variables, including fixed)

  • v0: starting point for Lagrange multipliers (NumPy array of shape (m,))

  • cl: lower bounds on constraints, as NumPy array of shape (m,)

  • cu: upper bounds on constraints, as NumPy array of shape (m,)

  • is_eq_cons: NumPy array of Boolean flags indicating if i-th constraint is equality or not (i.e. inequality)

  • is_linear_cons: NumPy array of Boolean flags indicating if i-th constraint is linear or not (i.e. nonlinear)

Full method documentation

Please click on a CUTEstProblem method below for full documentation:

obj(x[, gradient])

Evaluate the objective (and optionally its gradient).

grad(x[, index])

Evaluate the gradient of the objective function or gradient of the i-th constraint.

objcons(x)

Evaluate objective and constraints.

cons(x[, index, gradient])

Evaluate the constraints (and optionally their Jacobian or gradient).

lag(x, v[, gradient])

Evaluate Lagrangian function value and its gradient if requested.

lagjac(x[, v])

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

jprod(p[, transpose, x])

Evaluate product of constraint Jacobian with a vector p

hess(x[, v])

Evaluate the Hessian of the objective or Lagrangian.

ihess(x[, cons_index])

Evaluate the Hessian of the objective or the i-th constraint.

hprod(p[, x, v])

Calculate Hessian-vector product H*p, where H is Hessian of objective (unconstrained) or Lagrangian (constrained).

gradhess(x[, v, gradient_of_lagrangian])

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

report()

Get CUTEst usage statistics.

scons(x[, index, gradient])

Evaluate the constraints (and optionally their sparse Jacobian or gradient).

slagjac(x[, v])

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

sphess(x[, v])

Evaluate sparse Hessian of objective or Lagrangian.

isphess(x[, cons_index])

Evaluate the sparse Hessian of the objective or the i-th constraint.

gradsphess(x[, v, gradient_of_lagrangian])

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