dimod.QuadraticModel.quadratic#
- property QuadraticModel.quadratic: Quadratic[source]#
Quadratic biases as a flat mapping.
Accessed like a dict, where keys are 2-tuples of variables, which represent an interaction and values are the quadratic 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_quadratic('i', 'j', 2) >>> qm.add_quadratic('x', 'i', -1) >>> qm.quadratic {('i', 'x'): -1.0, ('j', 'i'): 2.0}