dimod.ConstrainedQuadraticModel.upper_bound

ConstrainedQuadraticModel.upper_bound(v: Hashable) Union[float, numpy.floating, numpy.integer][source]

Return the upper bound on the specified variable.

Parameters

v – Variable label for a variable in the model.

Examples

>>> i = dimod.Integer("i", upper_bound=3)
>>> j = dimod.Integer("j", upper_bound=3)
>>> cqm = dimod.ConstrainedQuadraticModel()
>>> cqm.add_constraint_from_comparison(i + j >= 1, label="Upper limit")
'Upper limit'
>>> cqm.set_upper_bound("i", 5)
>>> cqm.upper_bound("i")
5.0
>>> cqm.upper_bound("j")
3.0