dimod.QuadraticModel.scale#

QuadraticModel.scale(scalar: float | floating | integer)[source]#

Scale the biases by the given number.

Parameters:

scalar – Value by which to scale the biases of the quadratic model.

Examples

>>> from dimod import QuadraticModel
>>> qm = QuadraticModel()
>>> qm.add_variables_from('INTEGER', ['i', 'j'])
>>> qm.set_linear('i', 2)
>>> qm.set_quadratic('i', 'j', -1)
>>> qm.scale(1.5)
>>> print(qm.get_linear('i'), qm.get_quadratic('i', 'j'))
3.0 -1.5