# dwavebinarycsp.ConstraintSatisfactionProblem.fix_variable¶

ConstraintSatisfactionProblem.fix_variable(v, value)[source]

Fix the value of a variable and remove it from the constraint satisfaction problem.

Parameters: v (variable) – Variable to be fixed in the constraint satisfaction problem. value (int) – Value assigned to the variable. Values must match the vartype of the constraint satisfaction problem.

Examples

This example creates a spin-valued constraint satisfaction problem, adds two constraints, $$a = b$$ and $$b \ne c$$, and fixes variable b to +1.

>>> import dwavebinarycsp
>>> import operator
>>> csp = dwavebinarycsp.ConstraintSatisfactionProblem(dwavebinarycsp.SPIN)