bound_map.py#
Name-keyed mapping of optimizer bounds, storing None for entirely-unbounded variables.
- class openmdao.vectors.bound_map.BoundMap[source]
Bases:
objectName-keyed mapping of optimizer bounds.
Each entry holds lower, upper, and equals bounds for one variable. Entirely-unbounded directions are stored as None rather than an array of ±inf, avoiding unnecessary memory allocation for large unbounded variables.
- Attributes:
- _datadict[str, _VarBounds]
Per-variable bounds objects.
Methods
items()Iterate over (name, _VarBounds) pairs.
keys()Return variable names.
set(name, lower, upper, equals)Store bounds for a single variable.
- __contains__(name)[source]
Return True if name is in the dict.
- __getitem__(name)[source]
Return the _VarBounds for a variable.
- Parameters:
- namestr
Variable name.
- Returns:
- _VarBounds
Bounds object with .lower, .upper, .equals attributes.
- Raises:
- KeyError
If variable name not found.
- __init__()[source]
Initialize BoundMap.
- __iter__()[source]
Iterate over variable names.
- items()[source]
Iterate over (name, _VarBounds) pairs.
- keys()[source]
Return variable names.
- set(name, lower, upper, equals)[source]
Store bounds for a single variable.
- Parameters:
- namestr
Variable name.
- lowerndarray or None
Lower bound in scaled units, or None if entirely unbounded below.
- upperndarray or None
Upper bound in scaled units, or None if entirely unbounded above.
- equalsndarray or None
Equality value in scaled units, or None if not an equality constraint.