dimod.binary.BinaryQuadraticModel.contract_variables#

BinaryQuadraticModel.contract_variables(u: Hashable, v: Hashable)[source]#

Enforce u, v being the same variable in a binary quadratic model.

The resulting variable is labeled u. Values of interactions between v and variables that u interacts with are added to the corresponding interactions of u.

Parameters:
  • u – Variable in the binary quadratic model.

  • v – Variable in the binary quadratic model.