dai::VarSet Class Reference

Represents a set of variables. More...

#include <dai/varset.h>

Inheritance diagram for dai::VarSet:

dai::SmallSet< T > dai::Region

List of all members.

Public Member Functions

Constructors and destructors
 VarSet ()
 Default constructor (constructs an empty set).
 VarSet (const SmallSet< Var > &x)
 Construct from SmallSet<Var> x.
 VarSet (const Var &v)
 Construct a VarSet with one element, v.
 VarSet (const Var &v1, const Var &v2)
 Construct a VarSet with two elements, v1 and v2.
template<typename VarIterator>
 VarSet (VarIterator begin, VarIterator end, size_t sizeHint=0)
 Construct a VarSet from the range between begin and end.
Queries
long double nrStates () const
 Calculates the number of states of this VarSet, which is simply the number of possible joint states of the variables in *this.

Friends

Input and output
std::ostream & operator<< (std::ostream &os, const VarSet &vs)
 Writes a VarSet to an output stream.


Detailed Description

Represents a set of variables.

Note:
A VarSet is implemented using a SmallSet<Var> instead of the more natural std::set<Var> because of efficiency reasons. That is, internally, the variables in the set are sorted ascendingly according to their labels.
Examples:

example_permute.cpp, example_sprinkler.cpp, example_varset.cpp, and uai2010-aie-solver.cpp.


Constructor & Destructor Documentation

dai::VarSet::VarSet (  )  [inline]

Default constructor (constructs an empty set).

dai::VarSet::VarSet ( const SmallSet< Var > &  x  )  [inline]

Construct from SmallSet<Var> x.

dai::VarSet::VarSet ( const Var v  )  [inline]

Construct a VarSet with one element, v.

dai::VarSet::VarSet ( const Var v1,
const Var v2 
) [inline]

Construct a VarSet with two elements, v1 and v2.

template<typename VarIterator>
dai::VarSet::VarSet ( VarIterator  begin,
VarIterator  end,
size_t  sizeHint = 0 
) [inline]

Construct a VarSet from the range between begin and end.

Template Parameters:
VarIterator Iterates over instances of type Var.
Parameters:
begin Points to first Var to be added.
end Points just beyond last Var to be added.
sizeHint For efficiency, the number of elements can be speficied by sizeHint.


Member Function Documentation

long double dai::VarSet::nrStates (  )  const [inline]

Calculates the number of states of this VarSet, which is simply the number of possible joint states of the variables in *this.

The number of states of the Cartesian product of the variables in this VarSet is simply the product of the number of states of each variable in this VarSet. If *this corresponds with the set $\{x_l\}_{l\in L}$, where variable $x_l$ has label $l$, and denoting by $S_l$ the number of possible values ("states") of variable $x_l$, the number of joint configurations of the variables in $\{x_l\}_{l\in L}$ is given by $\prod_{l\in L} S_l$.

Examples:
example_permute.cpp, and example_varset.cpp.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const VarSet vs 
) [friend]

Writes a VarSet to an output stream.


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

Generated on Thu Aug 5 19:04:09 2010 for libDAI by  doxygen 1.5.5