From e46d2177b71b4a40f7eee57c12b82f434d6e7b63 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Sun, 9 Dec 2012 22:04:33 +0000 Subject: [PATCH] rework a bit the test infrastructure for lkc --- packages/CLPBN/horus/LiftedWCNF.cpp | 68 ++++++++++++++++++----------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/packages/CLPBN/horus/LiftedWCNF.cpp b/packages/CLPBN/horus/LiftedWCNF.cpp index 0f174b275..5394a51a8 100644 --- a/packages/CLPBN/horus/LiftedWCNF.cpp +++ b/packages/CLPBN/horus/LiftedWCNF.cpp @@ -367,41 +367,53 @@ LiftedWCNF::LiftedWCNF (const ParfactorList& pfList) { addIndicatorClauses (pfList); addParameterClauses (pfList); - - /* - // INCLUSION-EXCLUSION TEST - vector> names = { - // {"a1","b1"},{"a2","b2"},{"a1","b3"} - {"b1","a1"},{"b2","a2"},{"b3","a1"} - }; - Clause c1 (names); - c1.addLiteral (Literal (0, LogVars() = {0})); - c1.addLiteral (Literal (1, LogVars() = {1})); - clauses_.push_back(c1); - freeLiteralId_ ++ ; - freeLiteralId_ ++ ; - */ /* - // ATOM-COUNTING TEST + // INCLUSION-EXCLUSION TEST + clauses_.clear(); vector> names = { - {"p1","p1"},{"p1","p2"},{"p1","p3"}, + {"a1","b1"},{"a2","b2"} + }; + Clause* c1 = new Clause (names); + c1->addLiteral (Literal (0, LogVars() = {0})); + c1->addLiteral (Literal (1, LogVars() = {1})); + clauses_.push_back(c1); + */ + + /* + // INDEPENDENT PARTIAL GROUND TEST + clauses_.clear(); + vector> names = { + {"a1","b1"},{"a2","b2"} + }; + Clause* c1 = new Clause (names); + c1->addLiteral (Literal (0, LogVars() = {0,1})); + c1->addLiteral (Literal (1, LogVars() = {0,1})); + clauses_.push_back(c1); + Clause* c2 = new Clause (names); + c2->addLiteral (Literal (2, LogVars() = {0})); + c2->addLiteral (Literal (1, LogVars() = {0,1})); + clauses_.push_back(c2); + */ + + /* + // ATOM-COUNTING TEST + clauses_.clear(); + vector> names = { + {"p1","p1"},{"p1","p2"},{"p1","p3"}, {"p2","p1"},{"p2","p2"},{"p2","p3"}, {"p3","p1"},{"p3","p2"},{"p3","p3"} }; - Clause c1 (names); - c1.addLiteral (Literal (0, LogVars() = {0})); - c1.addLiteralComplemented (Literal (1, {0,1})); + Clause* c1 = new Clause (names); + c1->addLiteral (Literal (0, LogVars() = {0})); + c1->addLiteralComplemented (Literal (1, {0,1})); clauses_.push_back(c1); - Clause c2 (names); - c2.addLiteral (Literal (0, LogVars()={0})); - c2.addLiteralComplemented (Literal (1, {1,0})); + Clause* c2 = new Clause (names); + c2->addLiteral (Literal (0, LogVars()={0})); + c2->addLiteralComplemented (Literal (1, {1,0})); clauses_.push_back(c2); - addWeight (0, LogAware::log(3.0), LogAware::log(4.0)); - addWeight (1, LogAware::log(2.0), LogAware::log(5.0)); - freeLiteralId_ = 2; */ - + if (Globals::verbosity > 1) { cout << "FORMULA INDICATORS:" << endl; printFormulaIndicators(); @@ -571,9 +583,13 @@ LiftedWCNF::addParameterClauses (const ParfactorList& pfList) } + void LiftedWCNF::printFormulaIndicators (void) const { + if (map_.empty()) { + return; + } set allGroups; ParfactorList::const_iterator it = pfList_.begin(); while (it != pfList_.end()) {