dimod.QuadraticModel.linear#
- property QuadraticModel.linear: Linear[source]#
Linear biases as a mapping.
Accessed like a dict, where keys are the variables of the model and values are the linear biases.
Examples
>>> from dimod import QuadraticModel, Binary, Integer >>> qm = QuadraticModel() >>> qm.add_variables_from('BINARY', ['x', 'y']) >>> qm.add_variables_from('INTEGER', ['i', 'j']) >>> qm.add_linear('x', 0.5) >>> qm.add_linear('i', -2) >>> qm.linear {'x': 0.5, 'y': 0.0, 'i': -2.0, 'j': 0.0}