dimod.ConstrainedQuadraticModel.set_objective

ConstrainedQuadraticModel.set_objective(objective: Union[dimod.binary.binary_quadratic_model.BinaryQuadraticModel, dimod.quadratic.quadratic_model.QuadraticModel, Iterable])[source]

Set the objective of the constrained quadratic model.

Parameters
  • objective – Binary quadratic model (BQM) or quadratic model (QM) or

  • tuples. (an iterable of) –

Examples

>>> from dimod import Integer, ConstrainedQuadraticModel
>>> i = Integer('i')
>>> j = Integer('j')
>>> cqm = ConstrainedQuadraticModel()
>>> cqm.set_objective(2*i - 0.5*i*j + 10)