From 9202e286f8fa196dd9329dcbd085bf7eaf47dcd6 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Wed, 14 Nov 2012 14:43:56 +0000 Subject: [PATCH] IncExc: check if log vars are count normalized --- packages/CLPBN/horus/LiftedCircuit.cpp | 22 ++++++++++++++-------- packages/CLPBN/horus/LiftedOperations.cpp | 1 - 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/packages/CLPBN/horus/LiftedCircuit.cpp b/packages/CLPBN/horus/LiftedCircuit.cpp index ab6ffac91..f5d43ef8f 100644 --- a/packages/CLPBN/horus/LiftedCircuit.cpp +++ b/packages/CLPBN/horus/LiftedCircuit.cpp @@ -37,14 +37,15 @@ SetOrNode::weight (void) const double w = std::log (Util::nrCombinations (nrGroundings_, i)); weightSum = Util::logSum (weightSum, w + follow_->weight()); } else { - cout << endl; - cout << "nr groundings = " << nrGroundings_ << endl; - cout << "nr positives = " << nrPositives() << endl; - cout << "nr negatives = " << nrNegatives() << endl; - cout << "i = " << i << endl; - cout << "nr combos = " << Util::nrCombinations (nrGroundings_, i) << endl; + // cout << endl; + // cout << "nr groundings = " << nrGroundings_ << endl; + // cout << "nr positives = " << nrPositives() << endl; + // cout << "nr negatives = " << nrNegatives() << endl; + // cout << "i = " << i << endl; + // cout << "nr combos = " ; + // cout << Util::nrCombinations (nrGroundings_, i) << endl; double w = follow_->weight(); - cout << "weight = " << w << endl; + // cout << "weight = " << w << endl; weightSum += Util::nrCombinations (nrGroundings_, i) * w; } } @@ -411,15 +412,20 @@ LiftedCircuit::tryInclusionExclusion ( } } if (indepLits.empty() == false) { - // TODO this should be have to be count normalized too LogVarSet lvs1; for (size_t j = 0; j < depLits.size(); j++) { lvs1 |= depLits[j].logVarSet(); } + if (clauses[i].constr().isCountNormalized (lvs1) == false) { + break; + } LogVarSet lvs2; for (size_t j = 0; j < indepLits.size(); j++) { lvs2 |= indepLits[j].logVarSet(); } + if (clauses[i].constr().isCountNormalized (lvs2) == false) { + break; + } Clause c1 (clauses[i].constr().projectedCopy (lvs1)); for (size_t j = 0; j < depLits.size(); j++) { c1.addLiteral (depLits[j]); diff --git a/packages/CLPBN/horus/LiftedOperations.cpp b/packages/CLPBN/horus/LiftedOperations.cpp index ec40695a7..03cafdee7 100644 --- a/packages/CLPBN/horus/LiftedOperations.cpp +++ b/packages/CLPBN/horus/LiftedOperations.cpp @@ -269,4 +269,3 @@ LiftedOperations::absorve ( return absorvedPfs; } -