diff --git a/packages/CLPBN/horus/HorusYap.cpp b/packages/CLPBN/horus/HorusYap.cpp index 138a86ccc..7246beb5e 100644 --- a/packages/CLPBN/horus/HorusYap.cpp +++ b/packages/CLPBN/horus/HorusYap.cpp @@ -14,6 +14,7 @@ #include "LiftedBp.h" #include "CountingBp.h" #include "BeliefProp.h" +#include "LiftedKc.h" #include "ElimGraph.h" #include "BayesBall.h" @@ -76,6 +77,7 @@ createLiftedNetwork (void) readLiftedEvidence (YAP_ARG2, *(obsFormulas)); LiftedNetwork* net = new LiftedNetwork (pfList, obsFormulas); + YAP_Int p = (YAP_Int) (net); return YAP_Unify (YAP_MkIntTerm (p), YAP_ARG3); } @@ -273,6 +275,8 @@ readParameters (YAP_Term paramL) int runLiftedSolver (void) { + // TODO one solver instatiation should be used + // to solve several inference tasks LiftedNetwork* network = (LiftedNetwork*) YAP_IntOfTerm (YAP_ARG1); YAP_Term taskList = YAP_ARG2; vector results; @@ -303,7 +307,7 @@ runLiftedSolver (void) } jointList = YAP_TailOfTerm (jointList); } - if (Globals::liftedSolver == LiftedSolver::FOVE) { + if (Globals::liftedSolver == LiftedSolver::LVE) { LiftedVe solver (pfListCopy); if (Globals::verbosity > 0 && taskList == YAP_ARG2) { solver.printSolverFlags(); @@ -317,6 +321,13 @@ runLiftedSolver (void) cout << endl; } results.push_back (solver.solveQuery (queryVars)); + } else if (Globals::liftedSolver == LiftedSolver::LKC) { + LiftedKc solver (pfListCopy); + if (Globals::verbosity > 0 && taskList == YAP_ARG2) { + solver.printSolverFlags(); + cout << endl; + } + results.push_back (solver.solveQuery (queryVars)); } else { assert (false); } diff --git a/packages/CLPBN/horus/LiftedKc.cpp b/packages/CLPBN/horus/LiftedKc.cpp new file mode 100644 index 000000000..7566a6d90 --- /dev/null +++ b/packages/CLPBN/horus/LiftedKc.cpp @@ -0,0 +1,38 @@ +#include "LiftedKc.h" +#include "LiftedWCNF.h" +#include "LiftedCircuit.h" + + +LiftedKc::LiftedKc (const ParfactorList& pfList) + : pfList_(pfList) +{ + lwcnf_ = new LiftedWCNF (pfList); + circuit_ = new LiftedCircuit (lwcnf_); +} + + + +LiftedKc::~LiftedKc (void) +{ +} + + + +Params +LiftedKc::solveQuery (const Grounds&) +{ + return Params(); +} + + + +void +LiftedKc::printSolverFlags (void) const +{ + stringstream ss; + ss << "lifted kc [" ; + ss << "log_domain=" << Util::toString (Globals::logDomain); + ss << "]" ; + cout << ss.str() << endl; +} + diff --git a/packages/CLPBN/horus/LiftedKc.h b/packages/CLPBN/horus/LiftedKc.h new file mode 100644 index 000000000..fbef33e0a --- /dev/null +++ b/packages/CLPBN/horus/LiftedKc.h @@ -0,0 +1,28 @@ +#ifndef HORUS_LIFTEDKC_H +#define HORUS_LIFTEDKC_H + +#include "ParfactorList.h" + +class LiftedWCNF; +class LiftedCircuit; + +class LiftedKc +{ + public: + LiftedKc (const ParfactorList& pfList); + + ~LiftedKc (void); + + Params solveQuery (const Grounds&); + + void printSolverFlags (void) const; + + private: + LiftedWCNF* lwcnf_; + LiftedCircuit* circuit_; + + const ParfactorList& pfList_; +}; + +#endif // HORUS_LIFTEDKC_H + diff --git a/packages/CLPBN/horus/Makefile.in b/packages/CLPBN/horus/Makefile.in index 10a99f782..e4c5b5178 100644 --- a/packages/CLPBN/horus/Makefile.in +++ b/packages/CLPBN/horus/Makefile.in @@ -58,6 +58,7 @@ HEADERS = \ $(srcdir)/Indexer.h \ $(srcdir)/LiftedBp.h \ $(srcdir)/LiftedCircuit.h \ + $(srcdir)/LiftedKc.h \ $(srcdir)/LiftedUtils.h \ $(srcdir)/LiftedVe.h \ $(srcdir)/LiftedWCNF.h \ @@ -84,7 +85,8 @@ CPP_SOURCES = \ $(srcdir)/HorusCli.cpp \ $(srcdir)/HorusYap.cpp \ $(srcdir)/LiftedBp.cpp \ - $(srcdir)/LiftedCircuit.h \ + $(srcdir)/LiftedCircuit.cpp \ + $(srcdir)/LiftedKc.cpp \ $(srcdir)/LiftedUtils.cpp \ $(srcdir)/LiftedVe.cpp \ $(srcdir)/LiftedWCNF.cpp \ @@ -110,6 +112,7 @@ OBJS = \ HorusYap.o \ LiftedBp.o \ LiftedCircuit.o \ + LiftedKc.o \ LiftedUtils.o \ LiftedVe.o \ LiftedWCNF.o \