diff --git a/packages/CLPBN/horus/LiftedCircuit.cpp b/packages/CLPBN/horus/LiftedCircuit.cpp index eb1dec42e..22bf1286e 100644 --- a/packages/CLPBN/horus/LiftedCircuit.cpp +++ b/packages/CLPBN/horus/LiftedCircuit.cpp @@ -653,55 +653,6 @@ LiftedCircuit::shatterCountedLogVarsAux ( -vector -getAllPossibleTypes (unsigned nrLogVars) -{ - if (nrLogVars == 0) { - return {}; - } - if (nrLogVars == 1) { - return {{LogVarType::POS_LV},{LogVarType::NEG_LV}}; - } - vector res; - Indexer indexer (vector (nrLogVars, 2)); - while (indexer.valid()) { - LogVarTypes types; - for (size_t i = 0; i < nrLogVars; i++) { - if (indexer[i] == 0) { - types.push_back (LogVarType::POS_LV); - } else { - types.push_back (LogVarType::NEG_LV); - } - } - res.push_back (types); - ++ indexer; - } - return res; -} - - - -bool -containsTypes (const LogVarTypes& typesA, const LogVarTypes& typesB) -{ - for (size_t i = 0; i < typesA.size(); i++) { - if (typesA[i] == LogVarType::FULL_LV) { - - } else if (typesA[i] == LogVarType::POS_LV - && typesB[i] == LogVarType::POS_LV) { - - } else if (typesA[i] == LogVarType::NEG_LV - && typesB[i] == LogVarType::NEG_LV) { - - } else { - return false; - } - } - return true; -} - - - LitLvTypesSet LiftedCircuit::smoothCircuit (CircuitNode* node) { @@ -828,6 +779,57 @@ LiftedCircuit::createSmoothNode ( +vector +LiftedCircuit::getAllPossibleTypes (unsigned nrLogVars) const +{ + if (nrLogVars == 0) { + return {}; + } + if (nrLogVars == 1) { + return {{LogVarType::POS_LV},{LogVarType::NEG_LV}}; + } + vector res; + Indexer indexer (vector (nrLogVars, 2)); + while (indexer.valid()) { + LogVarTypes types; + for (size_t i = 0; i < nrLogVars; i++) { + if (indexer[i] == 0) { + types.push_back (LogVarType::POS_LV); + } else { + types.push_back (LogVarType::NEG_LV); + } + } + res.push_back (types); + ++ indexer; + } + return res; +} + + + +bool +LiftedCircuit::containsTypes ( + const LogVarTypes& typesA, + const LogVarTypes& typesB) const +{ + for (size_t i = 0; i < typesA.size(); i++) { + if (typesA[i] == LogVarType::FULL_LV) { + + } else if (typesA[i] == LogVarType::POS_LV + && typesB[i] == LogVarType::POS_LV) { + + } else if (typesA[i] == LogVarType::NEG_LV + && typesB[i] == LogVarType::NEG_LV) { + + } else { + return false; + } + } + return true; +} + + + CircuitNodeType LiftedCircuit::getCircuitNodeType (const CircuitNode* node) const { diff --git a/packages/CLPBN/horus/LiftedCircuit.h b/packages/CLPBN/horus/LiftedCircuit.h index cfa3a713b..d5f1556f1 100644 --- a/packages/CLPBN/horus/LiftedCircuit.h +++ b/packages/CLPBN/horus/LiftedCircuit.h @@ -221,9 +221,9 @@ class LiftedCircuit bool tryUnitPropagation (CircuitNode** follow, Clauses& clauses); - bool tryIndependence (CircuitNode** follow, Clauses& clauses); + bool tryIndependence (CircuitNode** follow, Clauses& clauses); - bool tryShannonDecomp (CircuitNode** follow, Clauses& clauses); + bool tryShannonDecomp (CircuitNode** follow, Clauses& clauses); bool tryInclusionExclusion (CircuitNode** follow, Clauses& clauses); @@ -247,6 +247,11 @@ class LiftedCircuit void createSmoothNode (const LitLvTypesSet& lids, CircuitNode** prev); + vector getAllPossibleTypes (unsigned nrLogVars) const; + + bool containsTypes (const LogVarTypes& typesA, + const LogVarTypes& typesB) const; + CircuitNodeType getCircuitNodeType (const CircuitNode* node) const; void exportToGraphViz (CircuitNode* node, ofstream&);