dwavebinarycsp.Constraint.projection#

Constraint.projection(variables)[source]#

Create a new constraint that is the projection onto a subset of the variables.

Parameters:

variables (iterable) – Subset of the constraint’s variables.

Returns:

A new constraint over a subset of the variables.

Return type:

Constraint

Examples

>>> const = dwavebinarycsp.Constraint.from_configurations([(0, 0), (0, 1)],
...                                                       ['a', 'b'],
...                                                       dwavebinarycsp.BINARY)
>>> proj = const.projection(['a'])
>>> proj.variables
('a',)
>>> proj.configurations
frozenset({(0,)})