{ } Raw JSON

bundles / scipy 1.17.1 / scipy / optimize / _trustregion_constr / canonical_constraint / CanonicalConstraint

class

scipy.optimize._trustregion_constr.canonical_constraint:CanonicalConstraint

source: /scipy/optimize/_trustregion_constr/canonical_constraint.py :5

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 : int

Number of equality and inequality constraints respectively.

fun : callable

Function defining the constraints. The signature is fun(x) -> c_eq, c_ineq, where c_eq is ndarray with n_eq components and c_ineq is ndarray with n_ineq components.

jac : callable

Function to evaluate the Jacobian of the constraint. The signature is jac(x) -> J_eq, J_ineq, where J_eq and J_ineq are either ndarray of csr_array of shapes (n_eq, n) and (n_ineq, n), respectively.

hess : callable

Function 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 is hess(x, v_eq, v_ineq) -> H, where H has an implied shape (n, n) and provide a matrix-vector product operation H.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