Class Constraint
java.lang.Object
com.google.ortools.sat.Constraint
- Direct Known Subclasses:
AutomatonConstraint,CircuitConstraint,CumulativeConstraint,MultipleCircuitConstraint,NoOverlap2dConstraint,ReservoirConstraint,TableConstraint
Wrapper around a ConstraintProto.
Constraints created by the CpModel class are automatically added to the model. One needs this class to add an enforcement literal to a constraint.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the constraint builder.intgetIndex()Returns the index of the constraint in the model.voidonlyEnforceIf(Literal lit) Adds a literal to the constraint.voidonlyEnforceIf(Literal[] lits) Adds a list of literals to the constraint.
-
Constructor Details
-
Constraint
-
-
Method Details
-
onlyEnforceIf
Adds a literal to the constraint. -
onlyEnforceIf
Adds a list of literals to the constraint. -
getIndex
public int getIndex()Returns the index of the constraint in the model. -
getBuilder
Returns the constraint builder.
-