Darwin
1.10(beta)
|
Data structure for definining the random variables (name and cardinality) for a given problem instance. More...
Public Member Functions | |
drwnVarUniverse (int numVars, int varCards=2) | |
drwnVarUniverse (const vector< int > &varCards) | |
virtual const char * | type () const |
returns object type as a string (e.g., Foo::type() { return "Foo"; }) | |
virtual drwnVarUniverse * | clone () const |
returns a copy of the class usually implemented as virtual Foo* clone() { return new Foo(*this); } | |
int | numVariables () const |
returns the number of variables in the model | |
bool | hasUniformCardinality () const |
returns true if all variables have the same cardinality | |
int | varCardinality (int v) const |
returns the cardinality of variable v (between 0 and _numVariables - 1) | |
int | maxCardinality () const |
returns the greatest cardinality in the universe or in clique c | |
int | maxCardinality (const drwnClique &c) const |
double | logStateSpace () const |
returns the size of the entire state space (in the log domain) | |
double | logStateSpace (const drwnClique &c) const |
returns the size of the state space of clique c (in the log domain) | |
string | varName (int v) const |
returns the name of variable v (between 0 and _numVariables - 1) | |
int | findVariable (const char *name) const |
returns the index of variable with name name | |
int | addVariable (const char *name=NULL) |
add variable with default cadinality (name is optional) | |
int | addVariable (int varCard, const char *name=NULL) |
add a variable with cardinality varCard (name is optional) | |
drwnVarUniverse | slice (const vector< int > &vars) const |
create a subset of the universe (re-ordered by variables vars) | |
drwnVarUniverse | slice (const drwnClique &vars) const |
create a subset of the universe from variables vars | |
void | clear () |
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) | |
void | print () const |
![]() | |
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) | |
Protected Attributes | |
int | _numVariables |
number of variables in the model (universe) | |
int | _uniformCards |
cardinality of variables if all the same | |
vector< int > | _varCards |
cardinality of variables if some are different | |
vector< string > | _varNames |
optional string name for each variable | |
Data structure for definining the random variables (name and cardinality) for a given problem instance.