BinaryQuadraticModel.add_linear_inequality_constraint(terms: , lagrange_multiplier: , label: str, constant: int = 0, lb: int = - 9223372036854775808, ub: int = 0, cross_zero: bool = False) [source]

The linear inequality constraint is of the form: $$lb <= \sum_{i,k} a_{i,k} x_{i,k} + constant <= ub$$.

For constraints with fractional coefficients, multiply both sides of the inequality by an appropriate factor of ten to attain or approximate integer coefficients.

Parameters
• terms – Values of the $$\sum_{i} a_{i} x_{i}$$ term as an $$i$$–length iterable of 2-tuples, (variable, bias), with each tuple constituting a term in the summation.

• lagrange_multiplier – Weight or penalty strength. The linear constraint is multiplied by this value (which does not appear explicitly in the above equation) when added to the binary quadratic model.

• label – Prefix for labels of any slack variables used in the added objective.

• constant – Value of the constant term of the linear constraint.

• lb – Lower bound for the constraint.

• ub – Upper bound for the constraint.

• cross_zero – When True, adds zero to the domain of constraint.

Returns

Values of $$\sum_{i} b_{i} slack_{i}$$ as an $$i$$–length iterable of 2-tuples, (slack variable, bias), with each tuple constituting a term in the summation.

Return type

slack_terms