Class Decision<E extends Variable>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int branch
      Indication of the decision state. 0: not yet applied 1: applied once 2: refuter once, ...
      protected int max_branching
      Number of time a decision can be applied.
      protected E var
      Variable of this decision
    • Constructor Summary

      Constructors 
      Constructor Description
      Decision​(int arity)
      Create a arity-decision.
    • Field Detail

      • var

        protected transient E extends Variable var
        Variable of this decision
      • max_branching

        protected int max_branching
        Number of time a decision can be applied. For unary decision set to 1 , for binary decision, set to 2, ...
      • branch

        protected int branch
        Indication of the decision state. 0: not yet applied 1: applied once 2: refuter once, ...
    • Constructor Detail

      • Decision

        public Decision​(int arity)
        Create a arity-decision.
        Parameters:
        arity - how many time this decision can be applied (and then refuted)
    • Method Detail

      • setPosition

        public final void setPosition​(int p)
        Set the position of this decision in the decision path. Note that the position a decision is unique.
        Parameters:
        p - position of this decision in the decision path
      • getPosition

        public final int getPosition()
        Get the position of this decision in the decision path Note that the position a decision is unique.
        Returns:
        position of this decision in the decision path
      • hasNext

        public final boolean hasNext()
        Return true if the decision can be refuted
        Returns:
        true if the decision can be refuted, false otherwise
      • buildNext

        public final void buildNext()
        Build the refutation, hasNext() must be called before
      • triesLeft

        public final int triesLeft()
        Return the number of branches left to try
        Returns:
        number of tries left
      • setRefutable

        public final Decision<E> setRefutable​(boolean isRefutable)
        Indicate whether or not this decision can be refuted if set to false, if the decision(e.g. x=3) fails instead of backtracking once and applying its negation (e.g. x!=3) the resolver will backtrack twice and negates the previous decision.
        Parameters:
        isRefutable - set to false to disable refutation
        Returns:
        this object
      • getArity

        public final int getArity()
        Returns:
        number of time a decision can be applied. For unary decision set to 1 , for binary decision, set to 2, ...
      • rewind

        public final void rewind()
        Force the decision to be in its creation state.
      • set

        protected void set​(E var)
        Reuse the decision
        Parameters:
        var - the decision object (commonly a variable)
      • getDecisionVariable

        public final E getDecisionVariable()
        Return the variable object involves in the decision
        Returns:
        a variable V
      • getDecisionValue

        public abstract Object getDecisionValue()
        Return the value object involves in the decision
        Returns:
        a value object
      • free

        public abstract void free()
        Free the decision, ie, it can be reused
      • reverse

        public void reverse()
        Reverse the decision operator
      • duplicate

        public Decision<E> duplicate()
        Returns:
        a copy of this decision
      • isEquivalentTo

        public boolean isEquivalentTo​(Decision dec)
        Parameters:
        dec - a decision
        Returns:
        true if the two decisions are equivalent (same variable, same operator, same value)