|
|||||||||
| Home >> All >> org >> sf >> [ javabdd overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.sf.javabdd
Class CUDDFactory

java.lang.Objectorg.sf.javabdd.BDDFactory
org.sf.javabdd.CUDDFactory
- public class CUDDFactory
- extends BDDFactory
An implementation of BDDFactory that relies on the CUDD library through a native interface. You can use this by calling the "CUDDFactory.init()" method with the desired arguments. This will return you an instance of the BDDFactory class that you can use. Call "done()" on that instance when you are finished.
CUDD does not have much of the functionality that BuDDy has, and it has not been well-tested. Furthermore, it is slower than BuDDy. Therefore, it is recommended that you use the BuDDy library instead.
This class (and the CUDD library) do NOT support multithreading. Furthermore, there can be only one instance active at a time. You can only call "init()" again after you have called "done()" on the original instance. It is not recommended to call "init()" again after calling "done()" unless you are _completely_ sure that all BDD objects that reference the old factory have been freed.
If you really need multiple BDD factories, consider using the JavaFactory class for the additional BDD factories --- JavaFactory can have multiple factory instances active at a time.
- Version:
- $Id: CUDDFactory.java,v 1.15 2003/11/01 05:15:40 joewhaley Exp $
| Nested Class Summary | |
(package private) static class |
CUDDFactory.CUDDBDD
|
(package private) static class |
CUDDFactory.CUDDBDDBitVector
|
(package private) static class |
CUDDFactory.CUDDBDDDomain
|
(package private) static class |
CUDDFactory.CUDDBDDPairing
|
| Nested classes inherited from class org.sf.javabdd.BDDFactory |
BDDFactory.BDDOp, BDDFactory.ReorderMethod |
| Field Summary | |
private static CUDDFactory |
INSTANCE
|
private static long |
one
|
private static long |
zero
|
| Fields inherited from class org.sf.javabdd.BDDFactory |
and, biimp, diff, domain, fdvarnum, firstbddvar, imp, invimp, less, nand, nor, or, REORDER_NONE, REORDER_RANDOM, REORDER_SIFT, REORDER_SIFTITE, REORDER_WIN2, REORDER_WIN2ITE, REORDER_WIN3, REORDER_WIN3ITE, xor |
| Constructor Summary | |
private |
CUDDFactory()
|
| Method Summary | |
void |
addVarBlock(BDD var,
boolean fixed)
Adds a new variable block for reordering. |
void |
addVarBlock(int first,
int last,
boolean fixed)
Adds a new variable block for reordering. |
void |
autoReorder(BDDFactory.ReorderMethod method)
Enables automatic reordering. |
void |
autoReorder(BDDFactory.ReorderMethod method,
int max)
Enables automatic reordering with the given (maximum) number of reorderings. |
void |
clearVarBlocks()
Clears all the variable blocks that have been defined by calls to addVarBlock. |
protected BDDBitVector |
createBitVector(int a)
|
protected BDDDomain |
createDomain(int a,
long b)
Implementors must implement this factory method to create BDDDomain objects of the correct type. |
void |
disableReorder()
Disable automatic reordering until enableReorder is called. |
void |
done()
Resets the BDD package. |
private static void |
done0()
|
void |
enableReorder()
Enable automatic reordering after a call to disableReorder. |
int |
getAllocNum()
Get the number of allocated nodes. |
int |
getNodeNum()
Get the number of active nodes in use. |
BDDFactory.ReorderMethod |
getReorderMethod()
Returns the current reorder method as defined by autoReorder. |
int |
getReorderTimes()
Returns the number of allowed reorderings left. |
static BDDFactory |
init(int nodenum,
int cachesize)
Initializes a BDD factory with the given initial node table size and operation cache size. |
protected void |
initialize(int nodenum,
int cachesize)
Compare to bdd_init. |
private static void |
initialize0(int nodenum,
int cachesize)
|
boolean |
isInitialized()
Compare to bdd_isrunning. |
private static boolean |
isInitialized0()
|
BDD |
ithVar(int var)
Returns a BDD representing the I'th variable. |
private static long |
ithVar0(int var)
|
int |
level2Var(int level)
Compare to bdd_level2var. |
private static int |
level2Var0(int level)
|
BDD |
load(java.lang.String filename)
Loads a BDD from a file. |
static void |
main(java.lang.String[] args)
|
BDDPairing |
makePair()
Compare to bdd_newpair. |
BDD |
nithVar(int var)
Returns a BDD representing the negation of the I'th variable. |
int |
nodeCount(java.util.Collection r)
Counts the number of shared nodes in a collection of BDDs. |
BDD |
one()
Get the constant true BDD. |
void |
printAll()
Prints all used entries in the node table. |
void |
printOrder()
Prints an indented list of the variable blocks. |
void |
printStat()
Print cache statistics. |
void |
printTable(BDD b)
Prints the node table entries used by a BDD. |
private static void |
registerNatives()
|
void |
reorder(BDDFactory.ReorderMethod m)
Compare to bdd_reorder. |
int |
reorderGain()
Calculate the gain in size after a reordering. |
int |
reorderVerbose(int v)
Enables verbose information about reordering. |
void |
save(java.lang.String filename,
BDD var)
Saves a BDD to a file. |
int |
setCacheRatio(int x)
Sets the cache ratio for the operator caches. |
int |
setMaxIncrease(int x)
Set maximum number of nodes used to increase node table. |
int |
setMaxNodeNum(int size)
Set the maximum available number of BDD nodes. |
void |
setMinFreeNodes(int x)
Set minimum number of nodes to be reclaimed after a garbage collection. |
int |
setVarNum(int num)
Set the number of used BDD variables. |
private static int |
setVarNum0(int num)
|
void |
setVarOrder(int[] neworder)
This function sets the current variable order to be the one defined by neworder. |
private static void |
setVarOrder0(int[] neworder)
|
void |
swapVar(int v1,
int v2)
Compare to bdd_swapvar. |
int |
var2Level(int var)
Compare to bdd_var2level. |
private static int |
var2Level0(int var)
|
void |
varBlockAll()
Add a variable block for all variables. |
int |
varNum()
Returns the number of defined variables. |
private static int |
varNum0()
|
BDD |
zero()
Get the constant false BDD. |
| Methods inherited from class org.sf.javabdd.BDDFactory |
buildCube, buildCube, buildVector, buildVector, buildVector, buildVector, clearAllDomains, constantVector, constantVector, extDomain, extDomain, extVarNum, fillInVarIndices, finalize, getDomain, init, makePair, makePair, makePair, makeSet, makeSet, makeVarOrdering, numberOfDomains, overlapDomain |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
INSTANCE
private static CUDDFactory INSTANCE
zero
private static long zero
one
private static long one
| Constructor Detail |
CUDDFactory
private CUDDFactory()
| Method Detail |
init
public static BDDFactory init(int nodenum, int cachesize)
- Description copied from class:
BDDFactory - Initializes a BDD factory with the given initial node table size
and operation cache size. Tries to use the "buddy" native library;
if it fails, it falls back to the "java" library.
registerNatives
private static void registerNatives()
zero
public BDD zero()
- Description copied from class:
BDDFactory - Get the constant false BDD.
Compare to bdd_false.
- Specified by:
zeroin classBDDFactory
one
public BDD one()
- Description copied from class:
BDDFactory - Get the constant true BDD.
Compare to bdd_true.
- Specified by:
onein classBDDFactory
initialize
protected void initialize(int nodenum,
int cachesize)
- Description copied from class:
BDDFactory - Compare to bdd_init.
- Specified by:
initializein classBDDFactory
initialize0
private static void initialize0(int nodenum,
int cachesize)
isInitialized
public boolean isInitialized()
- Description copied from class:
BDDFactory - Compare to bdd_isrunning.
- Specified by:
isInitializedin classBDDFactory
isInitialized0
private static boolean isInitialized0()
done
public void done()
- Description copied from class:
BDDFactory - Resets the BDD package. This function frees all memory used by the BDD
package and resets the package to its initial state.
Compare to bdd_done.
- Specified by:
donein classBDDFactory
done0
private static void done0()
setMaxNodeNum
public int setMaxNodeNum(int size)
- Description copied from class:
BDDFactory - Set the maximum available number of BDD nodes.
Compare to bdd_setmaxnodenum.
- Specified by:
setMaxNodeNumin classBDDFactory
setMinFreeNodes
public void setMinFreeNodes(int x)
- Description copied from class:
BDDFactory - Set minimum number of nodes to be reclaimed after a garbage collection.
The range of x is 0..100. The default is 20.
Compare to bdd_setminfreenodes.
- Specified by:
setMinFreeNodesin classBDDFactory
setMaxIncrease
public int setMaxIncrease(int x)
- Description copied from class:
BDDFactory - Set maximum number of nodes used to increase node table.
Compare to bdd_setmaxincrease.
- Specified by:
setMaxIncreasein classBDDFactory
setCacheRatio
public int setCacheRatio(int x)
- Description copied from class:
BDDFactory - Sets the cache ratio for the operator caches.
Compare to bdd_setcacheratio.
- Specified by:
setCacheRatioin classBDDFactory
varNum
public int varNum()
- Description copied from class:
BDDFactory - Returns the number of defined variables.
Compare to bdd_varnum.
- Specified by:
varNumin classBDDFactory
varNum0
private static int varNum0()
setVarNum
public int setVarNum(int num)
- Description copied from class:
BDDFactory - Set the number of used BDD variables. It can be called more than one
time, but only to increase the number of variables.
Compare to bdd_setvarnum.
- Specified by:
setVarNumin classBDDFactory
setVarNum0
private static int setVarNum0(int num)
ithVar
public BDD ithVar(int var)
- Description copied from class:
BDDFactory - Returns a BDD representing the I'th variable. (One node with the
children true and false). The requested variable must be in the
(zero-indexed) range defined by setVarNum.
Compare to bdd_ithvar.
- Specified by:
ithVarin classBDDFactory
ithVar0
private static long ithVar0(int var)
nithVar
public BDD nithVar(int var)
- Description copied from class:
BDDFactory - Returns a BDD representing the negation of the I'th variable. (One node
with the children false and true). The requested variable must be in the
(zero- indexed) range defined by setVarNum.
Compare to bdd_nithvar.
- Specified by:
nithVarin classBDDFactory
swapVar
public void swapVar(int v1,
int v2)
- Description copied from class:
BDDFactory - Compare to bdd_swapvar.
- Specified by:
swapVarin classBDDFactory
makePair
public BDDPairing makePair()
- Description copied from class:
BDDFactory - Compare to bdd_newpair.
- Specified by:
makePairin classBDDFactory
printAll
public void printAll()
- Description copied from class:
BDDFactory - Prints all used entries in the node table.
Compare to bdd_printall.
- Specified by:
printAllin classBDDFactory
printTable
public void printTable(BDD b)
- Description copied from class:
BDDFactory - Prints the node table entries used by a BDD.
Compare to bdd_printtable.
- Specified by:
printTablein classBDDFactory
load
public BDD load(java.lang.String filename)
- Description copied from class:
BDDFactory - Loads a BDD from a file.
Compare to bdd_load.
- Specified by:
loadin classBDDFactory
save
public void save(java.lang.String filename, BDD var)
- Description copied from class:
BDDFactory - Saves a BDD to a file.
Compare to bdd_save.
- Specified by:
savein classBDDFactory
level2Var
public int level2Var(int level)
- Description copied from class:
BDDFactory - Compare to bdd_level2var.
- Specified by:
level2Varin classBDDFactory
level2Var0
private static int level2Var0(int level)
var2Level
public int var2Level(int var)
- Description copied from class:
BDDFactory - Compare to bdd_var2level.
- Specified by:
var2Levelin classBDDFactory
var2Level0
private static int var2Level0(int var)
reorder
public void reorder(BDDFactory.ReorderMethod m)
- Description copied from class:
BDDFactory - Compare to bdd_reorder.
- Specified by:
reorderin classBDDFactory
autoReorder
public void autoReorder(BDDFactory.ReorderMethod method)
- Description copied from class:
BDDFactory - Enables automatic reordering. If method is REORDER_NONE then automatic
reordering is disabled.
Compare to bdd_autoreorder.
- Specified by:
autoReorderin classBDDFactory
autoReorder
public void autoReorder(BDDFactory.ReorderMethod method, int max)
- Description copied from class:
BDDFactory - Enables automatic reordering with the given (maximum) number of
reorderings. If method is REORDER_NONE then automatic reordering is
disabled.
Compare to bdd_autoreorder_times.
- Specified by:
autoReorderin classBDDFactory
getReorderMethod
public BDDFactory.ReorderMethod getReorderMethod()
- Description copied from class:
BDDFactory - Returns the current reorder method as defined by autoReorder.
Compare to bdd_getreorder_method.
- Specified by:
getReorderMethodin classBDDFactory
getReorderTimes
public int getReorderTimes()
- Description copied from class:
BDDFactory - Returns the number of allowed reorderings left. This value can be
defined by autoReorder.
Compare to bdd_getreorder_times.
- Specified by:
getReorderTimesin classBDDFactory
disableReorder
public void disableReorder()
- Description copied from class:
BDDFactory - Disable automatic reordering until enableReorder is called. Reordering
is enabled by default as soon as any variable blocks have been defined.
Compare to bdd_disable_reorder.
- Specified by:
disableReorderin classBDDFactory
enableReorder
public void enableReorder()
- Description copied from class:
BDDFactory - Enable automatic reordering after a call to disableReorder.
Compare to bdd_enable_reorder
- Specified by:
enableReorderin classBDDFactory
reorderVerbose
public int reorderVerbose(int v)
- Description copied from class:
BDDFactory - Enables verbose information about reordering. A value of zero means no
information, one means some information and greater than one means lots
of information.
- Specified by:
reorderVerbosein classBDDFactory
setVarOrder
public void setVarOrder(int[] neworder)
- Description copied from class:
BDDFactory - This function sets the current variable order to be the one defined by
neworder. The variable parameter neworder is interpreted as a sequence
of variable indices and the new variable order is exactly this sequence.
The array must contain all the variables defined so far. If, for
instance the current number of variables is 3 and neworder contains
[1; 0; 2] then the new variable order is v1
- Specified by:
setVarOrderin classBDDFactory
setVarOrder0
private static void setVarOrder0(int[] neworder)
addVarBlock
public void addVarBlock(BDD var, boolean fixed)
- Description copied from class:
BDDFactory - Adds a new variable block for reordering.
Creates a new variable block with the variables in the variable set var.
The variables in var must be contiguous.
The fixed parameter sets the block to be fixed (no reordering of its
child blocks is allowed) or free,
Compare to bdd_addvarblock.
- Specified by:
addVarBlockin classBDDFactory
addVarBlock
public void addVarBlock(int first,
int last,
boolean fixed)
- Description copied from class:
BDDFactory - Adds a new variable block for reordering.
Creates a new variable block with the variables numbered first through
last, inclusive.
The fixed parameter sets the block to be fixed (no reordering of its
child blocks is allowed) or free,
Compare to bdd_intaddvarblock.
- Specified by:
addVarBlockin classBDDFactory
varBlockAll
public void varBlockAll()
- Description copied from class:
BDDFactory - Add a variable block for all variables.
Adds a variable block for all BDD variables declared so far. Each block
contains one variable only. More variable blocks can be added later with
the use of addVarBlock -- in this case the tree of variable blocks will
have the blocks of single variables as the leafs.
Compare to bdd_varblockall.
- Specified by:
varBlockAllin classBDDFactory
clearVarBlocks
public void clearVarBlocks()
- Description copied from class:
BDDFactory - Clears all the variable blocks that have been defined by calls to
addVarBlock.
Compare to bdd_clrvarblocks.
- Specified by:
clearVarBlocksin classBDDFactory
printOrder
public void printOrder()
- Description copied from class:
BDDFactory - Prints an indented list of the variable blocks.
Compare to bdd_printorder.
- Specified by:
printOrderin classBDDFactory
nodeCount
public int nodeCount(java.util.Collection r)
- Description copied from class:
BDDFactory - Counts the number of shared nodes in a collection of BDDs. Counts all
distinct nodes that are used in the BDDs -- if a node is used in more
than one BDD then it only counts once.
Compare to bdd_anodecount.
- Specified by:
nodeCountin classBDDFactory
getAllocNum
public int getAllocNum()
- Description copied from class:
BDDFactory - Get the number of allocated nodes. This includes both dead and active
nodes.
Compare to bdd_getallocnum.
- Specified by:
getAllocNumin classBDDFactory
getNodeNum
public int getNodeNum()
- Description copied from class:
BDDFactory - Get the number of active nodes in use. Note that dead nodes that have
not been reclaimed yet by a garbage collection are counted as active.
Compare to bdd_getnodenum
- Specified by:
getNodeNumin classBDDFactory
reorderGain
public int reorderGain()
- Description copied from class:
BDDFactory - Calculate the gain in size after a reordering. The value returned is
(100*(A-B))/A, where A is previous number of used nodes and B is current
number of used nodes.
Compare to bdd_reorder_gain.
- Specified by:
reorderGainin classBDDFactory
printStat
public void printStat()
- Description copied from class:
BDDFactory - Print cache statistics.
Compare to bdd_printstat.
- Specified by:
printStatin classBDDFactory
createDomain
protected BDDDomain createDomain(int a, long b)
- Description copied from class:
BDDFactory - Implementors must implement this factory method to create BDDDomain
objects of the correct type.
- Specified by:
createDomainin classBDDFactory
createBitVector
protected BDDBitVector createBitVector(int a)
- Specified by:
createBitVectorin classBDDFactory
main
public static void main(java.lang.String[] args)
|
|||||||||
| Home >> All >> org >> sf >> [ javabdd overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC