Package org.jacop.constraints
Class BoolClause
java.lang.Object
org.jacop.constraints.DecomposedConstraint<Constraint>
org.jacop.constraints.Constraint
org.jacop.constraints.PrimitiveConstraint
org.jacop.constraints.BoolClause
- All Implemented Interfaces:
SatisfiedPresent,StoreAware
I defines a boolean clause for 0/1 variables x_i and y_i.
The clause is fulfilled if at least one varibale x_i = 1 or at least one varibale y_i = 0,
that is it defines (x_1 \/ x_2 \/ ... x_n) \/ (not y_1 \/ not y_2 \/ ... not y_n)
It restricts the domain of all x as well as result to be between 0 and 1.
- Version:
- 4.10
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final AtomicIntegerprivate final intIt specifies length of lists x and y respectively.private final intDefines first position of the variable that is not ground to 0 (positionX) or 0 (positionY).final IntVar[]It specifies lists of variables for the constraint.final IntVar[]Fields inherited from class org.jacop.constraints.PrimitiveConstraint
notConsistencyPruningEventsFields inherited from class org.jacop.constraints.Constraint
afcWeight, atomicExecution, consistencyPruningEvents, constraintScope, earlyTerminationOK, increaseWeight, numberId, scope, trace, watchedVariableGroundedFields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex -
Constructor Summary
ConstructorsConstructorDescriptionBoolClause(List<? extends IntVar> x, List<? extends IntVar> y) It constructs BoolClause.BoolClause(IntVar[] x, IntVar[] y) It constructs BoolClause. -
Method Summary
Modifier and TypeMethodDescriptionIt checks invariants required by the constraint.voidconsistency(Store store) computes consistency for x_0 \/ ...intprotected intprotected intprotected intvoidIt provide store for constraints that are not imposed but called from other constraints.voidnotConsistency(Store store) computes consistency for not (x_0 \/ ...booleanIt checks if constraint would be always not satisfied.booleanIt checks if the constraint is satisfied.private voidtoString()It produces a string representation of a constraint state.Methods inherited from class org.jacop.constraints.PrimitiveConstraint
getNestedPruningEvent, getNotConsistencyPruningEvent, impose, setNotConsistencyPruningEventMethods inherited from class org.jacop.constraints.Constraint
afc, arguments, cleanAfterFailure, decompose, getConsistencyPruningEvent, getGuideConstraint, getGuideValue, getGuideVariable, grounded, grounded, id, impose, imposeDecomposition, increaseWeight, intArrayToString, long2int, numberArgs, queueVariable, removeConstraint, requiresMonotonicity, setConsistencyPruningEvent, setConstraintScope, setScope, setScope, setScope, setScope, setScope, setWatchedVariableGrounded, supplyGuideFeedback, toInt, toInt, updateAFC, watchedVariableGroundedMethods inherited from class org.jacop.constraints.DecomposedConstraint
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
-
Field Details
-
idNumber
-
x
It specifies lists of variables for the constraint. -
y
-
lx
private final int lxIt specifies length of lists x and y respectively. -
ly
private final int ly -
positionX
Defines first position of the variable that is not ground to 0 (positionX) or 0 (positionY). -
positionY
-
-
Constructor Details
-
BoolClause
It constructs BoolClause.- Parameters:
x- list of positive arguments x's.y- list of negative arguments y's.
-
BoolClause
It constructs BoolClause.- Parameters:
x- list of positive arguments x's.y- list of negative arguments y's.
-
-
Method Details
-
checkInvariants
It checks invariants required by the constraint. Namely that boolean variables have boolean domain.- Returns:
- the string describing the violation of the invariant, null otherwise.
-
getDefaultNestedConsistencyPruningEvent
protected int getDefaultNestedConsistencyPruningEvent()- Overrides:
getDefaultNestedConsistencyPruningEventin classPrimitiveConstraint
-
getDefaultNestedNotConsistencyPruningEvent
protected int getDefaultNestedNotConsistencyPruningEvent()- Overrides:
getDefaultNestedNotConsistencyPruningEventin classPrimitiveConstraint
-
getDefaultConsistencyPruningEvent
public int getDefaultConsistencyPruningEvent()- Specified by:
getDefaultConsistencyPruningEventin classConstraint
-
getDefaultNotConsistencyPruningEvent
protected int getDefaultNotConsistencyPruningEvent()- Specified by:
getDefaultNotConsistencyPruningEventin classPrimitiveConstraint
-
include
Description copied from interface:StoreAwareIt provide store for constraints that are not imposed but called from other constraints.- Specified by:
includein interfaceStoreAware- Overrides:
includein classPrimitiveConstraint- Parameters:
store- the constraint store in which context the constraint is executed.
-
consistency
computes consistency for x_0 \/ ... \/ x_n \/ not y_0 \/ ... \/ not y_n- Specified by:
consistencyin classConstraint- Parameters:
store- constraint store within which the constraint consistency is being checked.
-
swap
-
notConsistency
computes consistency for not (x_0 \/ ... \/ x_n \/ not y_0 \/ ... \/ not y_n) implies not x_0 /\ ... /\ not x_n /\ y_0 /\ ... /\ y_n taht is all x_i = 0 /\ all y_i = 1- Specified by:
notConsistencyin classPrimitiveConstraint- Parameters:
store- the constraint store in which context the notConsistency technique is evaluated.
-
satisfied
public boolean satisfied()Description copied from interface:SatisfiedPresentIt checks if the constraint is satisfied. It can return false even if constraint is satisfied but not all variables in its scope are grounded. It needs to return true if all variables in its scope are grounded and constraint is satisfied.Implementations of this interface for constraints that are not PrimitiveConstraint may require constraint imposition and consistency check as a requirement to work correctly.
- Returns:
- true if constraint is possible to verify that it is satisfied.
-
notSatisfied
public boolean notSatisfied()Description copied from class:PrimitiveConstraintIt checks if constraint would be always not satisfied.- Specified by:
notSatisfiedin classPrimitiveConstraint- Returns:
- true if constraint must be notSatisfied, false otherwise.
-
toString
Description copied from class:ConstraintIt produces a string representation of a constraint state.- Overrides:
toStringin classConstraint
-