Move ElimHeuristic enum to inside of ElimGraph class

This commit is contained in:
Tiago Gomes 2013-02-20 12:52:55 +00:00
parent 8de22f4f0b
commit 8ca379c74a
4 changed files with 21 additions and 20 deletions

View File

@ -6,7 +6,8 @@
namespace Horus { namespace Horus {
ElimHeuristic ElimGraph::elimHeuristic_ = minNeighborsEh; ElimGraph::ElimHeuristic ElimGraph::elimHeuristic_ =
ElimHeuristic::minNeighborsEh;
ElimGraph::ElimGraph (const std::vector<Factor*>& factors) ElimGraph::ElimGraph (const std::vector<Factor*>& factors)

View File

@ -18,15 +18,6 @@ class EGNode;
typedef TinySet<EGNode*> EGNeighs; typedef TinySet<EGNode*> EGNeighs;
enum ElimHeuristic {
sequentialEh,
minNeighborsEh,
minWeightEh,
minFillEh,
weightedMinFillEh
};
class EGNode : public Var { class EGNode : public Var {
public: public:
EGNode (VarId vid, unsigned range) : Var (vid, range) { } EGNode (VarId vid, unsigned range) : Var (vid, range) { }
@ -46,6 +37,14 @@ class EGNode : public Var {
class ElimGraph { class ElimGraph {
public: public:
enum ElimHeuristic {
sequentialEh,
minNeighborsEh,
minWeightEh,
minFillEh,
weightedMinFillEh
};
ElimGraph (const Factors&); ElimGraph (const Factors&);
~ElimGraph (void); ~ElimGraph (void);

View File

@ -226,15 +226,15 @@ setHorusFlag (std::string option, std::string value)
} else if (option == "hve_elim_heuristic") { } else if (option == "hve_elim_heuristic") {
if (value == "sequential") if (value == "sequential")
ElimGraph::setElimHeuristic (ElimHeuristic::sequentialEh); ElimGraph::setElimHeuristic (ElimGraph::ElimHeuristic::sequentialEh);
else if (value == "min_neighbors") else if (value == "min_neighbors")
ElimGraph::setElimHeuristic (ElimHeuristic::minNeighborsEh); ElimGraph::setElimHeuristic (ElimGraph::ElimHeuristic::minNeighborsEh);
else if (value == "min_weight") else if (value == "min_weight")
ElimGraph::setElimHeuristic (ElimHeuristic::minWeightEh); ElimGraph::setElimHeuristic (ElimGraph::ElimHeuristic::minWeightEh);
else if (value == "min_fill") else if (value == "min_fill")
ElimGraph::setElimHeuristic (ElimHeuristic::minFillEh); ElimGraph::setElimHeuristic (ElimGraph::ElimHeuristic::minFillEh);
else if (value == "weighted_min_fill") else if (value == "weighted_min_fill")
ElimGraph::setElimHeuristic (ElimHeuristic::weightedMinFillEh); ElimGraph::setElimHeuristic (ElimGraph::ElimHeuristic::weightedMinFillEh);
else else
returnVal = invalidValue (option, value); returnVal = invalidValue (option, value);

View File

@ -42,12 +42,13 @@ VarElim::printSolverFlags (void) const
std::stringstream ss; std::stringstream ss;
ss << "variable elimination [" ; ss << "variable elimination [" ;
ss << "elim_heuristic=" ; ss << "elim_heuristic=" ;
typedef ElimGraph::ElimHeuristic EGEH;
switch (ElimGraph::elimHeuristic()) { switch (ElimGraph::elimHeuristic()) {
case ElimHeuristic::sequentialEh: ss << "sequential"; break; case EGEH::sequentialEh: ss << "sequential"; break;
case ElimHeuristic::minNeighborsEh: ss << "min_neighbors"; break; case EGEH::minNeighborsEh: ss << "min_neighbors"; break;
case ElimHeuristic::minWeightEh: ss << "min_weight"; break; case EGEH::minWeightEh: ss << "min_weight"; break;
case ElimHeuristic::minFillEh: ss << "min_fill"; break; case EGEH::minFillEh: ss << "min_fill"; break;
case ElimHeuristic::weightedMinFillEh: ss << "weighted_min_fill"; break; case EGEH::weightedMinFillEh: ss << "weighted_min_fill"; break;
} }
ss << ",log_domain=" << Util::toString (Globals::logDomain); ss << ",log_domain=" << Util::toString (Globals::logDomain);
ss << "]" ; ss << "]" ;