lemon/simann.h
changeset 2301 eb378706bd3d
parent 2229 4dbb6dd2dd4b
child 2304 108d6db4f32a
equal deleted inserted replaced
6:707fb0026a35 7:e2f4945ea5a5
   255       return !quit;
   255       return !quit;
   256     }
   256     }
   257     /// \brief Decides whether to accept the current solution or not.
   257     /// \brief Decides whether to accept the current solution or not.
   258     bool accept() {
   258     bool accept() {
   259       double cost_diff = simann->getCurrCost() - simann->getPrevCost();
   259       double cost_diff = simann->getCurrCost() - simann->getPrevCost();
   260       return (rnd.getReal() <= exp(-(cost_diff / temp)));
   260       return (rnd() <= exp(-(cost_diff / temp)));
   261     }
   261     }
   262     /// \brief Destructor.
   262     /// \brief Destructor.
   263     virtual ~SimpleController() {}
   263     virtual ~SimpleController() {}
   264   };
   264   };
   265 
   265 
   363       if (!start) {
   363       if (!start) {
   364         return true;
   364         return true;
   365       }
   365       }
   366       else {
   366       else {
   367         double cost_diff = simann->getCurrCost() - simann->getPrevCost();
   367         double cost_diff = simann->getCurrCost() - simann->getPrevCost();
   368         return (rnd.getReal() <= exp(-(cost_diff / temp)));
   368         return (rnd() <= exp(-(cost_diff / temp)));
   369       }
   369       }
   370     }
   370     }
   371     /// \brief Destructor.
   371     /// \brief Destructor.
   372     virtual ~AdvancedController() {}
   372     virtual ~AdvancedController() {}
   373   };
   373   };