dwave.optimization.model.Model.quadratic_model#

Model.quadratic_model(x, quadratic, linear=None)#

Create a quadratic model from an array and a quadratic model.

Parameters:
  • x – An array.

  • quadratic – Quadratic values for the quadratic model.

  • linear – Linear values for the quadratic model.

Returns:

A quadratic model.

Examples

This example creates a quadratic model.

>>> from dwave.optimization.model import Model
>>> model = Model()
>>> x = model.binary(3)
>>> Q = {(0, 0): 0, (0, 1): 1, (0, 2): 2, (1, 1): 1, (1, 2): 3, (2, 2): 2}
>>> qm = model.quadratic_model(x, Q)