- java.lang.Object
-
- org.logicng.knowledgecompilation.bdds.jbuddy.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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BDDTreeaddRange(BDDTree tree, int first, int last, boolean fixed, int id, int[] level2var)Adds a new range in the tree.static BDDTreeaddRangeRec(BDDTree t, BDDTree prev, int first, int last, boolean fixed, int id, int[] level2var)Adds a new range in the tree.intgetFirst()Returns the first variable of this block.intgetId()Returns the id of this block.intgetLast()Returns the last variable of this block.BDDTreegetNext()Returns the next tree ornullif no such tree exists.BDDTreegetNextlevel()Returns the tree of the next level ornullif no such tree exists.intgetPos()Returns the sifting position.BDDTreegetPrev()Returns the previous tree ornullif no such tree exists.int[]getSeq()Returns the sequence of variables betweenfirstandlastin the current order.booleanisFixed()Returns whether this block is fixed or not.voidsetFirst(int first)Sets the first variable of this block.voidsetFixed(boolean fixed)Sets whether this block is fixed or not.voidsetLast(int last)Sets the last variable of this block.voidsetNext(BDDTree next)Sets the next tree.voidsetNextlevel(BDDTree nextlevel)Sets the tree of the next level.voidsetPos(int pos)Sets the sifting position.voidsetPrev(BDDTree prev)Sets the previous tree.voidsetSeq(int[] seq)Sets the sequence of variables betweenfirstandlastin the current order.protected voidupdateSeq(int[] bddvar2level)
-
-
-
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 addedfirst- the start of the rangelast- the end of the rangefixed- whether the range should be fixed or notid- the id of the treelevel2var- 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 betweenfirstandlastin the current order.- Returns:
- the sequence of variables
-
setSeq
public void setSeq(int[] seq)
Sets the sequence of variables betweenfirstandlastin 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 ornullif 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 ornullif 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 ornullif 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 addedprev- the predecessor if t isnullfirst- the start of the rangelast- the end of the rangefixed- whether the range should be fixed or notid- the id of the treelevel2var- the level to variable mapping- Returns:
- the (possibly changed) BDD tree
-
updateSeq
protected void updateSeq(int[] bddvar2level)
-
-