dimod.generators.fulladder_gate#
- fulladder_gate(in0: Hashable, in1: Hashable, in2: Hashable, sum_: Hashable, carry: Hashable, *, strength: float = 1.0) BinaryQuadraticModel [source]#
Generate a binary quadratic model with ground states corresponding to a full adder gate.
- Parameters:
in0 – Variable label for one of the inputs.
in1 – Variable label for one of the inputs.
in2 – Variable label for one of the inputs
sum – Variable label for the sum output.
carry – Variable label for the carry output.
strength – Energy of the lowest-energy infeasible state.
- Returns:
A binary quadratic model with ground states corresponding to a full adder gate. The model has five variables and ten interactions.
Examples
>>> bqm = dimod.generators.fulladder_gate('a1', 'a2', 'a3', 's', 'c') >>> print(dimod.ExactSolver().sample(bqm).lowest()) a1 a2 a3 c s energy num_oc. 0 0 0 0 0 0 0.0 1 1 0 0 1 0 1 0.0 1 2 0 1 0 0 1 0.0 1 3 1 0 0 0 1 0.0 1 4 1 1 1 1 1 0.0 1 5 1 0 1 1 0 0.0 1 6 0 1 1 1 0 0.0 1 7 1 1 0 1 0 0.0 1 ['BINARY', 8 rows, 8 samples, 5 variables]