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
public class BoolClause extends PrimitiveConstraint
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.8
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.util.concurrent.atomic.AtomicIntegeridNumberprivate intlxIt specifies length of lists x and y respectively.private intlyIt specifies length of lists x and y respectively.private TimeStamp<java.lang.Integer>positionXDefines first position of the variable that is not ground to 0 (positionX) or 0 (positionY).private TimeStamp<java.lang.Integer>positionYIntVar[]xIt specifies lists of variables for the constraint.IntVar[]y-
Fields inherited from class org.jacop.constraints.PrimitiveConstraint
notConsistencyPruningEvents
-
Fields inherited from class org.jacop.constraints.Constraint
afcWeight, atomicExecution, consistencyPruningEvents, constraintScope, earlyTerminationOK, increaseWeight, numberId, scope, trace, watchedVariableGrounded
-
Fields inherited from class org.jacop.constraints.DecomposedConstraint
queueIndex
-
-
Constructor Summary
Constructors Constructor Description BoolClause(java.util.List<IntVar> x, java.util.List<IntVar> y)It constructs BoolClause.BoolClause(IntVar[] x, IntVar[] y)It constructs BoolClause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcheckInvariants()It checks invariants required by the constraint.voidconsistency(Store store)computes consistency for x_0 \/ ...intgetDefaultConsistencyPruningEvent()protected intgetDefaultNestedConsistencyPruningEvent()protected intgetDefaultNestedNotConsistencyPruningEvent()protected intgetDefaultNotConsistencyPruningEvent()voidinclude(Store store)It provide store for constraints that are not imposed but called from other constraints.voidnotConsistency(Store store)computes consistency for not (x_0 \/ ...booleannotSatisfied()It checks if constraint would be always not satisfied.booleansatisfied()It checks if the constraint is satisfied.private voidswap(IntVar[] p, int i, int j)java.lang.StringtoString()It produces a string representation of a constraint state.-
Methods inherited from class org.jacop.constraints.PrimitiveConstraint
getNestedPruningEvent, getNotConsistencyPruningEvent, impose, setNotConsistencyPruningEvent
-
Methods 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, watchedVariableGrounded
-
Methods inherited from class org.jacop.constraints.DecomposedConstraint
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
-
-
-
-
Field Detail
-
idNumber
static final java.util.concurrent.atomic.AtomicInteger idNumber
-
x
public final IntVar[] x
It specifies lists of variables for the constraint.
-
y
public final IntVar[] y
-
lx
private final int lx
It specifies length of lists x and y respectively.
-
ly
private final int ly
It specifies length of lists x and y respectively.
-
positionX
private TimeStamp<java.lang.Integer> positionX
Defines first position of the variable that is not ground to 0 (positionX) or 0 (positionY).
-
positionY
private TimeStamp<java.lang.Integer> positionY
-
-
Method Detail
-
checkInvariants
public java.lang.String 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
public void include(Store store)
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
public void consistency(Store store)
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
private void swap(IntVar[] p, int i, int j)
-
notConsistency
public void notConsistency(Store store)
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
public java.lang.String toString()
Description copied from class:ConstraintIt produces a string representation of a constraint state.- Overrides:
toStringin classConstraint
-
-