equal
deleted
inserted
replaced
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 }; |