add initial skeleton for lifted bp

This commit is contained in:
Tiago Gomes 2012-05-30 19:23:41 +01:00
parent 8d14593c3e
commit 6668ee6381
4 changed files with 79 additions and 8 deletions

View File

@ -11,6 +11,7 @@
#include "FactorGraph.h"
#include "FoveSolver.h"
#include "VarElimSolver.h"
#include "LiftedBpSolver.h"
#include "BpSolver.h"
#include "CbpSolver.h"
#include "ElimGraph.h"
@ -308,15 +309,30 @@ runLiftedSolver (void)
}
jointList = YAP_TailOfTerm (jointList);
}
FoveSolver solver (pfListCopy);
if (Globals::verbosity > 0 && taskList == YAP_ARG2) {
solver.printSolverFlags();
cout << endl;
}
if (queryVars.size() == 1) {
results.push_back (solver.getPosterioriOf (queryVars[0]));
if (Globals::liftedSolver == LiftedSolvers::FOVE) {
FoveSolver solver (pfListCopy);
if (Globals::verbosity > 0 && taskList == YAP_ARG2) {
solver.printSolverFlags();
cout << endl;
}
if (queryVars.size() == 1) {
results.push_back (solver.getPosterioriOf (queryVars[0]));
} else {
results.push_back (solver.getJointDistributionOf (queryVars));
}
} else if (Globals::liftedSolver == LiftedSolvers::LBP) {
LiftedBpSolver solver (pfListCopy);
if (Globals::verbosity > 0 && taskList == YAP_ARG2) {
solver.printSolverFlags();
cout << endl;
}
if (queryVars.size() == 1) {
results.push_back (solver.getPosterioriOf (queryVars[0]));
} else {
results.push_back (solver.getJointDistributionOf (queryVars));
}
} else {
results.push_back (solver.getJointDistributionOf (queryVars));
assert (false);
}
taskList = YAP_TailOfTerm (taskList);
}

View File

@ -0,0 +1,30 @@
#include "LiftedBpSolver.h"
Params
LiftedBpSolver::getPosterioriOf (const Ground&)
{
return Params();
}
Params
LiftedBpSolver::getJointDistributionOf (const Grounds&)
{
return Params();
}
void
LiftedBpSolver::printSolverFlags (void) const
{
stringstream ss;
ss << "lifted bp [" ;
ss << "log_domain=" << Util::toString (Globals::logDomain);
ss << "]" ;
cout << ss.str() << endl;
}

View File

@ -0,0 +1,22 @@
#ifndef HORUS_LIFTEDBPSOLVER_H
#define HORUS_LIFTEDBPSOLVER_H
#include "ParfactorList.h"
class LiftedBpSolver
{
public:
LiftedBpSolver (const ParfactorList& pfList) : pfList_(pfList) { }
Params getPosterioriOf (const Ground&);
Params getJointDistributionOf (const Grounds&);
void printSolverFlags (void) const;
private:
ParfactorList pfList_;
};
#endif // HORUS_LIFTEDBPSOLVER_H

View File

@ -65,6 +65,7 @@ HEADERS = \
$(srcdir)/ParfactorList.h \
$(srcdir)/LiftedUtils.h \
$(srcdir)/TinySet.h \
$(srcdir)/LiftedBpSolver.h \
$(srcdir)/Util.h \
$(srcdir)/Horus.h
@ -88,6 +89,7 @@ CPP_SOURCES = \
$(srcdir)/ParfactorList.cpp \
$(srcdir)/LiftedUtils.cpp \
$(srcdir)/Util.cpp \
$(srcdir)/LiftedBpSolver.cpp \
$(srcdir)/HorusYap.cpp \
$(srcdir)/HorusCli.cpp
@ -111,6 +113,7 @@ OBJS = \
ParfactorList.o \
LiftedUtils.o \
Util.o \
LiftedBpSolver.o \
HorusYap.o
HCLI_OBJS = \