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:
obj(x[, gradient]): evaluate objective (and optionally its gradient)
grad(x[, index]): evaluate objective gradient or specific constraint gradient
objcons(x): evaluate objective and constraints
cons(x[, index, gradient]): evaluate constraint(s) and optionally their Jacobian/its gradient
lag(x, v[, gradient]): evaluate Lagrangian function value and optionally its gradient
lagjac(x[, v]): evaluate gradient of objective/Lagrangian and Jacobian of constraints
jprod(p[, transpose, x]): evaluate constraint Jacobian-vector product
hess(x[, v]): evaluate Hessian of objective or Lagrangian
ihess(x[, cons_index]): evaluate Hessian of objective or a specific constraint
hprod(p[, x, v]): evaluate Hessian-vector product (for objective or Lagrangian)
gradhess(x[, v, gradient_of_lagrangian]): evaluate gradient of objective/Lagrangian, Jacobian of constraints and Hessian of objective/Lagrangian
report(): return a dictionary of statistics (number of objective/gradient evaluations, etc.)
For large-scale problems, you may want to get vectors/matrices as sparse matrices. We have the following methods which return sparse matrices:
sobj(x[, gradient]): (sparse) evaluate objective (and optionally its gradient)
sgrad(x[, index]): (sparse) evaluate objective gradient or specific constraint gradient
scons(x[, index, gradient]): (sparse) evaluate constraint(s) and optionally their Jacobian/its gradient
slagjac(x[, v]): (sparse) evaluate gradient of objective/Lagrangian and Jacobian of constraints
sphess(x[, v]): (sparse) evaluate Hessian of objective or Lagrangian
isphess(x[, cons_index]): (sparse) evaluate Hessian of objective or a specific constraint
gradsphess(x[, v, gradient_of_lagrangian]): (sparse) evaluate gradient of objective/Lagrangian, Jacobian of constraints and Hessian of objective/Lagrangian
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 ton_free
ifdrop_fixed_variables=True
, otherwisen_full
)m
: number of constraintsx0
: starting point for optimization routine (NumPy array of shape(n,)
)sifParams
: dict of parameters passed to sifdecodesifOptions
: list of extra options passed to sifdecodevartype
: array of variable types (NumPy array size n, entryvartype[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 variablesbl
: 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 variablesn_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 constraintslinear_cons_first
: flag if linear constraints are listed before nonlinear constraintsnnzj
: 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:
|
Evaluate the objective (and optionally its gradient). |
|
Evaluate the gradient of the objective function or gradient of the i-th constraint. |
|
Evaluate objective and constraints. |
|
Evaluate the constraints (and optionally their Jacobian or gradient). |
|
Evaluate Lagrangian function value and its gradient if requested. |
|
Evaluate gradient of objective or Lagrangian, and Jacobian of constraints. |
|
Evaluate product of constraint Jacobian with a vector p |
|
Evaluate the Hessian of the objective or Lagrangian. |
|
Evaluate the Hessian of the objective or the i-th constraint. |
|
Calculate Hessian-vector product H*p, where H is Hessian of objective (unconstrained) or Lagrangian (constrained). |
|
Evaluate the gradient of objective or Lagrangian, Jacobian of constraints, and Hessian of objective or Lagrangian. |
|
Get CUTEst usage statistics. |
|
Evaluate the objective (and optionally its sparse gradient). |
|
Evaluate the sparse gradient of the objective function or sparse gradient of the i-th constraint. |
|
Evaluate the constraints (and optionally their sparse Jacobian or gradient). |
|
Evaluate sparse gradient of objective or Lagrangian, and sparse Jacobian of constraints. |
|
Evaluate sparse Hessian of objective or Lagrangian. |
|
Evaluate the sparse Hessian of the objective or the i-th constraint. |
|
Evaluate the sparse gradient of objective or Lagrangian, sparse Jacobian of constraints, and sparse Hessian of objective or Lagrangian. |