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.
Method
AddLiteralTerm

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.

AddTerm

Return type: void

Arguments: IntegerVariable var, IntegerValue coeff

Adds var * coeff to the constraint.

Build

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.

LinearConstraintBuilder

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

We support "sticky" kMinIntegerValue for lb and kMaxIntegerValue for ub for one-sided constraints.