new version of belief propagation solver.
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#ifndef BP_FACTORGRAPH_H
|
||||
#define BP_FACTORGRAPH_H
|
||||
#ifndef BP_FACTOR_GRAPH_H
|
||||
#define BP_FACTOR_GRAPH_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "GraphicalModel.h"
|
||||
#include "Shared.h"
|
||||
@@ -11,25 +10,48 @@ using namespace std;
|
||||
|
||||
class FgVarNode;
|
||||
class Factor;
|
||||
class BayesNet;
|
||||
|
||||
class FactorGraph : public GraphicalModel
|
||||
{
|
||||
public:
|
||||
FactorGraph (const char* fileName);
|
||||
FactorGraph (void) {};
|
||||
FactorGraph (const char*);
|
||||
FactorGraph (const BayesNet&);
|
||||
~FactorGraph (void);
|
||||
|
||||
FgVarSet getFgVarNodes (void) const;
|
||||
vector<Factor*> getFactors (void) const;
|
||||
|
||||
void addVariable (FgVarNode*);
|
||||
void removeVariable (const FgVarNode*);
|
||||
void addFactor (Factor*);
|
||||
void removeFactor (const Factor*);
|
||||
VarSet getVariables (void) const;
|
||||
FgVarNode* getVariableById (unsigned) const;
|
||||
FgVarNode* getVariableByLabel (string) const;
|
||||
void printFactorGraph (void) const;
|
||||
Variable* getVariable (unsigned) const;
|
||||
void setIndexes (void);
|
||||
void freeDistributions (void);
|
||||
void printGraphicalModel (void) const;
|
||||
void exportToDotFormat (const char*) const;
|
||||
void exportToUaiFormat (const char*) const;
|
||||
|
||||
const FgVarSet& getFgVarNodes (void) const { return varNodes_; }
|
||||
const FactorSet& getFactors (void) const { return factors_; }
|
||||
|
||||
FgVarNode* getFgVarNode (Vid vid) const
|
||||
{
|
||||
IndexMap::const_iterator it = indexMap_.find (vid);
|
||||
if (it == indexMap_.end()) {
|
||||
return 0;
|
||||
} else {
|
||||
return varNodes_[it->second];
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (FactorGraph);
|
||||
|
||||
FgVarSet varNodes_;
|
||||
vector<Factor*> factors_;
|
||||
FgVarSet varNodes_;
|
||||
FactorSet factors_;
|
||||
IndexMap indexMap_;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // BP_FACTOR_GRAPH_H
|
||||
|
||||
|
Reference in New Issue
Block a user