git HEAD
--------
+* Improved VarSet
+ - nrStates() now returns a double instead of a size_t
* Improved ClusterGraph
- added ClusterGraph(const FactorGraph& fg, bool onlyMaximal) constructor
- findVar( const Var& n ) no longer throws an exception if the variable is
/** \param vars contains the variables that the new factor should depend on.
* \param p Points to array of values to be added.
*/
- TFactor( const VarSet& vars, const T* p ) : _vs(vars), _p(p, p + _vs.nrStates(), _vs.nrStates()) {}
+ TFactor( const VarSet& vars, const T* p ) : _vs(vars), _p(p, p + (size_t)_vs.nrStates(), (size_t)_vs.nrStates()) {
+ DAI_ASSERT( _vs.nrStates() <= std::numeric_limits<std::size_t>::max() );
+ }
/// Constructs factor depending on variables in \a vars, copying the values from \a p
TFactor( const VarSet& vars, const TProb<T> &p ) : _vs(vars), _p(p) {
/// Calculates upper bound to the treewidth of a FactorGraph, using the specified heuristic
/** \relates JTree
+ * \param fg the factor graph for which the treewidth should be bounded
+ * \param fn the heuristic cost function used for greedy variable elimination
* \param maxStates maximum total number of states in outer regions of junction tree (0 means no limit)
* \throws OUT_OF_MEMORY if the total number of states becomes larger than maxStates
* \return a pair (number of variables in largest clique, number of states in largest clique)
* number of possible values ("states") of variable \f$x_l\f$, the number of
* joint configurations of the variables in \f$\{x_l\}_{l\in L}\f$ is given by \f$\prod_{l\in L} S_l\f$.
*/
- size_t nrStates() const {
- size_t states = 1;
- for( VarSet::const_iterator n = begin(); n != end(); n++ ) {
- size_t newStates = states * n->states();
- DAI_ASSERT( newStates >= states );
- states = newStates;
- }
+ double nrStates() const {
+ double states = 1.0;
+ for( VarSet::const_iterator n = begin(); n != end(); n++ )
+ states *= n->states();
return states;
}
//@}
# --- GIBBS -------------------
-GIBBS: GIBBS[iters=10000,burnin=100,restart=1000]
+GIBBS: GIBBS[maxiter=10000,burnin=100,restart=10000]
# --- CBP ---------------------