dimod.AdjMapBQM.add_linear_equality_constraint

AdjMapBQM.add_linear_equality_constraint(self, terms, Bias lagrange_multiplier, Bias constant)[source]

Add a linear constraint as a quadratic objective.

Adds a linear constraint of the form \(\sum_{i} a_{i} x_{i} + C = 0\) to the binary quadratic model as a quadratic objective.

Parameters
  • terms (iterable/iterator) – An iterable of 2-tuples, (variable, bias). Each tuple is evaluated to the term (bias * variable). All terms in the list are summed.

  • lagrange_multiplier – The coefficient or the penalty strength. This value is multiplied by the entire constraint objective and added to the bqm (it doesn’t appear explicity in the equation above).

  • constant – The constant value of the constraint, C, in the equation above.