dimod.generators.xor_gate

xor_gate(in0: Hashable, in1: Hashable, out: Hashable, aux: Hashable, *, strength: float = 1.0) dimod.binary.binary_quadratic_model.BinaryQuadraticModel[source]

Return a binary quadratic model with ground states corresponding to an XOR gate.

Note that it is not possible to construct a binary quadratic model with only three variables for an XOR gate.

Parameters
  • in0 – The variable label for one of the inputs.

  • in1 – The variable label for one of the inputs.

  • out – The variable label for the output.

  • aux – The variable label for an auxiliary variable.

  • strength – The energy of the lowest-energy infeasible state.

Returns

A binary quadratic model with ground states corresponding to an XOR gate. The model has four variables and six interactions.