-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default boolean
addClause(int... lits)
Add a clause based on SAT variabledefault boolean
addClauseFalse(BoolVar BOOLVAR)
Add a unit clause stating that BOOLVAR must be falsedefault boolean
addClauses(LogOp TREE)
Ensures that the clauses defined in the Boolean logic formula TREE are satisfied.default boolean
addClauses(BoolVar[] POSLITS, BoolVar[] NEGLITS)
Ensures that the clause defined by POSLITS and NEGLITS is satisfied.default boolean
addClausesAtMostNMinusOne(BoolVar[] BOOLVARS)
Add a clause stating that: ∑ BOOLVARSi ≤ n-1default boolean
addClausesAtMostOne(BoolVar[] BOOLVARS)
Add a clause stating that: ∑ BOOLVARSi ≤ 1default boolean
addClausesBoolAndArrayEqualFalse(BoolVar[] BOOLVARS)
Add a clause stating that: BOOLVARS1∧BOOLVARS2∧...∧BOOLVARSndefault boolean
addClausesBoolAndArrayEqVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: (BOOLVARS1∧BOOLVARS2∧...∧BOOLVARSn) ⇔ TARGETdefault boolean
addClausesBoolAndEqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ∧ RIGHT) ⇔ TARGETdefault boolean
addClausesBoolEq(BoolVar LEFT, BoolVar RIGHT)
Add a clause stating that: LEFT == RIGHTdefault boolean
addClausesBoolIsEqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT == RIGHT) ⇔ TARGETdefault boolean
addClausesBoolIsLeVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ≤ RIGHT) ⇔ TARGETdefault boolean
addClausesBoolIsLtVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT < RIGHT) ⇔ TARGETdefault boolean
addClausesBoolIsNeqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ≠ RIGHT) ⇔ TARGETdefault boolean
addClausesBoolLe(BoolVar LEFT, BoolVar RIGHT)
Add a clause stating that: LEFT ≤ RIGHTdefault boolean
addClausesBoolLt(BoolVar LEFT, BoolVar RIGHT)
Add a clause stating that: LEFT < RIGHTdefault boolean
addClausesBoolNot(BoolVar LEFT, BoolVar RIGHT)
Add a clause stating that: LEFT !default boolean
addClausesBoolOrArrayEqualTrue(BoolVar[] BOOLVARS)
Add a clause stating that: BOOLVARS1∨BOOLVARS2∨...∨BOOLVARSndefault boolean
addClausesBoolOrArrayEqVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: (BOOLVARS1∨BOOLVARS2∨...∨BOOLVARSn) ⇔ TARGETdefault boolean
addClausesBoolOrEqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ∨ RIGHT) ⇔ TARGETdefault boolean
addClausesBoolXorEqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ⊕ RIGHT) ⇔ TARGETdefault boolean
addClausesMaxBoolArrayLessEqVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: max(BOOLVARSi) ≤ TARGETdefault boolean
addClausesSumBoolArrayGreaterEqVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: sum(BOOLVARSi) ≥ TARGETdefault boolean
addClausesSumBoolArrayLessEqKVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: sum(BOOLVARSi) ≤ TARGET * |BOOLVARS|default boolean
addClauseTrue(BoolVar BOOLVAR)
Add a unit clause stating that BOOLVAR must be truedefault boolean
addConstructiveDisjunction(Constraint... cstrs)
Make a constructive disjunction constraintdefault int
lit(int svar)
Return the positive literal of a SAT variabledefault int
neg(int svar)
Return the negative literal of a SAT variabledefault int
satVar(Variable var, Literalizer ltz)
Creates, or returns if already existing, the SAT variable corresponding to this CP relationship.
-
-
-
Method Detail
-
satVar
default int satVar(Variable var, Literalizer ltz)
Creates, or returns if already existing, the SAT variable corresponding to this CP relationship.- Parameters:
var
- a boolean variable- Returns:
- its SAT twin
-
lit
default int lit(int svar)
Return the positive literal of a SAT variable- Parameters:
svar
- a sat variable- Returns:
- its positive literal
-
neg
default int neg(int svar)
Return the negative literal of a SAT variable- Parameters:
svar
- a sat variable- Returns:
- its negative literal
-
addClause
default boolean addClause(int... lits)
Add a clause based on SAT variable- Parameters:
lits
- a sat variable- Returns:
true
if the clause has been added correctly.
-
addClauses
default boolean addClauses(LogOp TREE)
Ensures that the clauses defined in the Boolean logic formula TREE are satisfied.- Parameters:
TREE
- the syntactic tree- Returns:
- true if the clause has been added to the clause store
-
addClauses
default boolean addClauses(BoolVar[] POSLITS, BoolVar[] NEGLITS)
Ensures that the clause defined by POSLITS and NEGLITS is satisfied.- Parameters:
POSLITS
- positive literalsNEGLITS
- negative literals- Returns:
- true if the clause has been added to the clause store
-
addClauseTrue
default boolean addClauseTrue(BoolVar BOOLVAR)
Add a unit clause stating that BOOLVAR must be true- Parameters:
BOOLVAR
- a boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClauseFalse
default boolean addClauseFalse(BoolVar BOOLVAR)
Add a unit clause stating that BOOLVAR must be false- Parameters:
BOOLVAR
- a boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolEq
default boolean addClausesBoolEq(BoolVar LEFT, BoolVar RIGHT)
Add a clause stating that: LEFT == RIGHT- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolLe
default boolean addClausesBoolLe(BoolVar LEFT, BoolVar RIGHT)
Add a clause stating that: LEFT ≤ RIGHT- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolLt
default boolean addClausesBoolLt(BoolVar LEFT, BoolVar RIGHT)
Add a clause stating that: LEFT < RIGHT- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolNot
default boolean addClausesBoolNot(BoolVar LEFT, BoolVar RIGHT)
Add a clause stating that: LEFT != RIGHT- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolOrArrayEqVar
default boolean addClausesBoolOrArrayEqVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: (BOOLVARS1∨BOOLVARS2∨...∨BOOLVARSn) ⇔ TARGET- Parameters:
BOOLVARS
- a list of boolean variablesTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolAndArrayEqVar
default boolean addClausesBoolAndArrayEqVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: (BOOLVARS1∧BOOLVARS2∧...∧BOOLVARSn) ⇔ TARGET- Parameters:
BOOLVARS
- a list of boolean variablesTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolOrEqVar
default boolean addClausesBoolOrEqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ∨ RIGHT) ⇔ TARGET- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variableTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolAndEqVar
default boolean addClausesBoolAndEqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ∧ RIGHT) ⇔ TARGET- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variableTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolXorEqVar
default boolean addClausesBoolXorEqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ⊕ RIGHT) ⇔ TARGET- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variableTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolIsEqVar
default boolean addClausesBoolIsEqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT == RIGHT) ⇔ TARGET- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variableTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolIsNeqVar
default boolean addClausesBoolIsNeqVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ≠ RIGHT) ⇔ TARGET- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variableTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolIsLeVar
default boolean addClausesBoolIsLeVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT ≤ RIGHT) ⇔ TARGET- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variableTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolIsLtVar
default boolean addClausesBoolIsLtVar(BoolVar LEFT, BoolVar RIGHT, BoolVar TARGET)
Add a clause stating that: (LEFT < RIGHT) ⇔ TARGET- Parameters:
LEFT
- a boolean variableRIGHT
- another boolean variableTARGET
- the reified boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolOrArrayEqualTrue
default boolean addClausesBoolOrArrayEqualTrue(BoolVar[] BOOLVARS)
Add a clause stating that: BOOLVARS1∨BOOLVARS2∨...∨BOOLVARSn- Parameters:
BOOLVARS
- a list of boolean variables- Returns:
- true if the clause has been added to the clause store
-
addClausesBoolAndArrayEqualFalse
default boolean addClausesBoolAndArrayEqualFalse(BoolVar[] BOOLVARS)
Add a clause stating that: BOOLVARS1∧BOOLVARS2∧...∧BOOLVARSn- Parameters:
BOOLVARS
- a list of boolean variables- Returns:
- true if the clause has been added to the clause store
-
addClausesAtMostOne
default boolean addClausesAtMostOne(BoolVar[] BOOLVARS)
Add a clause stating that: ∑ BOOLVARSi ≤ 1- Parameters:
BOOLVARS
- a list of boolean variables- Returns:
- true if the clause has been added to the clause store
-
addClausesAtMostNMinusOne
default boolean addClausesAtMostNMinusOne(BoolVar[] BOOLVARS)
Add a clause stating that: ∑ BOOLVARSi ≤ n-1- Parameters:
BOOLVARS
- a list of boolean variables- Returns:
- true if the clause has been added to the clause store
-
addClausesSumBoolArrayGreaterEqVar
default boolean addClausesSumBoolArrayGreaterEqVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: sum(BOOLVARSi) ≥ TARGET- Parameters:
BOOLVARS
- a list of boolean variablesTARGET
- a boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesMaxBoolArrayLessEqVar
default boolean addClausesMaxBoolArrayLessEqVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: max(BOOLVARSi) ≤ TARGET- Parameters:
BOOLVARS
- a list of boolean variablesTARGET
- a boolean variable- Returns:
- true if the clause has been added to the clause store
-
addClausesSumBoolArrayLessEqKVar
default boolean addClausesSumBoolArrayLessEqKVar(BoolVar[] BOOLVARS, BoolVar TARGET)
Add a clause stating that: sum(BOOLVARSi) ≤ TARGET * |BOOLVARS|- Parameters:
BOOLVARS
- a list of boolean variablesTARGET
- a boolean variable- Returns:
- true if the clause has been added to the clause store
-
addConstructiveDisjunction
default boolean addConstructiveDisjunction(Constraint... cstrs)
Make a constructive disjunction constraint- Parameters:
cstrs
- constraint in disjunction- Returns:
- true if the disjunction has been added to the constructive disjunction store.
-
-