This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / optimize / _differentialevolution / _ConstraintWrapper

class

scipy.optimize._differentialevolution:_ConstraintWrapper

source: build-install/usr/lib/python3.14/site-packages/scipy/optimize/_differentialevolution.py:1918

Signature

class _ConstraintWrapper(constraint, x0)

Members

Summary

Object to wrap/evaluate user defined constraints.

Extended Summary

Very similar in practice to PreparedConstraint, except that no evaluation of jac/hess is performed (explicit or implicit).

If created successfully, it will contain the attributes listed below.

Parameters

constraint : {`NonlinearConstraint`, `LinearConstraint`, `Bounds`}

Constraint to check and prepare.

x0 : array_like

Initial vector of independent variables, shape (N,)

Attributes

fun : callable

Function defining the constraint wrapped by one of the convenience classes.

bounds : 2-tuple

Contains lower and upper bounds for the constraints --- lb and ub. These are converted to ndarray and have a size equal to the number of the constraints.

Notes

_ConstraintWrapper.fun and _ConstraintWrapper.violation can get sent arrays of shape (N, S) or (N,), where S is the number of vectors of shape (N,) to consider constraints for.

Aliases

  • scipy.optimize._differentialevolution._ConstraintWrapper