bundles / scipy latest / scipy / optimize / _trustregion_constr / canonical_constraint / CanonicalConstraint
class
scipy.optimize._trustregion_constr.canonical_constraint:CanonicalConstraint
Signature
class CanonicalConstraint(n_eq, n_ineq, fun, jac, hess, keep_feasible)Members
Summary
Canonical constraint to use with trust-constr algorithm.
Extended Summary
It represents the set of constraints of the form
f_eq(x) = 0 f_ineq(x) <= 0
where f_eq and f_ineq are evaluated by a single function, see below.
The class is supposed to be instantiated by factory methods, which should prepare the parameters listed below.
Parameters
n_eq, n_ineq: intNumber of equality and inequality constraints respectively.
fun: callableFunction defining the constraints. The signature is
fun(x) -> c_eq, c_ineq, wherec_eqis ndarray withn_eqcomponents andc_ineqis ndarray withn_ineqcomponents.jac: callableFunction to evaluate the Jacobian of the constraint. The signature is
jac(x) -> J_eq, J_ineq, whereJ_eqandJ_ineqare either ndarray of csr_array of shapes (n_eq, n) and (n_ineq, n), respectively.hess: callableFunction to evaluate the Hessian of the constraints multiplied by Lagrange multipliers, that is
dot(f_eq, v_eq) + dot(f_ineq, v_ineq). The signature ishess(x, v_eq, v_ineq) -> H, whereHhas an implied shape (n, n) and provide a matrix-vector product operationH.dot(p).keep_feasible: ndarray, shape (n_ineq,)Mask indicating which inequality constraints should be kept feasible.
Aliases
scipy.optimize._trustregion_constr.canonical_constraint.CanonicalConstraint