Darwin
1.10(beta)
|
Generic interface for a factor. Currently only inherited by drwnTableFactor. More...
Public Member Functions | |
drwnFactor (const drwnVarUniversePtr &ptr) | |
create an empty factor | |
drwnFactor (const drwnFactor &psi) | |
copy constructor | |
virtual drwnFactor * | clone () const =0 |
returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); } | |
bool | empty () const |
true if the factor contains no variables | |
size_t | size () const |
number of variables in this factor | |
virtual size_t | memory () const |
number of bytes comsumed by the factor data (excludes variables lists, etc) | |
const drwnVarUniversePtr & | getUniverse () const |
returns the variable universe | |
drwnVarUniverse | getSubUniverse () const |
returns the subset of the universe for this factor | |
bool | hasVariable (int var) const |
returns true if the variable is included in this factor | |
int | varId (int indx) const |
returns variable at given index | |
int | varCard (int indx) const |
return cardinality of variable at given index | |
virtual void | addVariable (int var) |
add variable by id | |
void | addVariable (const char *name) |
add variable by name | |
void | addVariables (const char *name,...) |
add multiple variables | |
void | addVariables (const vector< int > &c) |
void | addVariables (const drwnClique &c) |
void | addVariables (const drwnFactor &psi) |
const vector< int > & | getOrderedVars () const |
returns the ordered set of variables over which this factor is defined | |
drwnClique | getClique () const |
returns the set of variables over which this factor is defined | |
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) | |
virtual double | getValueOf (const drwnFullAssignment &y) const =0 |
Returns the value of the factor for a given (full) assignment. | |
double | getValueOf (const drwnPartialAssignment &y) const |
Returns the value of the factor for a given partial assignment. The variables in the scope of this factor must be defined. | |
virtual void | setValueOf (const drwnFullAssignment &y, double val)=0 |
Sets the value of the factor for a given (full) assignment. | |
void | setValueOf (const drwnPartialAssignment &y, double val) |
Sets the value of the factor for a given partial assignment. The variables in the scope of this factor must be defined. | |
![]() | |
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) | |
![]() | |
virtual const char * | type () const =0 |
returns object type as a string (e.g., Foo::type() { return "Foo"; }) | |
Protected Attributes | |
drwnVarUniversePtr | _pUniverse |
all variables in the universe | |
vector< int > | _variables |
list of variables in factor (by index in factor) | |
map< int, int > | _varIndex |
index of variable in factor (by variable id) | |
Generic interface for a factor. Currently only inherited by drwnTableFactor.
move into own file.
allow for more efficient storage of higher-order factors
move to a templated design