From 0852c4fe22d33d933530ed8396edd9326626819f Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Sat, 16 Feb 2013 16:17:14 +0000 Subject: [PATCH] Clean ups --- packages/CLPBN/horus/BayesBall.cpp | 18 +++++++++--------- packages/CLPBN/horus/BayesBall.h | 6 +++--- packages/CLPBN/horus/BayesBallGraph.h | 22 +++++++++++----------- packages/CLPBN/horus/ConstraintTree.h | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/packages/CLPBN/horus/BayesBall.cpp b/packages/CLPBN/horus/BayesBall.cpp index c4928a4ac..f84b508b0 100644 --- a/packages/CLPBN/horus/BayesBall.cpp +++ b/packages/CLPBN/horus/BayesBall.cpp @@ -38,22 +38,22 @@ BayesBall::getMinimalFactorGraph (const VarIds& queryIds) BBNode* n = sch.node; n->setAsVisited(); if (n->hasEvidence() == false && sch.visitedFromChild) { - if (n->isMarkedOnTop() == false) { - n->markOnTop(); + if (n->isMarkedAbove() == false) { + n->markAbove(); scheduleParents (n, scheduling); } - if (n->isMarkedOnBottom() == false) { - n->markOnBottom(); + if (n->isMarkedBelow() == false) { + n->markBelow(); scheduleChilds (n, scheduling); } } if (sch.visitedFromParent) { - if (n->hasEvidence() && n->isMarkedOnTop() == false) { - n->markOnTop(); + if (n->hasEvidence() && n->isMarkedAbove() == false) { + n->markAbove(); scheduleParents (n, scheduling); } - if (n->hasEvidence() == false && n->isMarkedOnBottom() == false) { - n->markOnBottom(); + if (n->hasEvidence() == false && n->isMarkedBelow() == false) { + n->markBelow(); scheduleChilds (n, scheduling); } } @@ -74,7 +74,7 @@ BayesBall::constructGraph (FactorGraph* fg) const for (size_t i = 0; i < facNodes.size(); i++) { const BBNode* n = dag_.getNode ( facNodes[i]->factor().argument (0)); - if (n->isMarkedOnTop()) { + if (n->isMarkedAbove()) { fg->addFactor (facNodes[i]->factor()); } else if (n->hasEvidence() && n->isVisited()) { VarIds varIds = { facNodes[i]->factor().argument (0) }; diff --git a/packages/CLPBN/horus/BayesBall.h b/packages/CLPBN/horus/BayesBall.h index 06573b3c2..09a07ce89 100644 --- a/packages/CLPBN/horus/BayesBall.h +++ b/packages/CLPBN/horus/BayesBall.h @@ -9,6 +9,7 @@ #include "BayesBallGraph.h" #include "Horus.h" + namespace Horus { struct ScheduleInfo { @@ -39,9 +40,8 @@ class BayesBall { void scheduleChilds (const BBNode* n, Scheduling& sch) const; - FactorGraph& fg_; - - BayesBallGraph& dag_; + FactorGraph& fg_; + BayesBallGraph& dag_; }; diff --git a/packages/CLPBN/horus/BayesBallGraph.h b/packages/CLPBN/horus/BayesBallGraph.h index 2c3fa26f8..769e57f87 100644 --- a/packages/CLPBN/horus/BayesBallGraph.h +++ b/packages/CLPBN/horus/BayesBallGraph.h @@ -7,12 +7,13 @@ #include "Var.h" #include "Horus.h" + namespace Horus { class BBNode : public Var { public: BBNode (Var* v) : Var (v), visited_(false), - markedOnTop_(false), markedOnBottom_(false) { } + markedAbove_(false), markedBelow_(false) { } const std::vector& childs (void) const { return childs_; } @@ -30,20 +31,20 @@ class BBNode : public Var { void setAsVisited (void) { visited_ = true; } - bool isMarkedOnTop (void) const { return markedOnTop_; } + bool isMarkedAbove (void) const { return markedAbove_; } - void markOnTop (void) { markedOnTop_ = true; } + void markAbove (void) { markedAbove_ = true; } - bool isMarkedOnBottom (void) const { return markedOnBottom_; } + bool isMarkedBelow (void) const { return markedBelow_; } - void markOnBottom (void) { markedOnBottom_ = true; } + void markBelow (void) { markedBelow_ = true; } - void clear (void) { visited_ = markedOnTop_ = markedOnBottom_ = false; } + void clear (void) { visited_ = markedAbove_ = markedBelow_ = false; } private: bool visited_; - bool markedOnTop_; - bool markedOnBottom_; + bool markedAbove_; + bool markedBelow_; std::vector childs_; std::vector parents_; @@ -71,9 +72,8 @@ class BayesBallGraph { void exportToGraphViz (const char*); private: - std::vector nodes_; - - std::unordered_map varMap_; + std::vector nodes_; + std::unordered_map varMap_; }; } // namespace Horus diff --git a/packages/CLPBN/horus/ConstraintTree.h b/packages/CLPBN/horus/ConstraintTree.h index d8cf0c9ad..e85326fc1 100644 --- a/packages/CLPBN/horus/ConstraintTree.h +++ b/packages/CLPBN/horus/ConstraintTree.h @@ -78,7 +78,7 @@ class CTNode { void updateChildLevels (CTNode*, unsigned); Symbol symbol_; - CTChilds childs_; + CTChilds childs_; unsigned level_; DISALLOW_ASSIGN (CTNode);