C++ Reference: class LinearConstraintBuilder

This documentation is automatically generated.

Allow to build a LinearConstraint while making sure there is no duplicate variables. Note that we do not simplify literal/variable that are currently fixed here.

Return type: void

Arguments: IntegerValue value

Add value as a constant term to the linear equation.


Return type: ABSL_MUST_USE_RESULT bool

Arguments: Literal lit, IntegerValue coeff

Add literal * coeff to the constaint. Returns false and do nothing if the given literal didn't have an integer view.


Return type: void

Arguments: IntegerVariable var, IntegerValue coeff

Adds var * coeff to the constraint.


Return type: void

Arguments: AffineExpression expr, IntegerValue coeff


Return type: LinearConstraint

Builds and return the corresponding constraint in a canonical form. All the IntegerVariable will be positive and appear in increasing index order. TODO(user): this doesn't invalidate the builder object, but if one wants to do a lot of dynamic editing to the constraint, then then underlying algorithm needs to be optimized of that.


Arguments: const Model* model, IntegerValue lb, IntegerValue ub

We support "sticky" kMinIntegerValue for lb and kMaxIntegerValue for ub for one-sided constraints. Assumes that the 'model' has IntegerEncoder.