Package com.google.ortools.sat
Class Constraint
- java.lang.Object
-
- com.google.ortools.sat.Constraint
-
- Direct Known Subclasses:
AutomatonConstraint,CircuitConstraint,CumulativeConstraint,MultipleCircuitConstraint,NoOverlap2dConstraint,ReservoirConstraint,TableConstraint
public class Constraint extends java.lang.ObjectWrapper 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 Constructor Description Constraint(CpModelProto.Builder builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConstraintProto.BuildergetBuilder()Returns 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 Detail
-
Constraint
public Constraint(CpModelProto.Builder builder)
-
-
Method Detail
-
onlyEnforceIf
public void onlyEnforceIf(Literal lit)
Adds a literal to the constraint.
-
onlyEnforceIf
public void onlyEnforceIf(Literal[] lits)
Adds a list of literals to the constraint.
-
getIndex
public int getIndex()
Returns the index of the constraint in the model.
-
getBuilder
public ConstraintProto.Builder getBuilder()
Returns the constraint builder.
-
-