Class 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 Details

    • idNumber

      static final 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<Integer> positionX
      Defines first position of the variable that is not ground to 0 (positionX) or 0 (positionY).
    • positionY

      private TimeStamp<Integer> positionY
  • Constructor Details

    • BoolClause

      public BoolClause(IntVar[] x, IntVar[] y)
      It constructs BoolClause.
      Parameters:
      x - list of positive arguments x's.
      y - list of negative arguments y's.
    • BoolClause

      public BoolClause(List<IntVar> x, List<IntVar> y)
      It constructs BoolClause.
      Parameters:
      x - list of positive arguments x's.
      y - list of negative arguments y's.
  • Method Details

    • checkInvariants

      public 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:
      getDefaultNestedConsistencyPruningEvent in class PrimitiveConstraint
    • getDefaultNestedNotConsistencyPruningEvent

      protected int getDefaultNestedNotConsistencyPruningEvent()
      Overrides:
      getDefaultNestedNotConsistencyPruningEvent in class PrimitiveConstraint
    • getDefaultConsistencyPruningEvent

      public int getDefaultConsistencyPruningEvent()
      Specified by:
      getDefaultConsistencyPruningEvent in class Constraint
    • getDefaultNotConsistencyPruningEvent

      protected int getDefaultNotConsistencyPruningEvent()
      Specified by:
      getDefaultNotConsistencyPruningEvent in class PrimitiveConstraint
    • include

      public void include(Store store)
      Description copied from interface: StoreAware
      It provide store for constraints that are not imposed but called from other constraints.
      Specified by:
      include in interface StoreAware
      Overrides:
      include in class PrimitiveConstraint
      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:
      consistency in class Constraint
      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:
      notConsistency in class PrimitiveConstraint
      Parameters:
      store - the constraint store in which context the notConsistency technique is evaluated.
    • satisfied

      public boolean satisfied()
      Description copied from interface: SatisfiedPresent
      It 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: PrimitiveConstraint
      It checks if constraint would be always not satisfied.
      Specified by:
      notSatisfied in class PrimitiveConstraint
      Returns:
      true if constraint must be notSatisfied, false otherwise.
    • toString

      public String toString()
      Description copied from class: Constraint
      It produces a string representation of a constraint state.
      Overrides:
      toString in class Constraint