classmethod ConstrainedQuadraticModel.from_discrete_quadratic_model(dqm: dimod.discrete.discrete_quadratic_model.DiscreteQuadraticModel, *, relabel_func: Callable[[Hashable, int], Hashable] = <function ConstrainedQuadraticModel.<lambda>>) dimod.constrained.ConstrainedQuadraticModel[source]

Construct a constrained quadratic model from a discrete quadratic model.

  • dqm – a discrete quadratic model.

  • relabel_func (optional) – A function that takes two arguments, the variable label and the case label, and returns a new variable label to be used in the CQM. By default generates a 2-tuple (variable, case).


A constrained quadratic model.