Package com.google.ortools.sat
Class Constraint
java.lang.Object
com.google.ortools.sat.Constraint
public class Constraint
extends java.lang.Object
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 Constructor Description Constraint(CpModelProto.Builder builder) -
Method Summary
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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.
-