lemon/simann.h
changeset 2229 4dbb6dd2dd4b
parent 2035 e92071fadd3f
child 2242 16523135943d
     1.1 --- a/lemon/simann.h	Mon Oct 02 14:41:53 2006 +0000
     1.2 +++ b/lemon/simann.h	Mon Oct 02 16:11:00 2006 +0000
     1.3 @@ -31,10 +31,7 @@
     1.4  #include <cmath>
     1.5  #include <limits>
     1.6  #include <lemon/time_measure.h>
     1.7 -
     1.8 -#ifdef WIN32
     1.9 -#include <lemon/bits/mingw32_rand.h>
    1.10 -#endif
    1.11 +#include <lemon/random.h>
    1.12  
    1.13  namespace lemon {
    1.14  
    1.15 @@ -241,7 +238,6 @@
    1.16      double _temp = 1000.0, double _ann_fact = 0.9999) : max_iter(_max_iter),
    1.17        max_no_impr(_max_no_impr), temp(_temp), ann_fact(_ann_fact)
    1.18      {
    1.19 -      srand48(time(0));
    1.20      }
    1.21      /// \brief This is called when a neighbouring state gets accepted.
    1.22      void acceptEvent() {}
    1.23 @@ -261,7 +257,7 @@
    1.24      /// \brief Decides whether to accept the current solution or not.
    1.25      bool accept() {
    1.26        double cost_diff = simann->getCurrCost() - simann->getPrevCost();
    1.27 -      return (drand48() <= exp(-(cost_diff / temp)));
    1.28 +      return (rnd.getReal() <= exp(-(cost_diff / temp)));
    1.29      }
    1.30      /// \brief Destructor.
    1.31      virtual ~SimpleController() {}
    1.32 @@ -321,7 +317,6 @@
    1.33      alpha(_alpha), beta(_beta), gamma(_gamma), end_time(_end_time),
    1.34      ann_fact(_ann_fact), init_ann_fact(_ann_fact), start(false)
    1.35      {
    1.36 -      srand48(time(0));
    1.37      }
    1.38      /// \brief Does initializations before each run.
    1.39      void init() {
    1.40 @@ -370,7 +365,7 @@
    1.41        }
    1.42        else {
    1.43          double cost_diff = simann->getCurrCost() - simann->getPrevCost();
    1.44 -        return (drand48() <= exp(-(cost_diff / temp)));
    1.45 +        return (rnd.getReal() <= exp(-(cost_diff / temp)));
    1.46        }
    1.47      }
    1.48      /// \brief Destructor.