Module logicng

Class BDDTree


  • public class BDDTree
    extends Object
    A BDD tree used to represent nested variables blocks or variable reorderings.
    Since:
    2.0.0
    Version:
    2.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      BDDTree​(int id)
      Constructs a new BDD tree with the given id.
    • Field Detail

      • first

        protected int first
      • last

        protected int last
      • pos

        protected int pos
      • seq

        protected int[] seq
      • fixed

        protected boolean fixed
      • id

        protected final int id
      • nextlevel

        protected BDDTree nextlevel
    • Constructor Detail

      • BDDTree

        public BDDTree​(int id)
        Constructs a new BDD tree with the given id.
        Parameters:
        id - the id
    • Method Detail

      • addRange

        public static BDDTree addRange​(BDDTree tree,
                                       int first,
                                       int last,
                                       boolean fixed,
                                       int id,
                                       int[] level2var)
        Adds a new range in the tree.
        Parameters:
        tree - the tree in which the range should be added
        first - the start of the range
        last - the end of the range
        fixed - whether the range should be fixed or not
        id - the id of the tree
        level2var - the level to variable mapping
        Returns:
        the (possibly changed) BDD tree
      • getFirst

        public int getFirst()
        Returns the first variable of this block.
        Returns:
        the first variable of this block
      • setFirst

        public void setFirst​(int first)
        Sets the first variable of this block.
        Parameters:
        first - the first variable of this block
      • getLast

        public int getLast()
        Returns the last variable of this block.
        Returns:
        the last variable of this block
      • setLast

        public void setLast​(int last)
        Sets the last variable of this block.
        Parameters:
        last - the last variable of this block
      • getPos

        public int getPos()
        Returns the sifting position.
        Returns:
        the sifting position
      • setPos

        public void setPos​(int pos)
        Sets the sifting position.
        Parameters:
        pos - the sifting position
      • getSeq

        public int[] getSeq()
        Returns the sequence of variables between first and last in the current order.
        Returns:
        the sequence of variables
      • setSeq

        public void setSeq​(int[] seq)
        Sets the sequence of variables between first and last in the current order.
        Parameters:
        seq - the sequence of variables
      • isFixed

        public boolean isFixed()
        Returns whether this block is fixed or not.
        Returns:
        whether this block is fixed or not
      • setFixed

        public void setFixed​(boolean fixed)
        Sets whether this block is fixed or not.
        Parameters:
        fixed - whether this block is fixed or not
      • getId

        public int getId()
        Returns the id of this block.
        Returns:
        the id of this block
      • getNext

        public BDDTree getNext()
        Returns the next tree or null if no such tree exists.
        Returns:
        the next tree
      • setNext

        public void setNext​(BDDTree next)
        Sets the next tree.
        Parameters:
        next - the next tree
      • getPrev

        public BDDTree getPrev()
        Returns the previous tree or null if no such tree exists.
        Returns:
        the previous tree
      • setPrev

        public void setPrev​(BDDTree prev)
        Sets the previous tree.
        Parameters:
        prev - the previous tree
      • getNextlevel

        public BDDTree getNextlevel()
        Returns the tree of the next level or null if no such tree exists.
        Returns:
        the tree of the next level
      • setNextlevel

        public void setNextlevel​(BDDTree nextlevel)
        Sets the tree of the next level.
        Parameters:
        nextlevel - the tree of the next level
      • addRangeRec

        public static BDDTree addRangeRec​(BDDTree t,
                                          BDDTree prev,
                                          int first,
                                          int last,
                                          boolean fixed,
                                          int id,
                                          int[] level2var)
        Adds a new range in the tree.
        Parameters:
        t - the tree in which the range should be added
        prev - the predecessor if t is null
        first - the start of the range
        last - the end of the range
        fixed - whether the range should be fixed or not
        id - the id of the tree
        level2var - the level to variable mapping
        Returns:
        the (possibly changed) BDD tree
      • updateSeq

        protected void updateSeq​(int[] bddvar2level)