dimod.BinaryQuadraticModel.add_offset¶
-
BinaryQuadraticModel.add_offset(offset)[source]¶ Add specified value to the offset of a binary quadratic model.
Parameters: offset (number) – Value to be added to the constant energy offset of the binary quadratic model. Examples
This example creates an Ising model with an offset of -0.5 and then adds to it.
>>> import dimod ... >>> bqm = dimod.BinaryQuadraticModel({0: 0.0, 1: 0.0}, {(0, 1): 0.5}, -0.5, dimod.SPIN) >>> bqm.add_offset(1.0) >>> bqm.offset 0.5