Package de.labathome.trustconstr
Class VectorFunction.VectorFunctionFactory
java.lang.Object
de.labathome.trustconstr.VectorFunction.VectorFunctionFactory
- Enclosing class:
- VectorFunction
Builder for
VectorFunction.-
Constructor Summary
ConstructorsConstructorDescriptionPublic so callers can construct a fresh factory per build instead of mutating the sharedVectorFunction.FACTORYsingleton. -
Method Summary
Modifier and TypeMethodDescriptionbuild()finiteDiffBounds(FiniteDifferenceBounds finiteDiffBounds) Bounds within which FD perturbations must stay.finiteDiffJacSparsity(Matrix finiteDiffJacSparsity) Specify a Jacobian sparsity pattern: a matrix with non-zero elements exactly where non-zero Jacobian entries are expected.finiteDiffRelStep(Matrix finiteDiffRelStep) Per-component relative step size for the FD Jacobian/Hessian.Set the vector-valued function to evaluate.hess(FiniteDifferenceMethod hess) Compute the Hessian by finite differences instead of analytically.hess(HessianUpdateStrategy hess) Approximate the Hessian via a quasi-Newton update strategy (e.g.hess(BiFunction<Matrix, Matrix, Matrix> hess) Provide an analytic constraint Hessian-of-Lagrangian(x, v) -> Sum v[i] H_{c_i}(x).Compute the Jacobian by finite differences instead of analytically.Provide an analytic Jacobian.Force the Jacobian return type to a sparse representation.Provide the initial point.
-
Constructor Details
-
VectorFunctionFactory
public VectorFunctionFactory()Public so callers can construct a fresh factory per build instead of mutating the sharedVectorFunction.FACTORYsingleton. Same fix pattern asScalarFunction.ScalarFunctionFactoryand the BFGS/SR1 factories.
-
-
Method Details
-
fun
Set the vector-valued function to evaluate.- Parameters:
fun- functionR^n -> R^m- Returns:
- this factory, for chaining
-
x0
Provide the initial point.- Parameters:
x0- starting iterate (n x 1)- Returns:
- this factory, for chaining
-
jac
Provide an analytic Jacobian.- Parameters:
jac- analytic JacobianR^n -> R^{m x n}- Returns:
- this factory, for chaining
- Throws:
RuntimeException- if a Jacobian was already specified
-
jac
Compute the Jacobian by finite differences instead of analytically.- Parameters:
jac- FD scheme to use- Returns:
- this factory, for chaining
- Throws:
RuntimeException- if a Jacobian was already specified
-
finiteDiffJacSparsity
Specify a Jacobian sparsity pattern: a matrix with non-zero elements exactly where non-zero Jacobian entries are expected. Enables Curtis-Powell-Reid column grouping for the FD path.- Parameters:
finiteDiffJacSparsity- sparsity pattern (m x n)- Returns:
- this factory, for chaining
-
sparseJacobian
Force the Jacobian return type to a sparse representation.- Returns:
- this factory, for chaining
-
hess
Provide an analytic constraint Hessian-of-Lagrangian(x, v) -> Sum v[i] H_{c_i}(x).- Parameters:
hess- analytic Hessian-of-Lagrangian- Returns:
- this factory, for chaining
- Throws:
RuntimeException- if a Hessian was already specified
-
hess
Compute the Hessian by finite differences instead of analytically. Cannot be combined with an FD Jacobian.- Parameters:
hess- FD scheme to use for the Hessian- Returns:
- this factory, for chaining
- Throws:
RuntimeException- if a Hessian was already specified
-
hess
- Parameters:
hess- Hessian-update strategy instance- Returns:
- this factory, for chaining
- Throws:
RuntimeException- if a Hessian was already specified
-
finiteDiffRelStep
Per-component relative step size for the FD Jacobian/Hessian. May benullto derive a default from machine epsilon.- Parameters:
finiteDiffRelStep- relative step size (n x 1); may benull- Returns:
- this factory, for chaining
-
finiteDiffBounds
public VectorFunction.VectorFunctionFactory finiteDiffBounds(FiniteDifferenceBounds finiteDiffBounds) Bounds within which FD perturbations must stay. Defaults to unbounded.- Parameters:
finiteDiffBounds- box bounds for FD perturbations- Returns:
- this factory, for chaining
-
build
- Returns:
- a fully-configured
VectorFunction - Throws:
RuntimeException- if neither analytic nor FD Jacobian/Hessian was set
-