dimod.ConstrainedQuadraticModel.set_upper_bound#

ConstrainedQuadraticModel.set_upper_bound(v, ub)[source]#

Set the upper bound for a variable.

Parameters:
  • v – Variable label of a variable in the constrained quadratic model.

  • ub – Upper bound to set for variable v.

Raises:

ValueError – If v is a SPIN or BINARY variable.

Examples

>>> cqm = dimod.ConstrainedQuadraticModel()
>>> cqm.add_variable('INTEGER', 'j', lower_bound=2)
'j'
>>> cqm.set_upper_bound('j', 5)