CAL
3.0.0
An External Memory Decision Diagram Library
|
Core Manager of everything BDDs, variables, and more. More...
#include <calObj.hh>
Public Types | |
enum | ReorderTechnique { None = CAL_REORDER_NONE , Sift = CAL_REORDER_SIFT , Window = CAL_REORDER_WINDOW } |
The possible methods (algorithms) for variable reordering. More... | |
enum | ReorderMethod { BF = CAL_REORDER_METHOD_BF , DF = CAL_REORDER_METHOD_DF } |
The possible technique to be used to execute each method (c.f. Cal::ReorderTechnique ). More... | |
Public Member Functions | |
Cal () | |
Initialize a new BDD Manager. | |
Cal (unsigned int numVars) | |
Initialize a new BDD Manager with variables [1, numVars] . | |
Cal (const Cal &o)=delete | |
Cal (Cal &&o) | |
Move ownership of C object. | |
~Cal () | |
Clear memory of BDD Manager. More... | |
void | SetParameters (long reorderingThreshold, long maxForwardedNodes, double repackAfterGCThreshold, double tableRepackThreshold) |
Sets appropriate fields of BDD Manager. More... | |
unsigned long | Nodes () const |
The number of BDD nodes. More... | |
long | Vars () const |
The number of BDD variables. | |
bool | Overflow () const |
true if the node limit has been exceeded, false otherwise. More... | |
unsigned long | TotalSize () const |
The number of nodes in the Unique table. More... | |
void | Stats (FILE *fp=stdout) const |
Prints miscellaneous BDD statistics. | |
long | NodeLimit (long newLimit) |
Sets the node limit to newLimit and returns the previous limit. More... | |
void | SetGCMode (bool enableGC) |
Enable or Disable garbage collection. | |
void | SetGCLimit () |
Sets the limit of the garbage collection. More... | |
void | GC () |
Invokes the garbage collection at the manager level. More... | |
void | DynamicReordering (ReorderTechnique technique, ReorderMethod method=ReorderMethod::DF) |
Specify dynamic reordering technique and method. More... | |
void | Reorder () |
Invoke the current dynamic reodering method. More... | |
template<typename IT > | |
int | AssociationInit (IT begin, IT end, const bool pairs=false) |
Creates or finds a variable association. More... | |
int | AssociationSetCurrent (int i) |
Sets the current variable association to the one given. More... | |
void | AssociationQuit (int i) |
Deletes the variable association given by id. More... | |
template<typename IT > | |
void | TempAssociationInit (IT begin, const IT end, const bool pairs=false) |
Sets the temporary variable association. More... | |
template<typename IT > | |
void | TempAssociationAugment (IT begin, const IT end, const bool pairs=false) |
Adds to the temporary variable association. More... | |
void | TempAssociationQuit () |
Cleans up temporary association. More... | |
BDD | Null () const |
The NULL BDD. | |
BDD | One () const |
The BDD for the constant one. More... | |
BDD | Zero () const |
The BDD for the constant zero. More... | |
BDD | Id (Id_t id) const |
The variable with the specified id, null if no such variable exists. More... | |
BDD | Index (Index_t idx) const |
The variable with the specified index, null if no such variable exists. More... | |
BDD | CreateNewVarFirst () |
Create and obtain a new variable at the start of the variable order. | |
BDD | CreateNewVarLast () |
Create and obtain a new variable at the end of the variable order. | |
BDD | CreateNewVarBefore (const BDD &x) |
Create and obtain a new variable before the specified one in the variable order. | |
BDD | CreateNewVarAfter (const BDD &x) |
Create and obtain a new variable after the specified one in the variable order. | |
bool | IsNull (const BDD &f) const |
true if the given BDD is NULL, false otherwise. | |
bool | IsOne (const BDD &f) const |
true if the given BDD is constant one, false otherwise. More... | |
bool | IsZero (const BDD &f) const |
true if the given BDD is constant zero, false otherwise. More... | |
bool | IsConst (const BDD &f) const |
true if the given BDD is either constant one or constant zero, otherwise returns false . More... | |
bool | IsCube (const BDD &f) const |
true if the given BDD is a cube, false otherwise. | |
bool | IsEqual (const BDD &f, const BDD &g) const |
true if the two BDDs are equal, false otherwise. More... | |
bool | DependsOn (const BDD &f, const BDD &var) const |
true if the BDD f depends on var , false otherwise. More... | |
double | SatisfyingFraction (const BDD &f) |
Fraction of valuations which make this BDD true. More... | |
unsigned long | Size (const BDD &f, bool negout=true) |
This BDD's size. More... | |
template<typename IT > | |
unsigned long | Size (IT begin, IT end, bool negout=true) |
Similar to Cal::Size() for an iterator of BDDs. But, this accounts for sharing of nodes. More... | |
template<typename Container > | |
unsigned long | Size (Container c, bool negout=true) |
Similar to Cal::Size() for a container of BDDs. But, this accounts for sharing of nodes. More... | |
BDD | Identity (const BDD &f) |
Duplicate of given BDD. More... | |
BDD | Regular (const BDD &f) |
The given BDD in positive form (regardless of its phase). More... | |
BDD | Not (const BDD &f) |
Complement of the given BDD. | |
BDD | Compose (const BDD &f, const BDD &g, const BDD &h) |
Substitute a BDD variable by a function, i.e. f[h/g]. More... | |
BDD | Intersects (const BDD &f, const BDD &g) |
Computes a BDD that implies the conjunction of both BDDs. More... | |
BDD | Implies (const BDD &f, const BDD &g) |
Computes a BDD that implies the conjunction of f and g.Not() . More... | |
BDD | ITE (const BDD &f, const BDD &g, const BDD &h) |
Logical If-Then-Else. More... | |
BDD | And (const BDD &f, const BDD &g) |
Logical AND operation. More... | |
template<typename IT > | |
BDD | And (IT begin, IT end) |
Logical AND of iterator of BDD or int . More... | |
template<typename Container > | |
BDD | And (const Container &c) |
Logical AND of container with BDD s or int s. More... | |
BDD | Nand (const BDD &f, const BDD &g) |
Logical Negated AND operation. More... | |
BDD | Or (const BDD &f, const BDD &g) |
Logical OR operation. | |
template<typename IT > | |
BDD | Or (IT begin, IT end) |
Logical OR of iterator of BDD or int . More... | |
template<typename Container > | |
BDD | Or (const Container &c) |
Logical OR of container with BDD s or int s. More... | |
BDD | Nor (const BDD &f, const BDD &g) |
Logical Negated OR operation. More... | |
BDD | Xor (const BDD &f, const BDD &g) |
Logical XOR operation.w. | |
template<typename IT > | |
BDD | Xor (IT begin, IT end) |
Logical XOR of iterator of BDD or int . More... | |
template<typename Container > | |
BDD | Xor (const Container &c) |
Logical XOR of container with BDD s or int s. More... | |
BDD | Xnor (const BDD &f, const BDD &g) |
Logical Negated XOR operation. | |
template<typename IT > | |
std::vector< BDD > | PairwiseAnd (IT begin, IT end) |
Pairwise AND of BDD s or int s provided by an iterator. More... | |
template<typename Container > | |
std::vector< BDD > | PairwiseAnd (const Container &c) |
Pairwise AND of BDD s or int s within a container. More... | |
template<typename IT > | |
std::vector< BDD > | PairwiseOr (IT begin, IT end) |
Pairwise OR of BDD s or int s provided by an iterator. More... | |
template<typename Container > | |
std::vector< BDD > | PairwiseOr (const Container &c) |
Pairwise OR of BDD s or int s within a container. More... | |
template<typename IT > | |
std::vector< BDD > | PairwiseXor (IT begin, IT end) |
Pairwise XOR of BDD s or int s provided by an iterator. More... | |
template<typename Container > | |
std::vector< BDD > | PairwiseXor (const Container &c) |
Pairwise XOR of BDD s or int s within a container. More... | |
BDD | Satisfy (const BDD &f) |
A satisfying assignment of this BDD. More... | |
BDD | SatisfySupport (const BDD &f) |
Returns a special cube contained in this. More... | |
BDD | Substitute (const BDD &f) |
Substitute a set of variables by functions. More... | |
BDD | VarSubstitute (const BDD &f) |
BDD | SwapVars (const BDD &f, const BDD &g, const BDD &h) |
The function obtained by swapping two variables. More... | |
BDD | Exists (const BDD &f) |
Existentially quantification of some variables from the given BDD. More... | |
BDD | ForAll (const BDD &f) |
Universal quantification of some variables from the given BDD. More... | |
BDD | RelProd (const BDD &f, const BDD &g) |
Logical AND of the argument BDDs and existentially quantifying some variables from the product. More... | |
BDD | Cofactor (const BDD &f, const BDD &c) |
Generalized cofactor of f with respect to c . More... | |
BDD | Reduce (const BDD &f, const BDD &c) |
Function that agrees with f for all valuations that satisfy c . More... | |
BDD | Between (const BDD &fMin, const BDD &fMax) |
Function that contains fMin and is contained in fMax . More... | |
BDD | If (const BDD &f) const |
BDD corresponding to the top variable of the given BDD. More... | |
Id_t | IfId (const BDD &f) const |
Returns the id of the given BDD's top variable. More... | |
Index_t | IfIndex (const BDD &f) const |
Returns the index of this BDD's top variable. More... | |
BDD | Then (const BDD &f) |
The positive cofactor of the given BDD with respect to its top variable. More... | |
BDD | Else (const BDD &f) |
The negative cofactor of the given BDD with respect to its top variable. More... | |
void | Print (const BDD &f, FILE *fp=stdout) const |
Prints a BDD in the human readable form. More... | |
void | FunctionPrint (const BDD &f, std::string &name) const |
Prints the function implemented by the given BDD. More... | |
std::vector< long > | Profile (const BDD &f, bool negout=true) const |
Obtain a vector with the number of nodes at each level in f. More... | |
template<typename IT > | |
std::vector< long > | Profile (IT begin, IT end, bool negout=true) const |
Similar to Cal::Profile() for an iterator of BDDs. But, this accounts for sharing of nodes. More... | |
template<typename Container > | |
std::vector< long > | Profile (const Container &c, bool negout=true) const |
Similar to Cal::Profile() for a container of BDDs. But, this accounts for sharing of nodes. More... | |
void | PrintProfile (const BDD &f, int lineLength=79, FILE *fp=stdout) const |
Prints a BDD in the human readable form. More... | |
template<typename IT > | |
void | PrintProfile (IT begin, IT end, int lineLength=79, FILE *fp=stdout) const |
Similar to Cal::PrintProfile() for an iterator of BDDs. But, this accounts for sharing of nodes. More... | |
template<typename Container > | |
void | PrintProfile (const Container &c, int lineLength=79, FILE *fp=stdout) const |
Similar to Cal::PrintProfile for a container of BDDs. But, this accounts for sharing of nodes.AssociationSetCurrent. More... | |
std::vector< long > | FunctionProfile (const BDD &f) const |
The number of subfunctions of the given BDD which may be obtained by restricting variables with an index lower than n. More... | |
template<typename IT > | |
std::vector< long > | FunctionProfile (IT begin, IT end) const |
Similar to Cal::FunctionProfile for an iterator of BDDs. But, this accounts for sharing of nodes. More... | |
template<typename Container > | |
std::vector< long > | FunctionProfile (const Container &c) const |
Similar to Cal::FunctionProfile for a container of BDDs. But, this accounts for sharing of nodes. More... | |
void | PrintFunctionProfile (const BDD &f, int lineLength=79, FILE *fp=stdout) const |
Similar to Cal::PrintProfile() but displays a function profile for the given BDD. More... | |
template<typename IT > | |
void | PrintFunctionProfile (IT begin, IT end, int lineLength=79, FILE *fp=stdout) const |
Similar to Cal::PrintFunctionProfile for an iterator of BDDs. But, this accounts for sharing of nodes. More... | |
template<typename Container > | |
void | PrintFunctionProfile (const Container &c, int lineLength=79, FILE *fp=stdout) const |
Similar to Cal::PrintFunctionProfile for a container of BDDs. But, this accounts for sharing of nodes. More... | |
Core Manager of everything BDDs, variables, and more.
enum Cal::ReorderMethod |
The possible technique to be used to execute each method (c.f. Cal::ReorderTechnique
).
The possible methods (algorithms) for variable reordering.
|
inline |
Clear memory of BDD Manager.
If this object owns a Cal_BddManager
from the C API, then that one is properly reset and freed.
Logical AND operation.
|
inline |
Logical AND of container with BDD
s or int
s.
If the container is of int
s, the integers are converted into a BDD
with Cal::Id()
.
c | Container of BDDs or integers which supports begin() and end() iterators. |
|
inline |
Logical AND of iterator of BDD
or int
.
If IT::value_type
is int
then the integers are converted into a BDD
with Cal::Id()
.
begin | Iterator pointing to the start of the given range of BDDs or integers. |
end | Iterator pointing to the end of the given range. |
|
inline |
Creates or finds a variable association.
begin | Iterator pointing to the start of the given range. |
end | Iterator pointing to the end of the given range. |
pairs | If false , the array assumed to be an array of variables. If true , it is interpreted as consecutive pairs of variables (and hence it must be of even length). |
|
inline |
Deletes the variable association given by id.
Decrements the reference count of the variable association with identifier id, and frees it if the reference count becomes zero.
|
inline |
Sets the current variable association to the one given.
i | The id of the association to currently use. Set it to -1 if the temporary association should be used. |
Function that contains fMin
and is contained in fMax
.
Returns a minimal BDD f
which is contains fMin
and is contained in fMax
(fMin <= f <= fMax
). This operation is typically used in state space searches to simplify the representation for the set of states wich will be expanded at each step (‘Rk Rk-1’ <= f <= Rk`).
Generalized cofactor of f
with respect to c
.
Returns the generalized cofactor of f
with respect to BDD c
. The constrain operator given by Coudert et al (ICCAD90) is used to find the generalized cofactor.
Substitute a BDD variable by a function, i.e. f[h/g].
true
if the BDD f
depends on var
, false
otherwise.
|
inline |
Specify dynamic reordering technique and method.
The negative cofactor of the given BDD with respect to its top variable.
|
inline |
Prints the function implemented by the given BDD.
|
inline |
The number of subfunctions of the given BDD which may be obtained by restricting variables with an index lower than n.
The nth entry of the function profile array is the number of subfunctions of this which may be obtained by restricting the variables whose index is less than n. An entry of zero indicates that this is independent of the variable with the corresponding index.
|
inline |
Similar to Cal::FunctionProfile
for a container of BDDs. But, this accounts for sharing of nodes.
c | Container of BDDs which supports begin() and end() iterators. |
|
inline |
Similar to Cal::FunctionProfile
for an iterator of BDDs. But, this accounts for sharing of nodes.
begin | Iterator pointing to the start of the given range of BDDs. |
end | Iterator pointing to the end of the given range. |
|
inline |
Invokes the garbage collection at the manager level.
For each variable in the increasing id free nodes with reference count equal to zero freeing a node results in decrementing reference count of then and else nodes by one.
|
inline |
The variable with the specified id, null if no such variable exists.
Duplicate of given BDD.
BDD corresponding to the top variable of the given BDD.
|
inline |
Returns the id of the given BDD's top variable.
|
inline |
Returns the index of this BDD's top variable.
Computes a BDD that implies the conjunction of f
and g.Not()
.
|
inline |
The variable with the specified index, null if no such variable exists.
Computes a BDD that implies the conjunction of both BDDs.
|
inline |
true
if the given BDD is either constant one or constant zero, otherwise returns false
.
true
if the two BDDs are equal, false
otherwise.
|
inline |
true
if the given BDD is constant one, false
otherwise.
|
inline |
true
if the given BDD is constant zero, false
otherwise.
Logical If-Then-Else.
Logical Negated AND operation.
|
inline |
Sets the node limit to newLimit
and returns the previous limit.
|
inline |
The number of BDD nodes.
Logical Negated OR operation.
|
inline |
The BDD for the constant one.
|
inline |
|
inline |
|
inline |
true
if the node limit has been exceeded, false
otherwise.
|
inline |
Pairwise AND of BDD
s or int
s within a container.
If the container is of int
s, the integers are converted into a BDD
with Cal::Id()
.
c | Container of BDDs or integers which supports begin() and end() iterators. |
|
inline |
Pairwise AND of BDD
s or int
s provided by an iterator.
If IT::value_type
is int
then the integers are converted into a BDD
with Cal::Id()
.
begin | Iterator pointing to the start of the given range of BDDs or integers. |
end | Iterator pointing to the end of the given range. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Prints a BDD in the human readable form.
f | BDD to be printed. |
fp | Pointer to the FILE to output to (default stdout ). |
|
inline |
Similar to Cal::PrintProfile()
but displays a function profile for the given BDD.
f | BDD to be printed. |
lineLength | The maximum line length. |
fp | Pointer to the FILE to output to (default stdout ). |
|
inline |
Similar to Cal::PrintFunctionProfile
for a container of BDDs. But, this accounts for sharing of nodes.
c | Container of BDDs which supports begin() and end() iterators. |
lineLength | The maximum line length. |
fp | Pointer to the FILE to output to (default stdout ). |
|
inline |
Similar to Cal::PrintFunctionProfile
for an iterator of BDDs. But, this accounts for sharing of nodes.
begin | Iterator pointing to the start of the given range of BDDs. |
end | Iterator pointing to the end of the given range. |
lineLength | The maximum line length. |
fp | Pointer to the FILE to output to (default stdout ). |
|
inline |
|
inline |
Similar to Cal::PrintProfile
for a container of BDDs. But, this accounts for sharing of nodes.AssociationSetCurrent.
c | Container of BDDs which supports begin() and end() iterators. |
lineLength | The maximum line length. |
fp | Pointer to the FILE to output to (default stdout ). |
|
inline |
Similar to Cal::PrintProfile()
for an iterator of BDDs. But, this accounts for sharing of nodes.
begin | Iterator pointing to the start of the given range of BDDs. |
end | Iterator pointing to the end of the given range. |
lineLength | The maximum line length. |
fp | Pointer to the FILE to output to (default stdout ). |
|
inline |
Obtain a vector with the number of nodes at each level in f.
f | BDD of interest. |
negout | If false then counting pretends the BDD does not have negative-output pointers (complement edges). |
|
inline |
Similar to Cal::Profile()
for a container of BDDs. But, this accounts for sharing of nodes.
negout | If false then counting pretends the BDD does not have negative-output pointers (complement edges). |
c | Container of BDDs which supports begin() and end() iterators. |
|
inline |
Similar to Cal::Profile()
for an iterator of BDDs. But, this accounts for sharing of nodes.
begin | Iterator pointing to the start of the given range of BDDs. |
end | Iterator pointing to the end of the given range. |
negout | If false then counting pretends the BDD does not have negative-output pointers (complement edges). |
Function that agrees with f
for all valuations that satisfy c
.
The result is usually smaller in terms of number of BDD nodes than this. This operation is typically used in state space searches to simplify the representation for the set of states wich will be expanded at each step.
The given BDD in positive form (regardless of its phase).
Logical AND of the argument BDDs and existentially quantifying some variables from the product.
|
inline |
Invoke the current dynamic reodering method.
A satisfying assignment of this BDD.
Returns a BDD which implies this, true for some valuation on which f is true, and which has at most one node at each level.
|
inline |
Fraction of valuations which make this BDD true.
f
is supposed to be a function of. Returns a special cube contained in this.
Returns a BDD which implies this, true for some valuation on which f is true, and which has at most one node at each level.
|
inline |
Sets the limit of the garbage collection.
It tries to set the limit at twice the number of nodes in the manager at the current point. However, the limit is not allowed to fall below the MIN_GC_LIMIT
or to exceed the value of node limit (if one exists).
|
inline |
Sets appropriate fields of BDD Manager.
reorderingThreshold | The number of nodes below which reordering will NOT beinvoked. |
maxForwardedNodes | The maximum number of forwarded nodes which are allowed (at that point the cleanup must be done) |
repackAfterGCThreshold | The fraction of the page utilized that garbage collection has to achieve. |
tableRepackThreshold | The fraction of the page utilized below which repacking has to be invoked. |
|
inline |
|
inline |
Similar to Cal::Size()
for a container of BDDs. But, this accounts for sharing of nodes.
c | Container of BDDs which supports begin() and end() iterators. |
negout | If false then counting pretends the BDD does not have negative-output pointers (complement edges). |
|
inline |
Similar to Cal::Size()
for an iterator of BDDs. But, this accounts for sharing of nodes.
begin | Iterator pointing to the start of the set of BDDs. |
end | Iterator pointing to the end. |
negout | If false then counting pretends the BDD does not have negative-output pointers (complement edges). |
Substitute a set of variables by functions.
Returns a BDD for f
using the substitution defined by current variable association. Each variable is replaced by its associated BDDs. The substitution is effective simultaneously.
The function obtained by swapping two variables.
Returns the BDD obtained by simultaneously substituting variable g
by variable h
and variable h
and variable g
in f
.
|
inline |
Adds to the temporary variable association.
begin | Iterator pointing to the start of the given range. |
end | Iterator pointing to the end of the given range. |
pairs | Similar to Cal::AssociationInit() . |
|
inline |
Sets the temporary variable association.
begin | Iterator pointing to the start of the given range. |
end | Iterator pointing to the end of the given range. |
pairs | Similar to Cal::AssociationInit() . |
|
inline |
Cleans up temporary association.
The positive cofactor of the given BDD with respect to its top variable.
|
inline |
The number of nodes in the Unique table.
|
inline |
Logical XOR of container with BDD
s or int
s.
If the container is of int
s, the integers are converted into a BDD
with Cal::Id()
.
c | Container of BDDs or integers which supports begin() and end() iterators. |
|
inline |
Logical XOR of iterator of BDD
or int
.
If the container is of int
s, the integers are converted into a BDD
with Cal::Id()
.
begin | Iterator pointing to the start of the given range of BDDs or integers. |
end | Iterator pointing to the end of the given range. |
|
inline |
The BDD for the constant zero.