add an enum for lifted solvers and do some renamings

This commit is contained in:
Tiago Gomes 2012-05-30 17:17:39 +01:00
parent ac38e9e6a6
commit 8d14593c3e
4 changed files with 27 additions and 16 deletions

View File

@ -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;
};

View File

@ -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:

View File

@ -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 {

View File

@ -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;