Java Reference

Java Reference

Detailed Description

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.

Definition at line 25 of file java/com/google/ortools/sat/Constraint.java.

Public Member Functions

 Constraint (CpModelProto.Builder builder)
 
void onlyEnforceIf (Literal lit)
 Adds a literal to the constraint. More...
 
void onlyEnforceIf (Literal[] lits)
 Adds a list of literals to the constraint. More...
 
int getIndex ()
 Returns the index of the constraint in the model. More...
 
ConstraintProto.Builder getBuilder ()
 Returns the constraint builder. More...
 

Constructor & Destructor Documentation

◆ Constraint()

Constraint ( CpModelProto.Builder  builder)

Definition at line 26 of file java/com/google/ortools/sat/Constraint.java.

Member Function Documentation

◆ getBuilder()

ConstraintProto.Builder getBuilder ( )

Returns the constraint builder.

Definition at line 49 of file java/com/google/ortools/sat/Constraint.java.

◆ getIndex()

int getIndex ( )

Returns the index of the constraint in the model.

Definition at line 44 of file java/com/google/ortools/sat/Constraint.java.

◆ onlyEnforceIf() [1/2]

void onlyEnforceIf ( Literal  lit)

Adds a literal to the constraint.

Definition at line 32 of file java/com/google/ortools/sat/Constraint.java.

◆ onlyEnforceIf() [2/2]

void onlyEnforceIf ( Literal[]  lits)

Adds a list of literals to the constraint.

Definition at line 37 of file java/com/google/ortools/sat/Constraint.java.


The documentation for this class was generated from the following file: