Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
drwnFactorGraph Class Reference

Container and utility functions for factor graphs. More...

Inheritance diagram for drwnFactorGraph:
drwnStdObjIface drwnWriteable drwnCloneable drwnTypeable

Public Member Functions

 drwnFactorGraph ()
 construct an empty factor graph
 
 drwnFactorGraph (const drwnVarUniversePtr &u)
 construct a factor graph based on variables in universe u
 
 drwnFactorGraph (const drwnFactorGraph &g)
 copy constructor
 
virtual const char * type () const
 returns object type as a string (e.g., Foo::type() { return "Foo"; })
 
virtual drwnFactorGraphclone () const
 returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); }
 
const drwnVarUniversePtrgetUniverse () const
 return the universe of variables for this factor graph
 
int numVariables () const
 returns the number of variables in the universe
 
int numFactors () const
 returns the number of factors in the graph
 
int numEdges () const
 returns the number of (hyper-)edges in the graph
 
void addFactor (drwnTableFactor *psi)
 add a factor to the graph and takes ownership
 
void copyFactor (const drwnTableFactor *psi)
 add a factor to the graph by copying
 
const drwnTableFactorgetFactor (int indx) const
 returns the factor at index indx
 
void deleteFactor (int indx)
 delete a factor from the graph
 
int findFactor (const drwnClique &clique, bool bAllowSuperset=false) const
 returns the index of a factor defined over the clique (or a superset of it)
 
drwnClique getClique (int indx) const
 returns the clique for the factor at index indx
 
drwnEdge getEdge (int eindx) const
 returns the indices for the factors adjacent to edge eindx
 
drwnClique getSepSet (int eindx) const
 returns the set of separator variables for edge eindx
 
double getEnergy (const drwnFullAssignment &x) const
 compute energy for a given assignment
 
bool addEdge (const drwnEdge &e)
 add an edge to the graph (and compute separator set)
 
bool connectGraph (const set< drwnEdge > &edges)
 connect graph with given set of edges
 
virtual bool connectGraph ()
 connect graph using max-spanning tree for each variable
 
bool connectBetheApprox ()
 connect graph using the bethe-approximation
 
bool save (drwnXMLNode &xml) const
 write object to XML node (see also write)
 
bool load (drwnXMLNode &xml)
 read object from XML node (see also read)
 
drwnTableFactoroperator[] (unsigned indx)
 
const drwnTableFactoroperator[] (unsigned indx) const
 
- Public Member Functions inherited from drwnWriteable
bool write (const char *filename) const
 write object to file (calls save)
 
bool read (const char *filename)
 read object from file (calls load)
 
void dump () const
 print object's current state to standard output (for debugging)
 

Static Public Member Functions

static drwnClique getSepSet (const drwnFactor &psiA, const drwnFactor &psiB)
 returns the set of separator variables between factors psiA and psiB
 

Protected Types

typedef drwnTriplet< int, int,
drwnClique
_drwnFactorEdge
 

Protected Member Functions

void computeSeparatorSets ()
 computes the sep-sets for each edge in _edges
 

Protected Attributes

drwnVarUniversePtr _pUniverse
 all variables in the universe
 
vector< drwnTableFactor * > _factors
 list of factors in the model
 
vector< _drwnFactorEdge_edges
 list of edges and sep-sets
 

Detailed Description

Container and utility functions for factor graphs.

Todo:
template on a particular factor type (could be all table factors, for example, or generic drwnFactors)

The documentation for this class was generated from the following files: