dimod.ConstrainedQuadraticModel.add_constraint

ConstrainedQuadraticModel.add_constraint(data, *args, **kwargs) Hashable[source]

A convenience wrapper for other methods that add constraints.

Examples

>>> from dimod import ConstrainedQuadraticModel, Integers
>>> i, j = Integers(['i', 'j'])
>>> cqm = ConstrainedQuadraticModel()
>>> cqm.add_constraint(i + j <= 3, label='Constrained i-j range')
'Constrained i-j range'