dimod.ConstrainedQuadraticModel.from_discrete_quadratic_model#

classmethod ConstrainedQuadraticModel.from_discrete_quadratic_model(dqm, relabel_func=<cyfunction cyConstrainedQuadraticModel.<lambda>>)[source]#

Construct a constrained quadratic model from a discrete quadratic model.

Parameters:
  • dqm – 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.