Class BoolNotView

    • Constructor Detail

      • BoolNotView

        public BoolNotView​(BoolVar var)
        Create a not view based on var
        Parameters:
        var - a boolean variable
    • Method Detail

      • removeValue

        public boolean removeValue​(int value,
                                   ICause cause)
                            throws ContradictionException
        Description copied from interface: IntVar
        Removes valuefrom the domain of this. The instruction comes from propagator.
        • If value is out of the domain, nothing is done and the return value is false,
        • if removing value leads to a dead-end (domain wipe-out), a ContradictionException is thrown,
        • otherwise, if removing value from the domain can be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value is true
        Specified by:
        removeValue in interface IntVar
        Overrides:
        removeValue in class IntView<BoolVar>
        Parameters:
        value - value to remove from the domain (int)
        cause - removal releaser
        Returns:
        true if the value has been removed, false otherwise
        Throws:
        ContradictionException - if the domain become empty due to this action
      • removeValues

        public boolean removeValues​(IntIterableSet values,
                                    ICause cause)
                             throws ContradictionException
        Description copied from interface: IntVar
        Removes the value in valuesfrom the domain of this. The instruction comes from propagator.
        • If all values are out of the domain, nothing is done and the return value is false,
        • if removing a value leads to a dead-end (domain wipe-out), a ContradictionException is thrown,
        • otherwise, if removing the values from the domain can be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value is true
        Specified by:
        removeValues in interface IntVar
        Overrides:
        removeValues in class IntView<BoolVar>
        Parameters:
        values - set of ordered values to remove
        cause - removal release
        Returns:
        true if at least a value has been removed, false otherwise
        Throws:
        ContradictionException - if the domain become empty due to this action
      • removeAllValuesBut

        public boolean removeAllValuesBut​(IntIterableSet values,
                                          ICause cause)
                                   throws ContradictionException
        Description copied from interface: IntVar
        Removes all values from the domain of this except those in values. The instruction comes from propagator.
        • If all values are out of the domain, a ContradictionException is thrown,
        • if the domain is a subset of values, nothing is done and the return value is false,
        • otherwise, if removing all values but values from the domain can be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value is true
        Specified by:
        removeAllValuesBut in interface IntVar
        Overrides:
        removeAllValuesBut in class IntView<BoolVar>
        Parameters:
        values - set of ordered values to keep in the domain
        cause - removal release
        Returns:
        true if a at least a value has been removed, false otherwise
        Throws:
        ContradictionException - if the domain become empty due to this action
      • removeInterval

        public boolean removeInterval​(int from,
                                      int to,
                                      ICause cause)
                               throws ContradictionException
        Description copied from interface: IntVar
        Removes values between [from, to] from the domain of this. The instruction comes from propagator.
        • If union between values and the current domain is empty, nothing is done and the return value is false,
        • if removing a value leads to a dead-end (domain wipe-out), a ContradictionException is thrown,
        • otherwise, if removing at least a value from the domain can be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value is true
        Specified by:
        removeInterval in interface IntVar
        Overrides:
        removeInterval in class IntView<BoolVar>
        Parameters:
        from - lower bound of the interval to remove (int)
        to - upper bound of the interval to remove(int)
        cause - removal releaser
        Returns:
        true if the value has been removed, false otherwise
        Throws:
        ContradictionException - if the domain become empty due to this action
      • instantiateTo

        public boolean instantiateTo​(int value,
                                     ICause cause)
                              throws ContradictionException
        Description copied from interface: IntVar
        Instantiates the domain of this to value. The instruction comes from propagator.
        • If the domain of this is already instantiated to value, nothing is done and the return value is false,
        • If the domain of this is already instantiated to another value, then a ContradictionException is thrown,
        • Otherwise, the domain of this is restricted to value and the observers are notified and the return value is true.
        Specified by:
        instantiateTo in interface IntVar
        Overrides:
        instantiateTo in class IntView<BoolVar>
        Parameters:
        value - instantiation value (int)
        cause - instantiation releaser
        Returns:
        true if the instantiation is done, false otherwise
        Throws:
        ContradictionException - if the domain become empty due to this action
      • updateLowerBound

        public boolean updateLowerBound​(int value,
                                        ICause cause)
                                 throws ContradictionException
        Description copied from interface: IntVar
        Updates the lower bound of the domain of this to value. The instruction comes from propagator.
        • If value is smaller than the lower bound of the domain, nothing is done and the return value is false,
        • if updating the lower bound to value leads to a dead-end (domain wipe-out), a ContradictionException is thrown,
        • otherwise, if updating the lower bound to value can be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value is true
        Specified by:
        updateLowerBound in interface IntVar
        Overrides:
        updateLowerBound in class IntView<BoolVar>
        Parameters:
        value - new lower bound (included)
        cause - updating releaser
        Returns:
        true if the lower bound has been updated, false otherwise
        Throws:
        ContradictionException - if the domain become empty due to this action
      • updateUpperBound

        public boolean updateUpperBound​(int value,
                                        ICause cause)
                                 throws ContradictionException
        Description copied from interface: IntVar
        Updates the upper bound of the domain of this to value. The instruction comes from propagator.
        • If value is greater than the upper bound of the domain, nothing is done and the return value is false,
        • if updating the upper bound to value leads to a dead-end (domain wipe-out), a ContradictionException is thrown,
        • otherwise, if updating the upper bound to value can be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value is true
        Specified by:
        updateUpperBound in interface IntVar
        Overrides:
        updateUpperBound in class IntView<BoolVar>
        Parameters:
        value - new upper bound (included)
        cause - update releaser
        Returns:
        true if the upper bound has been updated, false otherwise
        Throws:
        ContradictionException - if the domain become empty due to this action
      • updateBounds

        public boolean updateBounds​(int lb,
                                    int ub,
                                    ICause cause)
                             throws ContradictionException
        Description copied from interface: IntVar
        Updates the lower bound and the upper bound of the domain of this to, resp. lb and ub. The instruction comes from propagator.

        • If lb is smaller than the lower bound of the domain and ub is greater than the upper bound of the domain,

          nothing is done and the return value is false,

        • if updating the lower bound to lb, or updating the upper bound to ub leads to a dead-end (domain wipe-out), or if lb is strictly greater than ub, a ContradictionException is thrown,
        • otherwise, if updating the lower bound to lb and/or the upper bound to ub can be done safely can be done safely, the event type is created (the original event can be promoted) and observers are notified and the return value is true
        Specified by:
        updateBounds in interface IntVar
        Overrides:
        updateBounds in class IntView<BoolVar>
        Parameters:
        lb - new lower bound (included)
        ub - new upper bound (included)
        cause - update releaser
        Returns:
        true if the upper bound has been updated, false otherwise
        Throws:
        ContradictionException - if the domain become empty due to this action
      • contains

        public boolean contains​(int value)
        Description copied from interface: IntVar
        Checks if a value v belongs to the domain of this
        Specified by:
        contains in interface IntVar
        Parameters:
        value - int
        Returns:
        true if the value belongs to the domain of this, false otherwise.
      • isInstantiatedTo

        public boolean isInstantiatedTo​(int value)
        Description copied from interface: IntVar
        Checks wether this is instantiated to val
        Specified by:
        isInstantiatedTo in interface IntVar
        Parameters:
        value - int
        Returns:
        true if this is instantiated to val, false otherwise
      • getValue

        public int getValue()
        Description copied from interface: IntVar
        Retrieves the current value of the variable if instantiated, otherwier the lower bound.
        Specified by:
        getValue in interface IntVar
        Returns:
        the current value (or lower bound if not yet instantiated).
      • getLB

        public int getLB()
        Description copied from interface: IntVar
        Retrieves the lower bound of the variable
        Specified by:
        getLB in interface IntVar
        Returns:
        the lower bound
      • getUB

        public int getUB()
        Description copied from interface: IntVar
        Retrieves the upper bound of the variable
        Specified by:
        getUB in interface IntVar
        Returns:
        the upper bound
      • nextValue

        public int nextValue​(int v)
        Description copied from interface: IntVar
        Returns the first value just after v in this which is in the domain. If no such value exists, returns Integer.MAX_VALUE;

        To iterate over the values in a IntVar, use the following loop:

         int ub = iv.getUB();
         for (int i = iv.getLB(); i <= ub; i = iv.nextValue(i)) {
             // operate on value i here
         }
        Specified by:
        nextValue in interface IntVar
        Parameters:
        v - the value to start checking (exclusive)
        Returns:
        the next value in the domain
      • nextValueOut

        public int nextValueOut​(int v)
        Description copied from interface: IntVar
        Returns the first value just after v in this which is out of the domain. If v is less than or equal to IntVar.getLB()-2, returns v + 1, if v is greater than or equal to IntVar.getUB(), returns v + 1.
        Specified by:
        nextValueOut in interface IntVar
        Parameters:
        v - the value to start checking (exclusive)
        Returns:
        the next value out of the domain
      • previousValue

        public int previousValue​(int v)
        Description copied from interface: IntVar
        Returns the previous value just before v in this. If no such value exists, returns Integer.MIN_VALUE;

        To iterate over the values in a IntVar, use the following loop:

         int lb = iv.getLB();
         for (int i = iv.getUB(); i >= lb; i = iv.previousValue(i)) {
             // operate on value i here
         }
        Specified by:
        previousValue in interface IntVar
        Parameters:
        v - the value to start checking (exclusive)
        Returns:
        the previous value in the domain
      • previousValueOut

        public int previousValueOut​(int v)
        Description copied from interface: IntVar
        Returns the first value just before v in this which is out of the domain. If v is greater than or equal to IntVar.getUB()+2, returns v - 1, if v is less than or equal to IntVar.getLB(), returns v - 1.
        Specified by:
        previousValueOut in interface IntVar
        Parameters:
        v - the value to start checking (exclusive)
        Returns:
        the previous value out of the domain
      • monitorDelta

        public IIntDeltaMonitor monitorDelta​(ICause propagator)
        Description copied from interface: IntVar
        Allow to monitor removed values of this.
        Specified by:
        monitorDelta in interface IntVar
        Parameters:
        propagator - the cause that requires to monitor delta
        Returns:
        a delta monitor
      • not

        public BoolVar not()
        Specified by:
        not in interface BoolVar
        Specified by:
        not in interface ReExpression
        Returns:
        return the expression "¬x" where this is "x"
      • hasNot

        public boolean hasNot()
        Specified by:
        hasNot in interface BoolVar
      • isLit

        public boolean isLit()
        Description copied from interface: ILogical
        Current tree is a literal
        Specified by:
        isLit in interface ILogical
        Returns:
        true if this is a literal
      • isNot

        public boolean isNot()
        Description copied from interface: ILogical
        Current tree is rooted with NOT logical operator This is a one way relationship: in case a = not(b) a.isNot() returns true whereas b.isNot() returns false (unless b = not(c)...)
        Specified by:
        isNot in interface ILogical
        Returns:
        true if this is NOT
      • setNot

        public void setNot​(boolean isNot)
        Description copied from interface: ILogical
        States whether or not this variable is the negation of another. This is a one way relationship: in case a = not(b) a.isNot() returns true whereas b.isNot() returns false (unless b = not(c)...)
        Specified by:
        setNot in interface ILogical
        Parameters:
        isNot - true iff this variable is the negation of another
      • getTypeAndKind

        public int getTypeAndKind()
        Description copied from interface: Variable
        Return a MASK composed of 2 main information: TYPE and KIND.
        TYPE is defined in the 3 first bits : VAR ( 1 << 0), CSTE (1 << 1) or VIEW (1 << 2)
        KIND is defined on the other bits : INT (1 << 3), BOOL (INT + 1 << 4), GRAPH (1 << 5) or META (1 << 6)

        To get the TYPE of a variable:

         int type = var.getTypeAndKind() & Variable.TYPE;
         

        To get the KIND of a variable:

         int kind = var.getTypeAndKind() & Variable.KIND;
         

        To check a specific type or kind of a variable:

             boolean isVar = (var.getTypeAndKind() & Variable.VAR) !=0;
             boolean isInt = (var.getTypeAndKind() & Variable.INT) !=0;
         
        Specified by:
        getTypeAndKind in interface Variable
        Overrides:
        getTypeAndKind in class IntView<BoolVar>
        Returns:
        an int representing the type and kind of the variable
      • justifyEvent

        public void justifyEvent​(IntEventType mask,
                                 int one,
                                 int two,
                                 int three)
        Description copied from interface: IView
        This methods is related to explanations, it binds an event occurring on the observed variable to the view.
        Specified by:
        justifyEvent in interface IView
        Parameters:
        mask - type of modification
        one - an int
        two - an int
        three - an int
      • explain

        public void explain​(ExplanationForSignedClause explanation,
                            ValueSortedMap<IntVar> front,
                            Implications ig,
                            int p)
        Description copied from interface: ICause
        Clausal explanation for this cause.

        This method must filled explanations with inferred literals. These literals are inferred from the analysis of (a subset of) conflicting nodes stored in front, the implication graph ig and the current node in conflict, not yet contained in front.

        Optionally, this method can update front by looking for a predecessor of any node that seems more relevant than the declared one.

        Specified by:
        explain in interface ICause
        Specified by:
        explain in interface IView
        Parameters:
        explanation - explanation to compute
        front - ordered map of (variable,node> in the conflict frontier of the implication graph.
        ig - an implication graph
        p - the pivot node out of front