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

bundles / scipy latest / scipy / optimize / _constraints / Bounds

class

scipy.optimize._constraints:Bounds

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

Signature

class Bounds(lb = -inf, ub = inf, keep_feasible = False)

Members

Summary

Bounds constraint on the variables.

Extended Summary

The constraint has the general inequality form

lb <= x <= ub

It is possible to use equal bounds to represent an equality constraint or infinite bounds to represent a one-sided constraint.

Parameters

lb, ub : dense array_like, optional

Lower and upper bounds on independent variables. lb, ub, and keep_feasible must be the same shape or broadcastable. Set components of lb and ub equal to fix a variable. Use np.inf with an appropriate sign to disable bounds on all or some variables. Note that you can mix constraints of different types: interval, one-sided or equality, by setting different components of lb and ub as necessary. Defaults to lb = -np.inf and ub = np.inf (no bounds).

keep_feasible : dense array_like of bool, optional

Whether to keep the constraint components feasible throughout iterations. Must be broadcastable with lb and ub. Default is False. Has no effect for equality constraints.

Notes

Whilst Bounds can be used to specify box-bounds for many different optimizers, the class is not responsible for enforcing those constraints, that is done by the individual minimizer. Importantly, the keep_feasible keyword is only ever used within the trust-constr optimizer, the keep_feasible keyword is not used by other minimize methods. The other methods may, or may not, keep solutions strictly feasible during operation.

Aliases

  • scipy.optimize.Bounds

Referenced by