dimod.AdjDictBQM.flip_variable

AdjDictBQM.flip_variable(v)[source]

Flip variable v in a binary quadratic model.

Parameters

v (variable) – Variable in the binary quadratic model.

Examples

>>> bqm = dimod.BQM.from_ising({'a': 1, 'b': -1}, {('ab'): 0.5})
>>> bqm.flip_variable('a')
>>> print(bqm)
BinaryQuadraticModel({a: -1.0, b: -1.0}, {('a', 'b'): -0.5}, 0, 'SPIN')