add an enum for lifted solvers and do some renamings
This commit is contained in:
parent
ac38e9e6a6
commit
8d14593c3e
@ -28,11 +28,18 @@ typedef vector<unsigned> Ranges;
|
||||
typedef unsigned long long ullong;
|
||||
|
||||
|
||||
enum InfAlgorithms
|
||||
enum LiftedSolvers
|
||||
{
|
||||
VE, // variable elimination
|
||||
BP, // belief propagation
|
||||
CBP // counting belief propagation
|
||||
FOVE, // first order variable elimination
|
||||
LBP, // lifted belief propagation
|
||||
};
|
||||
|
||||
|
||||
enum GroundSolvers
|
||||
{
|
||||
VE, // variable elimination
|
||||
BP, // belief propagation
|
||||
CBP // counting belief propagation
|
||||
};
|
||||
|
||||
|
||||
@ -43,7 +50,8 @@ extern bool logDomain;
|
||||
// level of debug information
|
||||
extern unsigned verbosity;
|
||||
|
||||
extern InfAlgorithms infAlgorithm;
|
||||
extern LiftedSolvers liftedSolver;
|
||||
extern GroundSolvers groundSolver;
|
||||
|
||||
};
|
||||
|
||||
|
@ -161,14 +161,14 @@ void
|
||||
runSolver (const FactorGraph& fg, const VarIds& queryIds)
|
||||
{
|
||||
Solver* solver = 0;
|
||||
switch (Globals::infAlgorithm) {
|
||||
case InfAlgorithms::VE:
|
||||
switch (Globals::groundSolver) {
|
||||
case GroundSolvers::VE:
|
||||
solver = new VarElimSolver (fg);
|
||||
break;
|
||||
case InfAlgorithms::BP:
|
||||
case GroundSolvers::BP:
|
||||
solver = new BpSolver (fg);
|
||||
break;
|
||||
case InfAlgorithms::CBP:
|
||||
case GroundSolvers::CBP:
|
||||
solver = new CbpSolver (fg);
|
||||
break;
|
||||
default:
|
||||
|
@ -352,7 +352,7 @@ runGroundSolver (void)
|
||||
}
|
||||
|
||||
vector<Params> results;
|
||||
if (Globals::infAlgorithm == InfAlgorithms::VE) {
|
||||
if (Globals::groundSolver == GroundSolvers::VE) {
|
||||
runVeSolver (fg, tasks, results);
|
||||
} else {
|
||||
runBpSolver (fg, tasks, results);
|
||||
@ -417,9 +417,9 @@ void runBpSolver (
|
||||
//mfg = BayesBall::getMinimalFactorGraph (
|
||||
// *fg, VarIds (vids.begin(),vids.end()));
|
||||
}
|
||||
if (Globals::infAlgorithm == InfAlgorithms::BP) {
|
||||
if (Globals::groundSolver == GroundSolvers::BP) {
|
||||
solver = new BpSolver (*fg); // FIXME
|
||||
} else if (Globals::infAlgorithm == InfAlgorithms::CBP) {
|
||||
} else if (Globals::groundSolver == GroundSolvers::CBP) {
|
||||
CFactorGraph::checkForIdenticalFactors = false;
|
||||
solver = new CbpSolver (*fg); // FIXME
|
||||
} else {
|
||||
|
@ -13,7 +13,10 @@ bool logDomain = false;
|
||||
|
||||
unsigned verbosity = 0;
|
||||
|
||||
InfAlgorithms infAlgorithm = InfAlgorithms::VE;
|
||||
LiftedSolvers liftedSolver = LiftedSolvers::FOVE;
|
||||
|
||||
GroundSolvers groundSolver = GroundSolvers::VE;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -208,11 +211,11 @@ setHorusFlag (string key, string value)
|
||||
ss >> Globals::verbosity;
|
||||
} else if (key == "inf_alg") {
|
||||
if ( value == "ve") {
|
||||
Globals::infAlgorithm = InfAlgorithms::VE;
|
||||
Globals::groundSolver = GroundSolvers::VE;
|
||||
} else if (value == "bp") {
|
||||
Globals::infAlgorithm = InfAlgorithms::BP;
|
||||
Globals::groundSolver = GroundSolvers::BP;
|
||||
} else if (value == "cbp") {
|
||||
Globals::infAlgorithm = InfAlgorithms::CBP;
|
||||
Globals::groundSolver = GroundSolvers::CBP;
|
||||
} else {
|
||||
cerr << "warning: invalid value `" << value << "' " ;
|
||||
cerr << "for `" << key << "'" << endl;
|
||||
|
Reference in New Issue
Block a user