20 #include "drwnVarUniverse.h"
22 #include "drwnFactorGraph.h"
23 #include "drwnTableFactorOps.h"
81 vector<drwnTableFactor *> _forwardMessages;
82 vector<drwnTableFactor *> _backwardMessages;
83 vector<drwnTableFactor *> _oldForwardMessages;
84 vector<drwnTableFactor *> _oldBackwardMessages;
87 vector<drwnTableFactor *> _intermediateFactors;
88 vector<drwnFactorOperation *> _computations;
91 vector<drwnTableFactorStorage *> _sharedStorage;
102 virtual void initializeMessages();
103 virtual void buildComputationGraph() = 0;
117 void buildComputationGraph();
129 void buildComputationGraph();
const drwnVarUniversePtr & getUniverse() const
return the universe of variables for this factor graph
Definition: drwnFactorGraph.h:62
drwnInference(const drwnFactorGraph &graph)
reference to initial clique potentials
Definition: drwnInference.cpp:24
bool inference()
run inference (or resume for iterative algorithms) and return true if converged
Definition: drwnInference.cpp:99
drwnTableFactor operator[](int varIndx) const
return the marginal distribution over variable varIndx
Definition: drwnInference.h:58
virtual void marginal(drwnTableFactor &belief) const =0
return the belief over the variables in the given factor, which must be one of the cliques in the ori...
virtual bool inference()=0
run inference (or resume for iterative algorithms) and return true if converged
Implements asynchronous sum-product inference.
Definition: drwnInference.h:123
void marginal(drwnTableFactor &belief) const
return the belief over the variables in the given factor, which must be one of the cliques in the ori...
Definition: drwnInference.cpp:209
Container and utility functions for factor graphs.
Definition: drwnFactorGraph.h:40
drwnTableFactor operator[](const char *varName) const
return the marginal distribution over variable varName
Definition: drwnInference.h:65
Factor which stores the value of each assignment explicitly in table form.
Definition: drwnTableFactor.h:144
Implements generic message-passing algorithms on factor graphs. See derived classes for specific algo...
Definition: drwnInference.h:74
virtual drwnFactorGraph varMarginals() const
returns marginals for each variable in the factor graph's universe
Definition: drwnInference.cpp:40
void clear()
clear internally cached data (e.g., computation graph)
Definition: drwnInference.cpp:68
int findVariable(const char *name) const
returns the index of variable with name name
Definition: drwnVarUniverse.cpp:95
Data structures and utilities for encoding assignments to variables.
Interface for various (marginal) inference algorithms.
Definition: drwnInference.h:37
void addVariable(int var)
add variable by id
Definition: drwnTableFactor.cpp:236
virtual void clear()
clear internally cached data (e.g., computation graph)
Definition: drwnInference.h:47
Implements sum-product inference.
Definition: drwnInference.h:109
static unsigned MAX_ITERATIONS
maximum number of iterations
Definition: drwnInference.h:77