dimod.ConstrainedQuadraticModel.from_dqm

classmethod ConstrainedQuadraticModel.from_dqm(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.

Parameters
  • 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).

Returns

A constrained quadratic model.