add initial skeleton for lifted bp
This commit is contained in:
parent
8d14593c3e
commit
6668ee6381
@ -11,6 +11,7 @@
|
|||||||
#include "FactorGraph.h"
|
#include "FactorGraph.h"
|
||||||
#include "FoveSolver.h"
|
#include "FoveSolver.h"
|
||||||
#include "VarElimSolver.h"
|
#include "VarElimSolver.h"
|
||||||
|
#include "LiftedBpSolver.h"
|
||||||
#include "BpSolver.h"
|
#include "BpSolver.h"
|
||||||
#include "CbpSolver.h"
|
#include "CbpSolver.h"
|
||||||
#include "ElimGraph.h"
|
#include "ElimGraph.h"
|
||||||
@ -308,6 +309,7 @@ runLiftedSolver (void)
|
|||||||
}
|
}
|
||||||
jointList = YAP_TailOfTerm (jointList);
|
jointList = YAP_TailOfTerm (jointList);
|
||||||
}
|
}
|
||||||
|
if (Globals::liftedSolver == LiftedSolvers::FOVE) {
|
||||||
FoveSolver solver (pfListCopy);
|
FoveSolver solver (pfListCopy);
|
||||||
if (Globals::verbosity > 0 && taskList == YAP_ARG2) {
|
if (Globals::verbosity > 0 && taskList == YAP_ARG2) {
|
||||||
solver.printSolverFlags();
|
solver.printSolverFlags();
|
||||||
@ -318,6 +320,20 @@ runLiftedSolver (void)
|
|||||||
} else {
|
} else {
|
||||||
results.push_back (solver.getJointDistributionOf (queryVars));
|
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 {
|
||||||
|
assert (false);
|
||||||
|
}
|
||||||
taskList = YAP_TailOfTerm (taskList);
|
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)/ParfactorList.h \
|
||||||
$(srcdir)/LiftedUtils.h \
|
$(srcdir)/LiftedUtils.h \
|
||||||
$(srcdir)/TinySet.h \
|
$(srcdir)/TinySet.h \
|
||||||
|
$(srcdir)/LiftedBpSolver.h \
|
||||||
$(srcdir)/Util.h \
|
$(srcdir)/Util.h \
|
||||||
$(srcdir)/Horus.h
|
$(srcdir)/Horus.h
|
||||||
|
|
||||||
@ -88,6 +89,7 @@ CPP_SOURCES = \
|
|||||||
$(srcdir)/ParfactorList.cpp \
|
$(srcdir)/ParfactorList.cpp \
|
||||||
$(srcdir)/LiftedUtils.cpp \
|
$(srcdir)/LiftedUtils.cpp \
|
||||||
$(srcdir)/Util.cpp \
|
$(srcdir)/Util.cpp \
|
||||||
|
$(srcdir)/LiftedBpSolver.cpp \
|
||||||
$(srcdir)/HorusYap.cpp \
|
$(srcdir)/HorusYap.cpp \
|
||||||
$(srcdir)/HorusCli.cpp
|
$(srcdir)/HorusCli.cpp
|
||||||
|
|
||||||
@ -111,6 +113,7 @@ OBJS = \
|
|||||||
ParfactorList.o \
|
ParfactorList.o \
|
||||||
LiftedUtils.o \
|
LiftedUtils.o \
|
||||||
Util.o \
|
Util.o \
|
||||||
|
LiftedBpSolver.o \
|
||||||
HorusYap.o
|
HorusYap.o
|
||||||
|
|
||||||
HCLI_OBJS = \
|
HCLI_OBJS = \
|
||||||
|
Reference in New Issue
Block a user