Module logicng

Interface DnnfSatSolver

  • All Known Implementing Classes:
    DnnfMiniSatStyleSolver

    public interface DnnfSatSolver
    Interface for a DNNF SAT Solver.
    Since:
    2.0.0
    Version:
    2.0.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(Formula formula)
      Adds a formula to the solver.
      boolean assertCdLiteral()
      Enqueues the literal which was computed by the latest backtracking, performs UP and return false if UP finds a contradiction, otherwise true.
      boolean atAssertionLevel()
      Returns true if the current decision level was previously selected as backtrack level.
      boolean decide​(int var, boolean phase)
      Performs a decision of the given variable to the given phase and performs UP.
      Literal litForIdx​(int var)
      Returns the literal corresponding to the given variable index.
      Formula newlyImplied​(BitSet knownVariables)
      Returns a conjunction of all literals in the known variables which were propagated by the last UP.
      boolean start()
      Initializes the solver by performing unit propagation and returns false if UP finds a contradiction, otherwise true.
      void undoDecide​(int var)
      Reverts the decision of the given variable.
      Tristate valueOf​(int lit)
      Returns the current assignment of the given literal.
      int variableIndex​(Literal lit)
      Returns the index of the variable of the given literal.
    • Method Detail

      • add

        void add​(Formula formula)
        Adds a formula to the solver. The formula is first converted to CNF.
        Parameters:
        formula - the formula
      • start

        boolean start()
        Initializes the solver by performing unit propagation and returns false if UP finds a contradiction, otherwise true.
        Returns:
        false if UP finds a contradiction, otherwise true
      • decide

        boolean decide​(int var,
                       boolean phase)
        Performs a decision of the given variable to the given phase and performs UP.
        Parameters:
        var - the variable
        phase - the phase
        Returns:
        false if UP finds a contradiction, otherwise true
      • undoDecide

        void undoDecide​(int var)
        Reverts the decision of the given variable.
        Parameters:
        var - the variable
      • atAssertionLevel

        boolean atAssertionLevel()
        Returns true if the current decision level was previously selected as backtrack level.
        Returns:
        true if the current decision level was previously selected as backtrack level, otherwise false
      • assertCdLiteral

        boolean assertCdLiteral()
        Enqueues the literal which was computed by the latest backtracking, performs UP and return false if UP finds a contradiction, otherwise true.
        Returns:
        false if UP finds a contradiction, otherwise true
      • newlyImplied

        Formula newlyImplied​(BitSet knownVariables)
        Returns a conjunction of all literals in the known variables which were propagated by the last UP.
        Parameters:
        knownVariables - the known variables
        Returns:
        a conjunction of the relevant propagated literals
      • variableIndex

        int variableIndex​(Literal lit)
        Returns the index of the variable of the given literal.
        Parameters:
        lit - the literal
        Returns:
        the index of the literal's variable
      • litForIdx

        Literal litForIdx​(int var)
        Returns the literal corresponding to the given variable index.
        Parameters:
        var - the variable index
        Returns:
        the literal corresponding to the given variable index
      • valueOf

        Tristate valueOf​(int lit)
        Returns the current assignment of the given literal.
        Parameters:
        lit - the literal
        Returns:
        the current assignment of the given literal