Class ExplanationForSignedClause


  • public class ExplanationForSignedClause
    extends IExplanation
    An implementation of IExplanation dedicated to learn signed clauses

    Project: choco-solver.

    Since:
    27/01/2017.
    Author:
    Charles Prud'homme
    • Field Detail

      • ASSERT_NO_LEFT_BRANCH

        public static boolean ASSERT_NO_LEFT_BRANCH
        Set to false when skip assertion that no left branch are backtracked to
      • DEFAULT_X

        public static boolean DEFAULT_X
        Set to true to force all cause to use default explanations
      • PROOF

        public static boolean PROOF
        FOR DEBUGGING PURPOSE ONLY. Set to true to output proofs
      • FINE_PROOF

        public static boolean FINE_PROOF
        FOR DEBUGGING PURPOSE ONLY. Set to true to output proofs with details
    • Constructor Detail

      • ExplanationForSignedClause

        public ExplanationForSignedClause​(Implications ig)
    • Method Detail

      • extractConstraint

        public void extractConstraint​(Model mModel,
                                      ClauseStore ngstore)
        Description copied from class: IExplanation
        Extract and post the nogood related to this explanation
        Specified by:
        extractConstraint in class IExplanation
        Parameters:
        mModel - the model to post the nogood in
      • recycle

        public void recycle()
        Description copied from class: IExplanation
        Recycle this explanation when it is not used anymore.
        Specified by:
        recycle in class IExplanation
      • learnSolution

        public void learnSolution​(DecisionPath path)
      • learnSignedClause

        public void learnSignedClause​(ContradictionException cex)
        From a given conflict, defined by cex and the current implication graph mIG, this method will compute the signed clause inferred from the conflict. A call to extractConstraint(Model, ClauseStore) will return the computed result.
        Parameters:
        cex - the conflict
      • addLiteral

        public void addLiteral​(IntVar var,
                               IntIterableRangeSet dom,
                               boolean pivot)
        Add a signed literal (vardom) to this explanation. This is achieved in three steps:
        1. signed binary resolution (where 'v' is the pivot variable):
                   (v ∈ A ∨ X), (v ∈ B ∨ Y) : (v ∈ (A∩B) ∨ X ∨ Y)
               
        2. simplification:
                       (v ∈ ∅ ∨ Z) : (Z)
                   
        3. join literals:
                       ((∀i v ∈ Ai) ∨ Z) : (v ∈ (∪i Ai) ∨ Z)
                   
        Parameters:
        var - signed literal variable
        dom - signed literal domain
        pivot - true if var is the pivot variable
      • getCardinality

        public int getCardinality()
        Returns:
        the number of literals in this explanation
      • getAssertingLevel

        public int getAssertingLevel()
        Returns:
        the decision to refute (ie, point to jump to wrt the current decision path).
      • getFreeSet

        public IntIterableRangeSet getFreeSet()
        Return an empty set available (created and returned) or create a new one
        Returns:
        a free set
      • getFreeSet

        public IntIterableRangeSet getFreeSet​(int val)
        Return an available set (created and returned) or create a new one then add 'val' to it.
        Returns:
        a free set
      • getFreeSet

        public IntIterableRangeSet getFreeSet​(int a,
                                              int b)
        Return an available set (created and returned) or create a new one then add range ['a','b'] to it.
        Returns:
        a free set
      • getSet

        public IntIterableRangeSet getSet​(int p)
        Parameters:
        p - position
        Returns:
        a set which contains a copy of the domain of the var at position p
      • getSet

        public IntIterableRangeSet getSet​(IntVar var)
        Parameters:
        var - a variable
        Returns:
        a set which contains a copy of the domain of var at its front position
      • getComplementSet

        public IntIterableRangeSet getComplementSet​(IntVar var)
        Parameters:
        var - a variable
        Returns:
        a set which contains a copy of the complement domain of var at its front position wrt to its root domain
      • getRootSet

        public IntIterableRangeSet getRootSet​(IntVar var)
        Parameters:
        var - a variable
        Returns:
        a set which contains a copy of the root domain of var