Interface VectorFunctionLike
- All Known Implementing Classes:
IdentityVectorFunction,LinearVectorFunction,NonlinearVectorFunction,VectorFunction
public interface VectorFunctionLike
Common surface implemented by every vector-valued function carrier the
trust-constr code passes around: the full
VectorFunction (objective wrapper with
caching and finite-difference fallbacks),
LinearVectorFunction (constant
Jacobian A), and
IdentityVectorFunction (Jacobian
I).
Mirrors the duck-typed contract scipy relies on -- in
_constraints.py:PreparedConstraint the fun attribute can be
any of the three Python classes, and downstream code only calls
fun(x) / jac(x) / hess(x, v) or reads the cached
f / J / m / n.
-
Method Summary
Modifier and TypeMethodDescriptionf()Evaluate the function atx, updating any internal cache.Evaluate the constraint Hessian-of-LagrangianSum_i v[i] * H_{f_i}(x)atxfor the given multiplier vectorv.J()Evaluate the Jacobian atx, updating any internal cache.longm()longn()default intdefault intdefault intv()
-
Method Details
-
fun
Evaluate the function atx, updating any internal cache.- Parameters:
x- current iterate (n x 1)- Returns:
- function value (
m x 1)
-
jac
Evaluate the Jacobian atx, updating any internal cache.- Parameters:
x- current iterate (n x 1)- Returns:
- Jacobian (
m x n)
-
hess
Evaluate the constraint Hessian-of-LagrangianSum_i v[i] * H_{f_i}(x)atxfor the given multiplier vectorv.- Parameters:
x- current iterate (n x 1)v- multipliers (m x 1)- Returns:
- summed Hessian (
n x n)
-
f
Matrix f()- Returns:
- most recently computed
f(x)(m x 1), ornullif uncached
-
J
Matrix J()- Returns:
- most recently computed Jacobian (
m x n), ornullif uncached
-
m
long m()- Returns:
- number of output components (
minf : R^n -> R^m)
-
n
long n()- Returns:
- number of input components (
ninf : R^n -> R^m)
-
numFunctionEvals
default int numFunctionEvals()- Returns:
- total number of function evaluations performed so far
-
numJacobianEvals
default int numJacobianEvals()- Returns:
- total number of Jacobian evaluations performed so far
-
numHessianEvals
default int numHessianEvals()- Returns:
- total number of Hessian evaluations performed so far
-
v
Matrix v()- Returns:
- most recently set Lagrange multipliers (from
hess(Matrix, Matrix)); shapem x 1, ornullif none ever set
-