BinaryQuadraticModel.add_linear_equality_constraint(terms: Iterable[Tuple[Hashable, Union[int, float, numpy.number]]], lagrange_multiplier: Union[int, float, numpy.number], constant: Union[int, float, numpy.number])[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.

  • terms (iterable/iterator) – An iterable of 2-tuples, (variable, bias), with each tuple constituting a term in \(\sum_{i} a_{i} x_{i}, with :math:\) being the length of the iterable.

  • lagrange_multiplier – A weight or the penalty strength. This value is multiplied by the entire constraint objective and added to the binary quadratic model (it does not appear explicitly in the equation above).

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