Module logicng

Class BDDOperations


  • public class BDDOperations
    extends Object
    A collection of operations on a BDD kernel.
    Since:
    2.0.0
    Version:
    2.4.0
    • Field Detail

      • allunsatProfile

        protected byte[] allunsatProfile
      • supportID

        protected int supportID
      • supportMax

        protected int supportMax
      • supportSet

        protected int[] supportSet
    • Constructor Detail

      • BDDOperations

        public BDDOperations​(BDDKernel k)
        Constructs a new object which will perform operations on the given kernel.
        Parameters:
        k - the kernel
    • Method Detail

      • satOne

        public int satOne​(int r)
        Finds one satisfying variable assignment and returns it as BDD.
        Parameters:
        r - the BDD root node
        Returns:
        the satisfying variable assignment of the BDD as a BDD itself
      • satOneSet

        public int satOneSet​(int r,
                             int var,
                             int pol)
        Returns an arbitrary model for a given BDD or null which contains at least the given variables. If a variable is a don't care variable, it will be assigned with the given default value.
        Parameters:
        r - the BDD root node
        var - the set of variable which has to be contained in the model as a BDD
        pol - the default value for don't care variables as a BDD
        Returns:
        an arbitrary model of this BDD
      • fullSatOne

        public int fullSatOne​(int r)
        Returns a full model in all variables for the given BDD.
        Parameters:
        r - the BDD root node
        Returns:
        a full model of this BDD
      • allSat

        public List<byte[]> allSat​(int r)
        Returns all models for a given BDD.
        Parameters:
        r - the BDD root node
        Returns:
        all models for the BDD
      • allSatRec

        protected void allSatRec​(int r,
                                 List<byte[]> models,
                                 byte[] allsatProfile)
      • satCount

        public BigInteger satCount​(int r)
        Returns the model count for the given BDD.
        Parameters:
        r - the BDD root node
        Returns:
        the model count for the BDD
      • satCountRec

        protected BigInteger satCountRec​(int root,
                                         int miscid)
      • pathCountOne

        public BigInteger pathCountOne​(int r)
        Returns the number of paths to the terminal node 'one'.
        Parameters:
        r - the BDD root node
        Returns:
        the number of paths to the terminal node 'one'
      • pathCountRecOne

        protected BigInteger pathCountRecOne​(int r,
                                             int miscid)
      • pathCountZero

        public BigInteger pathCountZero​(int r)
        Returns the number of paths to the terminal node 'zero'.
        Parameters:
        r - the BDD root node
        Returns:
        the number of paths to the terminal node 'zero'
      • pathCountRecZero

        protected BigInteger pathCountRecZero​(int r,
                                              int miscid)
      • allUnsat

        public List<byte[]> allUnsat​(int r)
        Returns all unsatisfiable assignments for a given BDD.
        Parameters:
        r - the BDD root node
        Returns:
        all unsatisfiable assignments for the BDD
      • allUnsatRec

        protected void allUnsatRec​(int r,
                                   List<byte[]> models)
      • support

        public int support​(int r)
        Returns all the variables that a given BDD depends on.
        Parameters:
        r - the BDD root node
        Returns:
        all the variables that the BDD depends on
      • supportRec

        protected void supportRec​(int r,
                                  int[] support)
      • nodeCount

        public int nodeCount​(int r)
        Returns the number of nodes for a given BDD.
        Parameters:
        r - the BDD root node
        Returns:
        the number of nodes for the BDD
      • varProfile

        public int[] varProfile​(int r)
        Returns how often each variable occurs in the given BDD.
        Parameters:
        r - the BDD root node
        Returns:
        how often each variable occurs in the BDD
      • varProfileRec

        protected void varProfileRec​(int r,
                                     int[] varprofile)
      • allNodes

        public List<int[]> allNodes​(int r)
        Returns all nodes for a given root node in their internal representation. The internal representation is stored in an array: [node number, variable, low, high]
        Parameters:
        r - the BDD root node
        Returns:
        all Nodes in their internal representation
      • toFormula

        public Formula toFormula​(int r,
                                 boolean followPathsToTrue)
        Returns a formula representation of this BDD. This is done by using the Shannon expansion. If followPathsToTrue is activated, the paths leading to the true terminal are followed to generate the formula. If followPathsToTrue is deactivated, the paths leading to the false terminal are followed to generate the formula and the resulting formula is negated. Depending on the formula and the number of satisfying assignments, the generated formula can be more compact using the true paths or false paths, respectively.
        Parameters:
        r - the BDD root node
        followPathsToTrue - the extraction style
        Returns:
        the formula
      • toFormulaRec

        protected Formula toFormulaRec​(int r,
                                       boolean followPathsToTrue)