libDAI-0.2.7 (2010-08-19)
-------------------------
+* [Frederik Eaton] Fixed some random number seed issues
* Improved code in matlab/dai.cpp that tests whether findMaximum is supported
(this fixes a bug in matlab/dai.cpp reported by Deepak Roy)
* Replaced all Name members by name() virtual functions and removed global variable DAINames
} else {
// Sequential updates
if( props.updates == Properties::UpdateType::SEQRND )
- random_shuffle( _updateSeq.begin(), _updateSeq.end() );
+ random_shuffle( _updateSeq.begin(), _updateSeq.end(), rnd );
foreach( const Edge &e, _updateSeq ) {
calcNewMessage( e.first, e.second );
G = GraphAL( N );
bool finished = false;
while( !finished ) {
- random_shuffle( U.begin(), U.end() );
+ random_shuffle( U.begin(), U.end(), rnd );
size_t i1, i2;
bool suit_pair_found = false;
for( i1 = 0; i1 < U.size()-1 && !suit_pair_found; i1++ )
for( _iters = 0; _iters < props.maxiter && maxDiff > props.tol; _iters++ ) {
// Sequential updates
if( props.updates == Properties::UpdateType::SEQRND )
- random_shuffle( update_seq.begin(), update_seq.end() );
+ random_shuffle( update_seq.begin(), update_seq.end(), rnd );
for( size_t t=0; t < nredges; t++ ) {
size_t i = update_seq[t].first;
// been reached or until the maximum belief difference is smaller than tolerance
Real maxDiff = INFINITY;
for( _iters = 0; _iters < props.maxiter && maxDiff > props.tol; _iters++ ) {
- random_shuffle( update_seq.begin(), update_seq.end() );
+ random_shuffle( update_seq.begin(), update_seq.end(), rnd );
maxDiff = -INFINITY;
foreach( const size_t &i, update_seq ) {
#include <dai/util.h>
-#include <boost/random/linear_congruential.hpp>
-#include <boost/random/uniform_real.hpp>
-#include <boost/random/normal_distribution.hpp>
-#include <boost/random/variate_generator.hpp>
+#include <boost/random.hpp>
#ifdef WINDOWS
#include <windows.h>
}
/// Type of global random number generator
-typedef boost::minstd_rand _rnd_gen_type; // Try boost::mt19937 or boost::ecuyer1988 instead of boost::minstd_rand
+typedef boost::mt19937 _rnd_gen_type;
/// Global random number generator
_rnd_gen_type _rnd_gen(42U);
stubs2[n2*d2 + t] = n2;
// shuffle lists
- random_shuffle( stubs1.begin(), stubs1.end() );
- random_shuffle( stubs2.begin(), stubs2.end() );
+ random_shuffle( stubs1.begin(), stubs1.end(), rnd );
+ random_shuffle( stubs2.begin(), stubs2.end(), rnd );
// add edges
vector<Edge> edges;