public class MDDStoreImpl extends Object implements MDDStore
The number of leaves is defined upon creation and can not be changed.
MDDs are stored in a large integer array, divided into blocs. Each bloc denotes a MDD node, providing its level and list of children, as well as the reference counter. To avoid duplication, a hashmap allows to find existing nodes quickly. New nodes are added by extending the storage array, but blocs can also be freed when unused. A chained list allows to reuse these free blocs.
for further details.| Modifier and Type | Field and Description |
|---|---|
protected MDDVariable[] |
variables |
| Constructor and Description |
|---|
MDDStoreImpl(Collection<?> keys,
int nbleaves)
Create a new MDDStore using the default capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean[] |
collectDecisionVariables(int node)
Collect variables on which a MDD depends.
|
void |
debug()
print raw data structure (hashcodes, hashitems and data blocs).
|
String |
dumpMDD(int mdd)
Write a raw text representation of the MDD
|
MDDVariable |
ensureVariable(Object key,
byte nbval)
get a variable, create it if needed.
|
void |
free(int pos)
Free a node.
|
MDDVariable[] |
getAllVariables()
Get all MDDVariables in this manager.
|
int |
getChild(int id,
int value)
Get a specific child for a node.
|
int[] |
getChildren(int node)
Get all the children of a given node.
|
int |
getLeafCount()
Get the number of leaves
|
MDDManager |
getManager(List<?> order)
Get a new manager for this MDD Store, using a custom variable order.
|
VariableEffect[] |
getMultivaluedVariableEffect(MDDVariable var,
int node)
Determine the effect of a given variable on a MDD.
|
int |
getNode(int var,
int[] children)
Retrieve or create a node in the backend.
|
int |
getNode(int var,
int lchild,
int rchild)
Retrieve or create a node in the backend.
|
int |
getNodeCount() |
MDDVariable |
getNodeVariable(int n)
Get the variable associated to a given node.
|
NodeRelation |
getRelation(int first,
int other)
Determine the relation between two nodes.
|
int |
getSign(int node,
MDDVariable pivot)
Infer the effect of a variable in a given MDD.
|
VariableEffect |
getVariableEffect(MDDVariable var,
int node)
Determine the effect of a given variable on a MDD.
|
MDDVariable |
getVariableForKey(Object key)
Get the MDDVariable associated to a given key.
|
int |
getVariableIndex(MDDVariable var)
Get the position of a given variable in this manager's list of variables.
|
byte |
groupReach(int node,
byte[] values)
Get the value reached by a group of paths.
|
byte |
groupReach(int node,
byte[] values,
int[] orderMap)
Find the leaf reached for a given group of variable assignment and custom order.
|
boolean |
isleaf(int id) |
boolean |
isView(MDDManager ddm) |
int |
mnot(int node,
int v)
Multi-valued not: flip leaves 0 and v.
|
int |
nodeFromState(byte[] state,
int value)
Create a MDD representing a state.
|
int |
nodeFromState(byte[] state,
int value,
int[] orderMap)
Helper to build a node from a state in proxy views.
|
int |
nodeFromStates(Collection<byte[]> states,
int value)
Create a MDD representing a group of states.
|
int |
not(int node)
Logical not, performed by flipping leaves 0 and 1.
|
int |
parseDump(String s)
Create a MDD from a dumped structure
|
void |
printNode(int node)
Debug helper: print a MDD on standard output.
|
byte |
reach(int node,
byte[] values)
Find the leaf reached for a given variable assignment
|
byte |
reach(int node,
byte[] values,
int[] orderMap)
Find the leaf reached for a given variable assignment and custom order.
|
int |
use(int node)
Mark a node as used.
|
protected MDDVariable[] variables
public MDDStoreImpl(Collection<?> keys, int nbleaves)
MDDManagerFactory, not directly.keys - the list of variables that can be used.nbleaves - the number of values that can be reached.public MDDManager getManager(List<?> order)
MDDManagergetManager in interface MDDManagerorder - requested variable order.this if the order is the same)public MDDVariable getNodeVariable(int n)
MDDManagergetNodeVariable in interface MDDManagern - the node IDpublic int getVariableIndex(MDDVariable var)
MDDManagergetVariableIndex in interface MDDManagergetAllVariables().public MDDVariable getVariableForKey(Object key)
MDDManagergetVariableForKey in interface MDDManagerpublic MDDVariable ensureVariable(Object key, byte nbval)
MDDManagerensureVariable in interface MDDManagerpublic MDDVariable[] getAllVariables()
MDDManagergetAllVariables in interface MDDManagerpublic int getNode(int var,
int lchild,
int rchild)
MDDStoreMDDVariable.getNode() or by
internal store methods: it should not be used directly.public int getNode(int var,
int[] children)
MDDStoreMDDVariable.getNode() or by
internal store methods: it should not be used directly.public int use(int node)
MDDManagerfree(int) when you release it.use in interface MDDManagerpublic void free(int pos)
MDDManager
This should be used for each node id that was obtained through one of the get_?node() method,
or for the one explicitly marked as used.
Note that the space will be made available for new nodes, but it will NOT be returned to the garbage collector.
free in interface MDDManageruse(int),
get_bnode(int, int, int),
get_mnode(int, int[])public int not(int node)
MDDManagernot in interface MDDManagerpublic int mnot(int node,
int v)
MDDManagermnot in interface MDDManagerv - the positive valuepublic NodeRelation getRelation(int first, int other)
MDDManagergetRelation in interface MDDManagerpublic int getNodeCount()
getNodeCount in interface MDDManagerpublic int getLeafCount()
MDDManagergetLeafCount in interface MDDManagerpublic boolean isleaf(int id)
isleaf in interface MDDManagerid - the ID of the tested node.public int getChild(int id,
int value)
MDDManagergetChild in interface MDDManagerid - id of a nodevalue - assignment valuepublic int[] getChildren(int node)
MDDManagergetChildren in interface MDDManagerpublic byte reach(int node,
byte[] values)
MDDManagerreach in interface MDDManagerpublic byte reach(int node,
byte[] values,
int[] orderMap)
MDDStorereach(int byte[])public byte groupReach(int node,
byte[] values)
MDDManagergroupReach in interface MDDManagerpublic byte groupReach(int node,
byte[] values,
int[] orderMap)
MDDStoregroupReach(int byte[])groupReach in interface MDDStorepublic int getSign(int node,
MDDVariable pivot)
MDDManagergetSign in interface MDDManagernode - the MDDpivot - the variable of interestpublic boolean[] collectDecisionVariables(int node)
MDDManagercollectDecisionVariables in interface MDDManagerpublic VariableEffect getVariableEffect(MDDVariable var, int node)
MDDManagergetVariableEffect in interface MDDManagerpublic VariableEffect[] getMultivaluedVariableEffect(MDDVariable var, int node)
MDDManagergetMultivaluedVariableEffect in interface MDDManagerpublic void printNode(int node)
node - the node indexpublic void debug()
public boolean isView(MDDManager ddm)
isView in interface MDDManagerpublic int nodeFromState(byte[] state,
int value)
MDDManagernodeFromState in interface MDDManagerpublic int nodeFromStates(Collection<byte[]> states, int value)
MDDManagernodeFromStates in interface MDDManagerpublic int nodeFromState(byte[] state,
int value,
int[] orderMap)
MDDStorenodeFromState in interface MDDStorepublic String dumpMDD(int mdd)
MDDManagerdumpMDD in interface MDDManagerpublic int parseDump(String s) throws ParseException
MDDManagerparseDump in interface MDDManagers - the string representing the MDD structureParseExceptionCopyright © 2009–2020. All rights reserved.