add initial skeleton for lifted bp
This commit is contained in:
parent
8d14593c3e
commit
6668ee6381
@ -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);
|
||||
}
|
||||
|
30
packages/CLPBN/horus/LiftedBpSolver.cpp
Normal file
30
packages/CLPBN/horus/LiftedBpSolver.cpp
Normal 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;
|
||||
}
|
||||
|
22
packages/CLPBN/horus/LiftedBpSolver.h
Normal file
22
packages/CLPBN/horus/LiftedBpSolver.h
Normal 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
|
@ -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 = \
|
||||
|
Reference in New Issue
Block a user