95 Cal_BddManager _bddManager;
110 BDD(Cal_BddManager bddManager, Cal_Bdd bdd)
111 : _bddManager(bddManager), _bdd(bdd)
126 : _bddManager(other._bddManager), _bdd(other._bdd)
138 this->_bdd = other._bdd;
139 this->_bddManager = other._bddManager;
150 : _bddManager(other._bddManager), _bdd(other._bdd)
162 this->_bdd = other._bdd;
163 this->_bddManager = other._bddManager;
202 {
return BDD::IsNull(this->_bddManager, this->_bdd); }
223 {
return Cal_BddIsEqual(this->_bddManager, this->_bdd, other._bdd); }
239 {
return !(*
this == other); }
257 {
return BDD(this->_bddManager,
Cal_BddIf(this->_bddManager, this->_bdd)); }
280 {
return BDD(this->_bddManager,
Cal_BddThen(this->_bddManager, this->_bdd)); }
286 {
return BDD(this->_bddManager,
Cal_BddElse(this->_bddManager, this->_bdd)); }
323 unsigned long Size(
bool negout =
true)
const
324 {
return Cal_BddSize(this->_bddManager, this->_bdd, negout); }
358 BDD::UnFree(res._bddManager, res._bdd);
366 {
return BDD(this->_bddManager,
Cal_BddNot(this->_bddManager, this->_bdd)); }
372 {
return this->
Not(); }
382 {
return BDD(this->_bddManager,
Cal_BddCompose(this->_bddManager, this->_bdd, g._bdd, h._bdd)); }
398 {
return BDD(this->_bddManager,
Cal_BddImplies(this->_bddManager, this->_bdd, g._bdd)); }
410 {
return BDD(this->_bddManager,
Cal_BddITE(this->_bddManager, this->_bdd, g._bdd, h._bdd)); }
416 {
return BDD(this->_bddManager,
Cal_BddAnd(this->_bddManager, this->_bdd, g._bdd)); }
422 {
return this->
And(other); }
428 {
return (*
this = (*
this) & other); }
434 {
return BDD(this->_bddManager,
Cal_BddNand(this->_bddManager, this->_bdd, g._bdd)); }
440 {
return BDD(this->_bddManager,
Cal_BddOr(this->_bddManager, this->_bdd, g._bdd)); }
446 {
return this->
Or(other); }
452 {
return (*
this = (*
this) | other); }
458 {
return BDD(this->_bddManager,
Cal_BddNor(this->_bddManager, this->_bdd, g._bdd)); }
464 {
return BDD(this->_bddManager,
Cal_BddXor(this->_bddManager, this->_bdd, g._bdd)); }
470 {
return this->
Xor(other); }
476 {
return (*
this = (*
this) ^ other); }
482 {
return BDD(this->_bddManager,
Cal_BddXnor(this->_bddManager, this->_bdd, g._bdd)); }
488 {
return *
this & ~g; }
494 {
return this->
Diff(other); }
500 {
return (*
this = (*
this) - other); }
509 {
return BDD(this->_bddManager,
Cal_BddSatisfy(this->_bddManager, this->_bdd)); }
531 {
return BDD(this->_bddManager,
Cal_BddSwapVars(this->_bddManager, this->_bdd, g._bdd, h._bdd)); }
554 {
return BDD(this->_bddManager,
Cal_BddCofactor(this->_bddManager, this->_bdd, c._bdd)); }
568 {
return BDD(this->_bddManager,
Cal_BddReduce(this->_bddManager, this->_bdd, c._bdd)); }
598 std::vector<long>
Profile(
bool negout =
true)
const
600 std::vector<long> results;
602 Cal_BddProfile(this->_bddManager, this->_bdd, results.data(), negout);
632 std::vector<long> results;
668 CalBddNode_t *internal_node = CAL_BDD_POINTER(this->_bdd);
671 CalBddNodeGetRefCount(internal_node, res);
681 if (this->
IsNull()) {
return "NULL"; }
682 if (this->
IsZero()) {
return "(0)"; }
683 if (this->
IsOne()) {
return "(1)"; }
685 std::stringstream ss;
687 << this->
Id() <<
", "
688 << this->
Then()._bdd <<
", "
708 template<
typename IT>
709 static std::vector<Cal_Bdd>
710 C_Bdd_vector(Cal_BddManager bddManager, IT begin, IT end)
714 std::vector<Cal_Bdd> out;
715 out.reserve(std::distance(begin, end));
717 while (begin != end) {
718 const typename IT::value_type &x = *(begin++);
720 if constexpr (std::is_same_v<typename IT::value_type, BDD>) {
723 BDD::UnFree(x._bddManager, x._bdd);
724 out.push_back(x._bdd);
725 }
else if constexpr (std::is_same_v<typename IT::value_type, int>) {
739 static std::vector<BDD>
740 From_C_Array(Cal_BddManager bddManager, Cal_Bdd * bddArray)
742 std::vector<BDD> res;
745 if (CalBddPreProcessing(bddManager, 1, bddArray[i]) == 0){
746 return std::vector<BDD>();
748 res.push_back(
BDD(bddManager, bddArray[i]));
766 IsNull(Cal_BddManager bddManager, Cal_Bdd f)
771 Free(Cal_BddManager bddManager, Cal_Bdd f)
777 { BDD::Free(this->_bddManager, this->_bdd); }
780 template<
typename IT>
782 Free(IT begin, IT end)
784 static_assert(std::is_same_v<typename IT::value_type, BDD>,
785 "Must be called with iterator for BDD");
787 while (begin != end) (begin++)->Free();
791 template<
typename IT>
793 Free(Cal_BddManager bddManager, IT begin, IT end)
795 static_assert(std::is_same_v<typename IT::value_type, Cal_Bdd>,
796 "Must be called with iterator for Cal_Bdd");
798 while (begin != end) BDD::Free(bddManager, *(begin++));
803 UnFree(Cal_BddManager bddManager, Cal_Bdd f)
809 { BDD::UnFree(this->_bddManager, this->_bdd); }
862 Cal_BddManager _bddManager;
882 for (Id_t i = 0; i < numVars; ++i) {
889 Cal(
const Cal &o) =
delete;
895 : _bddManager(o._bddManager)
897 o._bddManager =
nullptr;
908 if (this->_bddManager)
931 long maxForwardedNodes,
932 double repackAfterGCThreshold,
933 double tableRepackThreshold)
938 repackAfterGCThreshold,
939 tableRepackThreshold);
1033 None = CAL_REORDER_NONE,
1034 Sift = CAL_REORDER_SIFT,
1035 Window = CAL_REORDER_WINDOW
1045 BF = CAL_REORDER_METHOD_BF,
1046 DF = CAL_REORDER_METHOD_DF
1093 template<
typename IT>
1096 std::vector<Cal_Bdd> c_arg =
1097 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1101 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1142 template<
typename IT>
1145 std::vector<Cal_Bdd> c_arg =
1146 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1150 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1164 template<
typename IT>
1167 std::vector<Cal_Bdd> c_arg =
1168 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1172 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1196 {
return BDD(this->_bddManager,
Cal_BddNull(this->_bddManager)); }
1204 {
return BDD(this->_bddManager,
Cal_BddOne(this->_bddManager)); }
1212 {
return BDD(this->_bddManager,
Cal_BddZero(this->_bddManager)); }
1272 {
return f.
IsOne(); }
1333 unsigned long Size(
const BDD &f,
bool negout =
true)
1334 {
return f.
Size(negout); }
1347 template<
typename IT>
1348 unsigned long Size(IT begin, IT end,
bool negout =
true)
1350 static_assert(std::is_same_v<typename IT::value_type, BDD>,
1351 "Must be called with iterator for BDD");
1353 std::vector<Cal_Bdd> c_arg =
1354 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1358 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1372 template<
typename Container>
1373 unsigned long Size(Container c,
bool negout =
true)
1374 {
return Size(std::begin(c), std::end(c), negout); }
1435 {
return f.
ITE(g, h); }
1443 {
return f.
And(g); }
1458 template<
typename IT>
1461 std::vector<Cal_Bdd> c_arg =
1462 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1466 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1482 template<
typename Container>
1484 {
return And(std::begin(c), std::end(c)); }
1492 {
return f.
Nand(g); }
1513 template<
typename IT>
1516 std::vector<Cal_Bdd> c_arg =
1517 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1521 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1537 template<
typename Container>
1539 {
return Or(std::begin(c), std::end(c)); }
1547 {
return f.
Nor(g); }
1553 {
return f.
Xor(g); }
1568 template<
typename IT>
1571 std::vector<Cal_Bdd> c_arg =
1572 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1576 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1592 template<
typename Container>
1594 {
return Xor(std::begin(c), std::end(c)); }
1600 {
return f.
Xnor(g); }
1615 template<
typename IT>
1619 std::vector<Cal_Bdd> c_arg =
1620 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1622 std::vector<BDD> res =
1623 BDD::From_C_Array(this->_bddManager,
Cal_BddPairwiseAnd(this->_bddManager, c_arg.data()));
1625 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1641 template<
typename Container>
1644 {
return PairwiseAnd(std::begin(c), std::end(c)); }
1659 template<
typename IT>
1663 std::vector<Cal_Bdd> c_arg =
1664 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1666 std::vector<BDD> res =
1667 BDD::From_C_Array(this->_bddManager,
Cal_BddPairwiseOr(this->_bddManager, c_arg.data()));
1669 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1685 template<
typename Container>
1688 {
return PairwiseOr(std::begin(c), std::end(c)); }
1696 template<
typename IT>
1700 std::vector<Cal_Bdd> c_arg =
1701 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1703 std::vector<BDD> res =
1704 BDD::From_C_Array(this->_bddManager,
Cal_BddPairwiseXor(this->_bddManager, c_arg.data()));
1706 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1720 template<
typename Container>
1723 {
return PairwiseXor(std::begin(c), std::end(c)); }
1770 BDD VarSubstitute(
const BDD &f)
1794 {
return BDD(this->_bddManager,
Cal_BddExists(this->_bddManager, f._bdd)); }
1806 {
return BDD(this->_bddManager,
Cal_BddForAll(this->_bddManager, f._bdd)); }
1818 {
return BDD(this->_bddManager,
Cal_BddRelProd(this->_bddManager, f._bdd, g._bdd)); }
1856 {
return BDD(this->_bddManager,
Cal_BddBetween(this->_bddManager, fMin._bdd, fMax._bdd)); }
1883 {
return f.
Index(); }
1892 {
return f.
Then(); }
1901 {
return f.
Else(); }
1936 std::vector<long>
Profile(
const BDD &f,
bool negout =
true)
const
1952 template<
typename IT>
1953 std::vector<long>
Profile(IT begin, IT end,
bool negout =
true)
const
1955 std::vector<Cal_Bdd> c_arg =
1956 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
1958 std::vector<long> levelCounts;
1959 levelCounts.reserve(this->
Vars()+1);
1966 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
1982 template<
typename Container>
1983 std::vector<long>
Profile(
const Container &c,
bool negout =
true)
const
1984 {
return Profile(c.begin(), c.end(), negout); }
2010 template<
typename IT>
2012 int lineLength = 79,
2013 FILE *fp = stdout)
const
2015 std::vector<Cal_Bdd> c_arg =
2016 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
2023 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
2036 template<
typename Container>
2038 int lineLength = 79,
2039 FILE *fp = stdout)
const
2063 template<
typename IT>
2066 std::vector<Cal_Bdd> c_arg =
2067 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
2069 std::vector<long> funcCounts;
2070 funcCounts.reserve(
Vars()+1);
2074 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
2087 template<
typename Container>
2104 int lineLength = 79,
2105 FILE *fp = stdout)
const
2123 template<
typename IT>
2125 int lineLength = 79,
2126 FILE *fp = stdout)
const
2128 std::vector<Cal_Bdd> c_arg =
2129 BDD::C_Bdd_vector(this->_bddManager, std::move(begin), std::move(end));
2136 BDD::Free(this->_bddManager, c_arg.begin(), c_arg.end());
2151 template<
typename Container>
2153 int lineLength = 79,
2154 FILE *fp = stdout)
const
C++ wrapper for Cal_Bdd, managing reference count with RAII.
Definition: calObj.hh:73
BDD Regular() const
Returns a BDD in positive form (regardless of this BDDs phase).
Definition: calObj.hh:352
BDD ITE(const BDD &g, const BDD &h) const
Logical If-Then-Else.
Definition: calObj.hh:409
BDD Then() const
The positive cofactor of this BDD with respect to its top variable.
Definition: calObj.hh:279
Id_t Id() const
Returns the id of this BDD's top variable.
Definition: calObj.hh:264
bool IsNull() const
true if the this BDD is NULL, false otherwise.
Definition: calObj.hh:201
std::string ToString() const
String representation of this BDD node.
Definition: calObj.hh:679
Cal_BddIndex_t Index_t
Type of BDD indices, i.e. their placement in the current variable ordering.
Definition: calObj.hh:89
unsigned long Size(bool negout=true) const
This BDD's size.
Definition: calObj.hh:323
bool operator!=(const BDD &other) const
false if argument BDDs are equal, true otherwise.
Definition: calObj.hh:238
bool IsCube() const
true if the this BDD is a cube, false otherwise.
Definition: calObj.hh:216
bool IsConst() const
true if the this BDD is either constant one or constant zero, otherwise returns false.
Definition: calObj.hh:210
BDD(BDD &&other)
Move ownership of another BDD.
Definition: calObj.hh:149
void PrintProfile(int lineLength=79, FILE *fp=stdout) const
Prints a BDD in the human readable form.
Definition: calObj.hh:613
BDD & operator|=(const BDD &other)
Definition: calObj.hh:451
BDD Intersects(const BDD &g) const
Computes a BDD that implies conjunction of this and g.
Definition: calObj.hh:389
void FunctionPrint(std::string &name) const
Prints the function implemented by this BDD.
Definition: calObj.hh:589
BDD SwapVars(const BDD &g, const BDD &h) const
The function obtained by swapping two variables.
Definition: calObj.hh:530
BDD & operator^=(const BDD &other)
Definition: calObj.hh:475
std::vector< long > FunctionProfile() const
The number of subfunctions of this which may be obtained by restricting variables with an index lower...
Definition: calObj.hh:630
BDD & operator=(const BDD &other)
Copy ownership of another BDD during assignment.
Definition: calObj.hh:134
BDD Identity() const
Duplicate of this BDD.
Definition: calObj.hh:344
BDD Reduce(const BDD &c) const
A function that agrees with this for all valuations which satisfy c.
Definition: calObj.hh:567
BDD(const BDD &other)
Copies ownership of another BDD.
Definition: calObj.hh:125
bool IsZero() const
true if the this BDD is constant zero, falseotherwise.
Definition: calObj.hh:195
void PrintFunctionProfile(int lineLength=79, FILE *fp=stdout) const
Similar to BDD::PrintProfile() but displays a function profile for this.
Definition: calObj.hh:647
Index_t Index() const
Returns the index of this BDD's top variable.
Definition: calObj.hh:272
BDD operator~() const
Definition: calObj.hh:371
Type_t
Possible types a BDD can be.
Definition: calObj.hh:294
@ Negvar
Definition: calObj.hh:304
@ One
Definition: calObj.hh:298
@ Posvar
Definition: calObj.hh:302
@ Constant
Definition: calObj.hh:300
@ Overflow
Definition: calObj.hh:306
@ Zero
Definition: calObj.hh:296
@ NonTerminal
Definition: calObj.hh:308
BDD Diff(const BDD &g) const
Logical Difference operation.
Definition: calObj.hh:487
BDD Nand(const BDD &g) const
Logical Negated AND operation.
Definition: calObj.hh:433
BDD & operator-=(const BDD &other)
Definition: calObj.hh:499
BDD operator-(const BDD &other) const
Definition: calObj.hh:493
bool IsEqualTo(const BDD &other) const
true if this BDD is equal to other, false otherwise.
Definition: calObj.hh:222
~BDD()
Decrement reference count upon leaving scope.
Definition: calObj.hh:173
BDD And(const BDD &g) const
Logical AND operation.
Definition: calObj.hh:415
BDD SatisfySupport() const
Returns a special cube contained in this.
Definition: calObj.hh:519
BDD operator&(const BDD &other) const
Definition: calObj.hh:421
bool DependsOn(const BDD &var) const
true if this depends on var, false otherwise.
Definition: calObj.hh:244
BDD & operator&=(const BDD &other)
Definition: calObj.hh:427
BDD Satisfy() const
A satisfying assignment of this BDD.
Definition: calObj.hh:508
double SatisfyingFraction() const
Fraction of valuations which make this BDD true.
Definition: calObj.hh:332
Type_t Type() const
The BDD type (0, 1, +var, -var, overflow, nonterminal).
Definition: calObj.hh:314
BDD operator|(const BDD &other) const
Definition: calObj.hh:445
BDD Not() const
Complement of this BDD.
Definition: calObj.hh:365
BDD()
The NULL BDD.
Definition: calObj.hh:118
bool operator==(const BDD &other) const
true if argument BDDs are equal, false otherwise.
Definition: calObj.hh:230
BDD Xnor(const BDD &g) const
Logical Negated XOR operation.
Definition: calObj.hh:481
BDD Cofactor(const BDD &c) const
Generalized cofactor of this with respect to c.
Definition: calObj.hh:553
BDD operator^(const BDD &other) const
Definition: calObj.hh:469
bool IsOne() const
true if the this BDD is constant one, falseotherwise.
Definition: calObj.hh:187
BDD(Cal_BddManager bddManager, Cal_Bdd bdd)
Wrap C API Cal_Bdd to be managed by this new BDD object.
Definition: calObj.hh:110
BDD Implies(const BDD &g) const
Computes a BDD that implies conjunction of this and g.Not().
Definition: calObj.hh:397
BDD Else() const
The negative cofactor of this BDD with respect to its top variable.
Definition: calObj.hh:285
BDD Compose(const BDD &g, const BDD &h) const
Substitute a BDD variable by a function.
Definition: calObj.hh:381
Cal_BddId_t Id_t
Type of BDD identifiers, i.e. the variable name independent of the current variable ordering.
Definition: calObj.hh:83
BDD Xor(const BDD &g) const
Logical XOR operation.
Definition: calObj.hh:463
BDD Or(const BDD &g) const
Logical OR operation.
Definition: calObj.hh:439
BDD Nor(const BDD &g) const
Logical Negated OR operation.
Definition: calObj.hh:457
std::vector< long > Profile(bool negout=true) const
Obtain a vector with the number of nodes at each level in f.
Definition: calObj.hh:598
void Print(FILE *fp=stdout) const
Prints this BDD in the human readable form.
Definition: calObj.hh:577
int RefCount() const
The reference count of this BDD.
Definition: calObj.hh:662
BDD If() const
BDD corresponding to the top variable of the this BDD.
Definition: calObj.hh:256
Core Manager of everything BDDs, variables, and more.
Definition: calObj.hh:823
BDD Or(const BDD &f, const BDD &g)
Logical OR operation.
Definition: calObj.hh:1497
std::vector< BDD > PairwiseOr(const Container &c)
Pairwise OR of BDDs or ints within a container.
Definition: calObj.hh:1687
double SatisfyingFraction(const BDD &f)
Fraction of valuations which make this BDD true.
Definition: calObj.hh:1322
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.
Definition: calObj.hh:2103
BDD CreateNewVarAfter(const BDD &x)
Create and obtain a new variable after the specified one in the variable order.
Definition: calObj.hh:1254
bool IsCube(const BDD &f) const
true if the given BDD is a cube, false otherwise.
Definition: calObj.hh:1294
BDD And(IT begin, IT end)
Logical AND of iterator of BDD or int.
Definition: calObj.hh:1459
BDD ForAll(const BDD &f)
Universal quantification of some variables from the given BDD.
Definition: calObj.hh:1805
void PrintProfile(const BDD &f, int lineLength=79, FILE *fp=stdout) const
Prints a BDD in the human readable form.
Definition: calObj.hh:1995
bool IsZero(const BDD &f) const
true if the given BDD is constant zero, falseotherwise.
Definition: calObj.hh:1279
BDD Not(const BDD &f)
Complement of the given BDD.
Definition: calObj.hh:1402
std::vector< long > FunctionProfile(const Container &c) const
Similar to Cal::FunctionProfile for a container of BDDs. But, this accounts for sharing of nodes.
Definition: calObj.hh:2088
BDD Between(const BDD &fMin, const BDD &fMax)
Function that contains fMin and is contained in fMax.
Definition: calObj.hh:1855
BDD Or(IT begin, IT end)
Logical OR of iterator of BDD or int.
Definition: calObj.hh:1514
void SetParameters(long reorderingThreshold, long maxForwardedNodes, double repackAfterGCThreshold, double tableRepackThreshold)
Sets appropriate fields of BDD Manager.
Definition: calObj.hh:930
void SetGCLimit()
Sets the limit of the garbage collection.
Definition: calObj.hh:1011
BDD Exists(const BDD &f)
Existentially quantification of some variables from the given BDD.
Definition: calObj.hh:1793
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...
Definition: calObj.hh:2124
std::vector< BDD > PairwiseOr(IT begin, IT end)
Pairwise OR of BDDs or ints provided by an iterator.
Definition: calObj.hh:1661
unsigned long Nodes() const
The number of BDD nodes.
Definition: calObj.hh:947
BDD Reduce(const BDD &f, const BDD &c)
Function that agrees with f for all valuations that satisfy c.
Definition: calObj.hh:1842
void AssociationQuit(int i)
Deletes the variable association given by id.
Definition: calObj.hh:1128
std::vector< BDD > PairwiseAnd(IT begin, IT end)
Pairwise AND of BDDs or ints provided by an iterator.
Definition: calObj.hh:1617
BDD Substitute(const BDD &f)
Substitute a set of variables by functions.
Definition: calObj.hh:1755
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.
Definition: calObj.hh:2064
BDD Nand(const BDD &f, const BDD &g)
Logical Negated AND operation.
Definition: calObj.hh:1491
BDD Identity(const BDD &f)
Duplicate of given BDD.
Definition: calObj.hh:1388
bool DependsOn(const BDD &f, const BDD &var) const
true if the BDD f depends on var, false otherwise.
Definition: calObj.hh:1310
BDD Xor(IT begin, IT end)
Logical XOR of iterator of BDD or int.
Definition: calObj.hh:1569
bool Overflow() const
true if the node limit has been exceeded, false otherwise.
Definition: calObj.hh:963
int AssociationInit(IT begin, IT end, const bool pairs=false)
Creates or finds a variable association.
Definition: calObj.hh:1094
BDD SatisfySupport(const BDD &f)
Returns a special cube contained in this.
Definition: calObj.hh:1742
BDD One() const
The BDD for the constant one.
Definition: calObj.hh:1203
unsigned long Size(Container c, bool negout=true)
Similar to Cal::Size() for a container of BDDs. But, this accounts for sharing of nodes.
Definition: calObj.hh:1373
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 in...
Definition: calObj.hh:2050
long NodeLimit(long newLimit)
Sets the node limit to newLimit and returns the previous limit.
Definition: calObj.hh:992
BDD Id(Id_t id) const
The variable with the specified id, null if no such variable exists.
Definition: calObj.hh:1219
BDD Xnor(const BDD &f, const BDD &g)
Logical Negated XOR operation.
Definition: calObj.hh:1599
Cal(unsigned int numVars)
Initialize a new BDD Manager with variables [1, numVars].
Definition: calObj.hh:878
BDD And(const BDD &f, const BDD &g)
Logical AND operation.
Definition: calObj.hh:1442
unsigned long TotalSize() const
The number of nodes in the Unique table.
Definition: calObj.hh:971
BDD Nor(const BDD &f, const BDD &g)
Logical Negated OR operation.
Definition: calObj.hh:1546
BDD Then(const BDD &f)
The positive cofactor of the given BDD with respect to its top variable.
Definition: calObj.hh:1891
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.
Definition: calObj.hh:2011
unsigned long Size(const BDD &f, bool negout=true)
This BDD's size.
Definition: calObj.hh:1333
std::vector< BDD > PairwiseXor(IT begin, IT end)
Pairwise XOR of BDDs or ints provided by an iterator.
Definition: calObj.hh:1698
BDD And(const Container &c)
Logical AND of container with BDDs or ints.
Definition: calObj.hh:1483
BDD Xor(const BDD &f, const BDD &g)
Logical XOR operation.w.
Definition: calObj.hh:1552
void SetGCMode(bool enableGC)
Enable or Disable garbage collection.
Definition: calObj.hh:998
void TempAssociationInit(IT begin, const IT end, const bool pairs=false)
Sets the temporary variable association.
Definition: calObj.hh:1143
long Vars() const
The number of BDD variables.
Definition: calObj.hh:953
void FunctionPrint(const BDD &f, std::string &name) const
Prints the function implemented by the given BDD.
Definition: calObj.hh:1923
BDD Compose(const BDD &f, const BDD &g, const BDD &h)
Substitute a BDD variable by a function, i.e. f[h/g].
Definition: calObj.hh:1410
void Stats(FILE *fp=stdout) const
Prints miscellaneous BDD statistics.
Definition: calObj.hh:977
Cal(Cal &&o)
Move ownership of C object.
Definition: calObj.hh:894
BDD RelProd(const BDD &f, const BDD &g)
Logical AND of the argument BDDs and existentially quantifying some variables from the product.
Definition: calObj.hh:1817
std::vector< long > Profile(const BDD &f, bool negout=true) const
Obtain a vector with the number of nodes at each level in f.
Definition: calObj.hh:1936
BDD ITE(const BDD &f, const BDD &g, const BDD &h)
Logical If-Then-Else.
Definition: calObj.hh:1434
bool IsOne(const BDD &f) const
true if the given BDD is constant one, falseotherwise.
Definition: calObj.hh:1271
BDD Zero() const
The BDD for the constant zero.
Definition: calObj.hh:1211
BDD SwapVars(const BDD &f, const BDD &g, const BDD &h)
The function obtained by swapping two variables.
Definition: calObj.hh:1781
std::vector< BDD > PairwiseXor(const Container &c)
Pairwise XOR of BDDs or ints within a container.
Definition: calObj.hh:1722
BDD Regular(const BDD &f)
The given BDD in positive form (regardless of its phase).
Definition: calObj.hh:1396
BDD CreateNewVarBefore(const BDD &x)
Create and obtain a new variable before the specified one in the variable order.
Definition: calObj.hh:1247
void GC()
Invokes the garbage collection at the manager level.
Definition: calObj.hh:1021
void TempAssociationQuit()
Cleans up temporary association.
Definition: calObj.hh:1180
BDD Intersects(const BDD &f, const BDD &g)
Computes a BDD that implies the conjunction of both BDDs.
Definition: calObj.hh:1418
std::vector< BDD > PairwiseAnd(const Container &c)
Pairwise AND of BDDs or ints within a container.
Definition: calObj.hh:1643
BDD If(const BDD &f) const
BDD corresponding to the top variable of the given BDD.
Definition: calObj.hh:1866
void TempAssociationAugment(IT begin, const IT end, const bool pairs=false)
Adds to the temporary variable association.
Definition: calObj.hh:1165
BDD Cofactor(const BDD &f, const BDD &c)
Generalized cofactor of f with respect to c.
Definition: calObj.hh:1829
void Reorder()
Invoke the current dynamic reodering method.
Definition: calObj.hh:1066
BDD CreateNewVarLast()
Create and obtain a new variable at the end of the variable order.
Definition: calObj.hh:1240
Cal()
Initialize a new BDD Manager.
Definition: calObj.hh:871
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.
Definition: calObj.hh:1983
ReorderMethod
The possible technique to be used to execute each method (c.f. Cal::ReorderTechnique).
Definition: calObj.hh:1044
BDD Satisfy(const BDD &f)
A satisfying assignment of this BDD.
Definition: calObj.hh:1732
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...
Definition: calObj.hh:2152
bool IsConst(const BDD &f) const
true if the given BDD is either constant one or constant zero, otherwise returns false.
Definition: calObj.hh:1288
void DynamicReordering(ReorderTechnique technique, ReorderMethod method=ReorderMethod::DF)
Specify dynamic reordering technique and method.
Definition: calObj.hh:1054
BDD Else(const BDD &f)
The negative cofactor of the given BDD with respect to its top variable.
Definition: calObj.hh:1900
BDD Implies(const BDD &f, const BDD &g)
Computes a BDD that implies the conjunction of f and g.Not().
Definition: calObj.hh:1426
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....
Definition: calObj.hh:2037
int AssociationSetCurrent(int i)
Sets the current variable association to the one given.
Definition: calObj.hh:1117
bool IsEqual(const BDD &f, const BDD &g) const
true if the two BDDs are equal, false otherwise.
Definition: calObj.hh:1302
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.
Definition: calObj.hh:1953
Id_t IfId(const BDD &f) const
Returns the id of the given BDD's top variable.
Definition: calObj.hh:1874
BDD Xor(const Container &c)
Logical XOR of container with BDDs or ints.
Definition: calObj.hh:1593
Index_t IfIndex(const BDD &f) const
Returns the index of this BDD's top variable.
Definition: calObj.hh:1882
BDD Null() const
The NULL BDD.
Definition: calObj.hh:1195
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.
Definition: calObj.hh:1348
void Print(const BDD &f, FILE *fp=stdout) const
Prints a BDD in the human readable form.
Definition: calObj.hh:1915
BDD Index(Index_t idx) const
The variable with the specified index, null if no such variable exists.
Definition: calObj.hh:1228
~Cal()
Clear memory of BDD Manager.
Definition: calObj.hh:906
bool IsNull(const BDD &f) const
true if the given BDD is NULL, false otherwise.
Definition: calObj.hh:1263
ReorderTechnique
The possible methods (algorithms) for variable reordering.
Definition: calObj.hh:1032
BDD CreateNewVarFirst()
Create and obtain a new variable at the start of the variable order.
Definition: calObj.hh:1234
BDD Or(const Container &c)
Logical OR of container with BDDs or ints.
Definition: calObj.hh:1538
EXTERN Cal_Bdd Cal_BddElse(Cal_BddManager bddManager, Cal_Bdd userBdd)
The negative cofactor of the argument BDD with respect to its top variable.
EXTERN void Cal_BddUnFree(Cal_BddManager bddManager, Cal_Bdd userBdd)
Unfrees the argument BDD.
EXTERN double Cal_BddSatisfyingFraction(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
Fraction of valuations which make f true.
EXTERN void Cal_BddStats(Cal_BddManager bddManager, FILE *fp)
Prints miscellaneous BDD statistics.
EXTERN Cal_BddId_t Cal_BddGetIfId(Cal_BddManager bddManager, Cal_Bdd userBdd)
Returns the id of the top variable of the argument BDD.
EXTERN Cal_Bdd Cal_BddManagerGetVarWithIndex(Cal_BddManager bddManager, Cal_BddIndex_t index)
The variable with the specified index, null if no such variable exists.
EXTERN Cal_Bdd * Cal_BddPairwiseXor(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
Logical XOR of BDD pairs in argument null-termiinated array of BDDs.
EXTERN int Cal_BddIsBddConst(Cal_BddManager bddManager, Cal_Bdd userBdd)
Returns 1 if the argument BDD is either constant one or constant zero, otherwise returns 0.
EXTERN Cal_Bdd Cal_BddSatisfySupport(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
Returns a special cube contained in f.
EXTERN int Cal_BddManagerGC(Cal_BddManager bddManager)
Invokes the garbage collection at the manager level.
EXTERN Cal_Bdd Cal_BddXor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Logical XOR of argument BDDs.
EXTERN Cal_Bdd * Cal_BddPairwiseAnd(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
Logical AND of BDD pairs in argument null-termiinated array of BDDs.
EXTERN void Cal_BddFree(Cal_BddManager bddManager, Cal_Bdd userBdd)
Frees the argument BDD.
EXTERN long Cal_BddSizeMultiple(Cal_BddManager bddManager, Cal_Bdd *fUserBddArray, int negout)
Similar to Cal_BddSize for a null-terminated array of BDDs and accounting for sharing of nodes.
EXTERN int Cal_BddIsEqual(Cal_BddManager bddManager, Cal_Bdd userBdd1, Cal_Bdd userBdd2)
Returns 1 if argument BDDs are equal, 0 otherwise.
EXTERN Cal_Bdd Cal_BddCompose(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd, Cal_Bdd hUserBdd)
Substitute a BDD variable by a function.
EXTERN Cal_Bdd Cal_BddIdentity(Cal_BddManager bddManager, Cal_Bdd userBdd)
Duplicate of the argument BDD.
#define Cal_BddTerminalIdFnNone
Default BDD terminal naming function.
Definition: cal.h:146
EXTERN void Cal_BddPrintFunctionProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *userBdds, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp)
Similar to Cal_BddPrintFunctionProfile but displays a function profile for a set of BDDs.
EXTERN void Cal_TempAssociationQuit(Cal_BddManager bddManager)
Cleans up temporary association.
EXTERN void Cal_BddFunctionProfile(Cal_BddManager bddManager, Cal_Bdd fUserBdd, long *funcCounts)
The number of subfunctions of f which may be obtained by restricting variables with an index lower th...
EXTERN int Cal_AssociationInit(Cal_BddManager bddManager, Cal_Bdd *associationInfoUserBdds, int pairs)
Creates or finds a variable association.
EXTERN Cal_Bdd Cal_BddMultiwayXor(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
Logical XOR of BDDs in argument null-terminated array of BDDs.
EXTERN void Cal_BddPrintBdd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_VarNamingFn_t VarNamingFn, Cal_TerminalIdFn_t TerminalIdFn, Cal_Pointer_t env, FILE *fp)
Prints a BDD in the human readable form.
EXTERN Cal_Bdd Cal_BddCofactor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd cUserBdd)
Generalized cofactor of f with respect to c.
EXTERN void Cal_BddProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *fUserBddArray, long *levelCounts, int negout)
Similar to Cal_BddProfile for a null-terminated array of BDDs and accounting for sharing of nodes.
EXTERN Cal_Bdd Cal_BddMultiwayAnd(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
Logical AND of BDDs in argument null-terminated array of BDDs.
EXTERN Cal_Bdd Cal_BddVarSubstitute(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
Substitute a set of variables by set of another variables.
EXTERN Cal_Bdd Cal_BddSubstitute(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
Substitute a set of variables by functions.
EXTERN void Cal_BddDynamicReordering(Cal_BddManager bddManager, int technique, int method)
Specify dynamic reordering technique and method.
EXTERN long Cal_BddNodeLimit(Cal_BddManager bddManager, long newLimit)
Sets the node limit to new_limit and returns the old limit.
EXTERN Cal_Bdd Cal_BddManagerCreateNewVarLast(Cal_BddManager bddManager)
Create and obtain a new variable at the end of the variable order.
EXTERN void Cal_BddPrintFunctionProfile(Cal_BddManager bddManager, Cal_Bdd f, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp)
Similar to Cal_BddPrintProfile but displays a function profile for f.
EXTERN Cal_Bdd Cal_BddManagerGetVarWithId(Cal_BddManager bddManager, Cal_BddId_t id)
The variable with the specified id, null if no such variable exists.
EXTERN void Cal_TempAssociationInit(Cal_BddManager bddManager, Cal_Bdd *associationInfoUserBdds, int pairs)
Sets the temporary variable association.
EXTERN void Cal_BddFunctionPrint(Cal_BddManager bddManager, Cal_Bdd userBdd, char *name)
Prints the function implemented by the argument BDD.
EXTERN Cal_Bdd Cal_BddManagerCreateNewVarAfter(Cal_BddManager bddManager, Cal_Bdd userBdd)
Create and obtain a new variable after the specified one in the variable order.
EXTERN Cal_Bdd Cal_BddNand(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Logical NAND of argument BDDs.
EXTERN Cal_Bdd Cal_BddOne(Cal_BddManager bddManager)
The BDD for the constant one.
EXTERN void Cal_BddManagerSetGCLimit(Cal_BddManager manager)
Sets the limit of the garbage collection.
EXTERN Cal_BddId_t Cal_BddGetIfIndex(Cal_BddManager bddManager, Cal_Bdd userBdd)
Returns the index of the top variable of the argument BDD.
EXTERN Cal_Bdd Cal_BddExists(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
Existentially quantification of some variables from the given BDD.
EXTERN Cal_Bdd Cal_BddNot(Cal_BddManager bddManager, Cal_Bdd userBdd)
Complement of the argument BDD.
EXTERN int Cal_BddIsBddOne(Cal_BddManager bddManager, Cal_Bdd userBdd)
Returns 1 if the argument BDD is constant one, 0 otherwise.
EXTERN Cal_Bdd Cal_BddIntersects(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Computes a BDD that implies conjunction of f and g.
EXTERN void Cal_BddProfile(Cal_BddManager bddManager, Cal_Bdd fUserBdd, long *levelCounts, int negout)
The number of nodes at each level in f.
EXTERN int Cal_BddOverflow(Cal_BddManager bddManager)
Returns 1 if the node limit has been exceeded, 0 otherwise.
EXTERN void Cal_BddPrintProfile(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp)
Displays the node profile for f on fp.
EXTERN unsigned long Cal_BddTotalSize(Cal_BddManager bddManager)
Returns the number of nodes in the Unique table.
EXTERN Cal_Bdd Cal_BddManagerCreateNewVarBefore(Cal_BddManager bddManager, Cal_Bdd userBdd)
Create and obtain a new variable before the specified one in the variable order.
EXTERN long Cal_BddSize(Cal_BddManager bddManager, Cal_Bdd fUserBdd, int negout)
BDD size of fUserBdd.
EXTERN void Cal_BddPrintProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *userBdds, Cal_VarNamingFn_t varNamingProc, char *env, int lineLength, FILE *fp)
Similar to Cal_BddPrintProfile but displays the profile for a set of BDDs.
EXTERN Cal_Bdd * Cal_BddPairwiseOr(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
Logical OR of BDD pairs in argument null-termiinated array of BDDs.
EXTERN Cal_Bdd Cal_BddIf(Cal_BddManager bddManager, Cal_Bdd userBdd)
A BDD corresponding to the top variable of the given BDD.
EXTERN Cal_Bdd Cal_BddZero(Cal_BddManager bddManager)
The BDD for the constant zero.
EXTERN unsigned long Cal_BddManagerGetNumNodes(Cal_BddManager bddManager)
Returns the number of BDD nodes.
EXTERN Cal_Bdd Cal_BddManagerCreateNewVarFirst(Cal_BddManager bddManager)
Create and obtain a new variable at the start of the variable order.
EXTERN Cal_Bdd Cal_BddReduce(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd cUserBdd)
A function that agrees with f for all valuations which satisfy c.
EXTERN Cal_BddManager Cal_BddManagerInit()
Creates and initializes a new BDD manager.
EXTERN Cal_Bdd Cal_BddSatisfy(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
A satisfying assignment of f.
EXTERN void Cal_AssociationQuit(Cal_BddManager bddManager, int associationId)
Deletes the variable association given by id.
EXTERN Cal_Bdd Cal_BddBetween(Cal_BddManager bddManager, Cal_Bdd fMinUserBdd, Cal_Bdd fMaxUserBdd)
A function that contains fMin and is contained in fMax.
EXTERN int Cal_BddType(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
The type of the given BDD (0, 1, +var, -var, overflow, nonterminal).
#define Cal_BddNamingFnNone
Default BDD variable naming function.
Definition: cal.h:141
EXTERN Cal_Bdd Cal_BddGetRegular(Cal_BddManager bddManager, Cal_Bdd userBdd)
Returns a BDD with positive from a given BDD with arbitrary phase.
EXTERN int Cal_AssociationSetCurrent(Cal_BddManager bddManager, int associationId)
Sets the current variable association to the one given.
EXTERN long Cal_BddVars(Cal_BddManager bddManager)
Returns the number of BDD variables.
EXTERN Cal_Bdd Cal_BddXnor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Logical XNOR of argument BDDs.
EXTERN void Cal_BddSetGCMode(Cal_BddManager bddManager, int gcMode)
Sets the garbage collection mode.
EXTERN void Cal_BddFunctionProfileMultiple(Cal_BddManager bddManager, Cal_Bdd *fUserBddArray, long *funcCounts)
Similar to Cal_BddFunctionProfile for a null-terminated array of BDDs and accounting for sharing of n...
EXTERN Cal_Bdd Cal_BddITE(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd, Cal_Bdd hUserBdd)
Logical If-Then-Else.
EXTERN void Cal_BddReorder(Cal_BddManager bddManager)
Invoke the current dynamic reodering method.
EXTERN int Cal_BddIsBddZero(Cal_BddManager bddManager, Cal_Bdd userBdd)
Returns 1 if the argument BDD is constant zero, 0 otherwise.
EXTERN Cal_Bdd Cal_BddRelProd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Logical AND of the argument BDDs and existentially quantifying some variables from the product.
EXTERN Cal_Bdd Cal_BddThen(Cal_BddManager bddManager, Cal_Bdd userBdd)
The positive cofactor of the argument BDD with respect to its top variable.
EXTERN int Cal_BddDependsOn(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd varUserBdd)
Returns 1 if f depends on var and returns 0 otherwise.
EXTERN int Cal_BddIsCube(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
Returns 1 if the argument BDD is a cube, 0 otherwise.
EXTERN int Cal_BddManagerQuit(Cal_BddManager bddManager)
Frees the BDD manager and all the associated allocations.
EXTERN void Cal_TempAssociationAugment(Cal_BddManager bddManager, Cal_Bdd *associationInfoUserBdds, int pairs)
Adds to the temporary variable association.
EXTERN Cal_Bdd Cal_BddForAll(Cal_BddManager bddManager, Cal_Bdd fUserBdd)
Universal quantification of some variables from the given BDD.
EXTERN Cal_Bdd Cal_BddNor(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Logical NOR of argument BDDs.
EXTERN Cal_Bdd Cal_BddImplies(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Computes a BDD that implies conjunction of f and Cal_BddNot(g).
EXTERN Cal_Bdd Cal_BddOr(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Logical Or of argument BDDs.
EXTERN Cal_Bdd Cal_BddMultiwayOr(Cal_BddManager bddManager, Cal_Bdd *userBddArray)
Logical OR of BDDs in argument null-terminated array of BDDs.
EXTERN Cal_Bdd Cal_BddNull(Cal_BddManager bddManager)
Returns the NULL BDD.
EXTERN int Cal_BddIsBddNull(Cal_BddManager bddManager, Cal_Bdd userBdd)
1 if the argument BDD is NULL, 0 otherwise.
EXTERN Cal_Bdd Cal_BddSwapVars(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd, Cal_Bdd hUserBdd)
The function obtained by swapping two variables.
EXTERN Cal_Bdd Cal_BddAnd(Cal_BddManager bddManager, Cal_Bdd fUserBdd, Cal_Bdd gUserBdd)
Logical AND of argument BDDs.
EXTERN void Cal_BddManagerSetParameters(Cal_BddManager bddManager, long reorderingThreshold, long maxForwardedNodes, double repackAfterGCThreshold, double tableRepackThreshold)
Sets appropriate fields of BDD Manager.