def _bqm_from_1sat(constraint):
configurations = constraint.configurations<EOL>num_configurations = len(configurations)<EOL>bqm = dimod.BinaryQuadraticModel.empty(constraint.vartype)<EOL>if num_configurations == <NUM_LIT:1>:<EOL><INDENT>val, = next(iter(configurations))<EOL>v, = constraint.variables<EOL>bqm.add_variable(v, -<NUM_LIT:1> if val > <NUM_LIT:0> else +<NUM_LIT:1>, vartype=dimod.SPIN)<EOL><DEDENT>else:<EOL><INDENT>bqm.add_variables_from((v, <NUM_LIT:0.0>) for v in constraint.variables)<EOL><DEDENT>return bqm<EOL>
create a bqm for a constraint with only one variable

    bqm will have exactly classical gap 2.