Send feedback
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
AddConstant
Return type: void
Arguments: IntegerValue value
Add value as a constant term to the linear equation.
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.
AddTerm
Return type: void
Arguments: AffineExpression expr, IntegerValue coeff
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.
Assumes that the 'model' has IntegerEncoder.
Send feedback
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-07-30 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
Need to tell us more?