Changeset 2229:4dbb6dd2dd4b in lemon-0.x for lemon/simann.h
- Timestamp:
- 10/02/06 18:11:00 (17 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2969
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/simann.h
r2035 r2229 32 32 #include <limits> 33 33 #include <lemon/time_measure.h> 34 35 #ifdef WIN32 36 #include <lemon/bits/mingw32_rand.h> 37 #endif 34 #include <lemon/random.h> 38 35 39 36 namespace lemon { … … 242 239 max_no_impr(_max_no_impr), temp(_temp), ann_fact(_ann_fact) 243 240 { 244 srand48(time(0));245 241 } 246 242 /// \brief This is called when a neighbouring state gets accepted. … … 262 258 bool accept() { 263 259 double cost_diff = simann->getCurrCost() - simann->getPrevCost(); 264 return ( drand48() <= exp(-(cost_diff / temp)));260 return (rnd.getReal() <= exp(-(cost_diff / temp))); 265 261 } 266 262 /// \brief Destructor. … … 322 318 ann_fact(_ann_fact), init_ann_fact(_ann_fact), start(false) 323 319 { 324 srand48(time(0));325 320 } 326 321 /// \brief Does initializations before each run. … … 371 366 else { 372 367 double cost_diff = simann->getCurrCost() - simann->getPrevCost(); 373 return ( drand48() <= exp(-(cost_diff / temp)));368 return (rnd.getReal() <= exp(-(cost_diff / temp))); 374 369 } 375 370 }
Note: See TracChangeset
for help on using the changeset viewer.