Class SatCPBridge

java.lang.Object
org.jacop.satwrapper.translation.SatCPBridge
All Implemented Interfaces:
WrapperComponent
Direct Known Subclasses:
LazyCpVarDomain, SimpleCpVarDomain

public abstract class SatCPBridge extends Object implements WrapperComponent
interface representing the domain of a CP variable as a range. It is used to provide literals to represent assertions like 'X = v' or 'X<= v' where X is the CP variable and v a value from its domain
Version:
4.8
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    final IntDomain
     
    int
     
    int
     
    final IntVar
     
    protected SatWrapper
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    SatCPBridge(IntVar variable)
    simple constructor with a variable
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract int
    boolVarToCpValue(int literal)
    return the value corresponding to given literal (variable)
    abstract int
    cpValueToBoolVar(int value, boolean isEquality)
    return the literal that represents the assertion 'var = value'.
    final int
    the left limit of the range
    final int
    the right limit of the range
    abstract void
    connect the component to the wrapper
    abstract boolean
    isEqualityBoolVar(int literal)
    checks if the literal stands for a 'x=d' proposition, or a 'x<=d' proposition
    final boolean
    isInThisRange(int literal)
    checks if the literal represents a proposition about the variable this object manages
    abstract boolean
    predicate for whether this variable should be handled by the DomainClausesDatabase or not
    abstract void
    propagate(int literal)
    does all propagation required, in a way specific to this range.
    void
    setDomain(int minValue, int maxValue)
    set the domain to be between minValue and maxValue.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • wrapper

      protected SatWrapper wrapper
    • variable

      public final IntVar variable
    • initialDomain

      public final IntDomain initialDomain
    • min

      public int min
    • max

      public int max
    • hasSetDomain

      protected boolean hasSetDomain
  • Constructor Details

    • SatCPBridge

      public SatCPBridge(IntVar variable)
      simple constructor with a variable
      Parameters:
      variable - the variable of which this is the range
  • Method Details

    • getLeftLimit

      public final int getLeftLimit()
      the left limit of the range
      Returns:
      the *value* of the current left limit of the range
    • getRightLimit

      public final int getRightLimit()
      the right limit of the range
      Returns:
      the *value* of the current right limit of the range
    • setDomain

      public void setDomain(int minValue, int maxValue)
      set the domain to be between minValue and maxValue. It only does something on the first call.
      Parameters:
      minValue - minimum value of the range
      maxValue - maximum value of the range
    • cpValueToBoolVar

      public abstract int cpValueToBoolVar(int value, boolean isEquality)
      return the literal that represents the assertion 'var = value'. For the proposition 'var<= value', set the isEquality flag to false
      Parameters:
      value - the value for the variable this range represents
      isEquality - true if we want the literal for 'x=d' kind of propositions, false for 'x<=d'
      Returns:
      the literal corresponding to 'var = this value'. If the value is out of the domain of the variable, returns 0.
    • boolVarToCpValue

      public abstract int boolVarToCpValue(int literal)
      return the value corresponding to given literal (variable)
      Parameters:
      literal - the literal standing for 'var = value'
      Returns:
      the value such that 'var = value' (or 'var<= value')
    • isEqualityBoolVar

      public abstract boolean isEqualityBoolVar(int literal)
      checks if the literal stands for a 'x=d' proposition, or a 'x<=d' proposition
      Parameters:
      literal - the literal (among literals from this range)
      Returns:
      true if the literal stands for 'x=d', false otherwise
    • isInThisRange

      public final boolean isInThisRange(int literal)
      checks if the literal represents a proposition about the variable this object manages
      Parameters:
      literal - a literal
      Returns:
      true if there is a 'd' such that literal stands for 'x=d' or 'x<=d'
    • propagate

      public abstract void propagate(int literal)
      does all propagation required, in a way specific to this range. This part may not be used, if the variable is not bound to a DomainClausesDatabase. This will be called only if this.isTranslated() is false.
      Parameters:
      literal - the literal that has been asserted
    • isTranslated

      public abstract boolean isTranslated()
      predicate for whether this variable should be handled by the DomainClausesDatabase or not
      Returns:
      true if the variable should be handled by the DomainClausesDatabase
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • initialize

      public abstract void initialize(SatWrapper wrapper)
      Description copied from interface: WrapperComponent
      connect the component to the wrapper
      Specified by:
      initialize in interface WrapperComponent
      Parameters:
      wrapper - the wrapper