dwavebinarycsp.Constraint.copy

Constraint.copy()[source]

Create a copy.

Examples

This example copies constraint \(a \ne b\) and tests a solution on the copied constraint.

>>> import dwavebinarycsp
>>> import operator
>>> const = dwavebinarycsp.Constraint.from_func(operator.ne,
...             ['a', 'b'], 'BINARY')
>>> const2 = const.copy()
>>> const2 is const
False
>>> const2.check({'a': 1, 'b': 1})
False