Skip to content

Bounds

Represents bounds for a variable (only supported for real and integer variables).

A Bounds object defines the valid interval for a variable. Bounds are inclusive, and can be partially specified by providing only a lower or upper limit. If neither is specified, the variable is considered unbounded.

Parameters:

Name Type Description Default
lower float

Lower bound of the variable. Defaults to negative infinity if not specified.

required
upper float

Upper bound of the variable. Defaults to positive infinity if not specified.

required

Examples:

>>> from luna_quantum import Bounds
>>> Bounds(-1.0, 1.0)
Bounds { lower: -1, upper: 1 }
>>> Bounds(lower=0.0)
Bounds { lower: -1, upper: unlimited }
>>> Bounds(upper=10.0)
Bounds { lower: unlimited, upper: 1 }
Notes
  • Bounds are only meaningful for variables of type Vtype.Real or Vtype.Integer.
  • If both bounds are omitted, the variable is unbounded.

lower property

lower: float | Unbounded | None

Get the lower bound

upper property

upper: float | Unbounded | None

Get the upper bound