moCoolSched and moEasyCoolSched are deleted, moExponentialCoolingSchedule and moLinearCoolingSchedule are added

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@275 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jboisson 2007-04-18 08:33:29 +00:00
commit 29bde011dc
3 changed files with 74 additions and 24 deletions

View file

@ -1,25 +1,25 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
// "moCoolSched.h" // "moCoolingSchedule.h"
// (c) OPAC Team, LIFL, 2003-2006 // (c) OPAC Team, LIFL, 2003-2007
/* LICENCE TEXT /* LICENCE TEXT
Contact: paradiseo-help@lists.gforge.inria.fr Contact: paradiseo-help@lists.gforge.inria.fr
*/ */
#ifndef __moCoolSched_h #ifndef __moCoolingSchedule_h
#define __moCoolSched_h #define __moCoolingSchedule_h
#include <eoFunctor.h> #include <eoFunctor.h>
//! This class gives the description of a cooling schedule. //! This class gives the description of a cooling schedule.
/*! /*!
It is only a description... An object that herits from this class is needed to be used in a moSA. It is only a description... An object that herits from this class is needed to be used in a moSA.
See moEasyCoolSched for example. See moExponentialCoolingSchedule or moLinearCoolingSchedule for example.
*/ */
class moCoolSched:public eoUF < double &, bool > class moCoolingSchedule:public eoUF < double &, bool >
{ {
}; };

View file

@ -1,25 +1,25 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
// "moEasyCoolSched.h" // "moExponentialCoolingSchedule.h"
// (c) OPAC Team, LIFL, 2003-2006 // (c) OPAC Team, LIFL, 2003-2007
/* LICENCE TEXT /* LICENCE TEXT
Contact: paradiseo-help@lists.gforge.inria.fr Contact: paradiseo-help@lists.gforge.inria.fr
*/ */
#ifndef __moEasyCoolSched_h #ifndef __moExponentialCoolingSchedule_h
#define __moEasyCoolSched_h #define __moExponentialCoolingSchedule_h
#include "moCoolSched.h" #include "moCoolingSchedule.h"
//! One of the possible moCoolSched //! One of the possible moCoolingSchedule
/*! /*!
The simpliest, the temperature decrease according to a ratio until An other very simple cooling schedule, the temperature decrease according to a ratio while
it greater than a threshold. the temperature is greater than a given threshold.
*/ */
class moEasyCoolSched:public moCoolSched class moExponentialCoolingSchedule: public moCoolingSchedule
{ {
public: public:
@ -28,22 +28,18 @@ public:
\param __threshold the threshold. \param __threshold the threshold.
\param __ratio the ratio used to descrease the temperature. \param __ratio the ratio used to descrease the temperature.
*/ */
moEasyCoolSched (double __threshold, moExponentialCoolingSchedule (double __threshold, double __ratio):threshold (__threshold), ratio (__ratio)
double __ratio):threshold (__threshold), ratio (__ratio) {}
{
}
//! Function which proceeds to the cooling. //! Function which proceeds to the cooling.
/*! /*!
Decrease the temperature and indicates if it is greater than the threshold. It decreases the temperature and indicates if it is greater than the threshold.
\param __temp the current temperature. \param __temp the current temperature.
\return if the new temperature (current temperature * ratio) is greater than the threshold. \return if the new temperature (current temperature * ratio) is greater than the threshold.
*/ */
bool operator() (double &__temp) bool operator() (double &__temp)
{ {
return (__temp *= ratio) > threshold; return (__temp *= ratio) > threshold;
} }
@ -54,7 +50,6 @@ private:
//! The decreasing factor of the temperature. //! The decreasing factor of the temperature.
double ratio; double ratio;
}; };
#endif #endif

View file

@ -0,0 +1,55 @@
// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
// "moLinearCoolingSchedule.h"
// (c) OPAC Team, LIFL, 2003-2007
/* LICENCE TEXT
Contact: paradiseo-help@lists.gforge.inria.fr
*/
#ifndef __moLinearCoolingSchedule_h
#define __moLinearCoolingSchedule_h
#include "moCoolingSchedule.h"
//! One of the possible moCoolingSchedule
/*!
An another very simple cooling schedule, the temperature decrease according to a quantity while
the temperature is greater than a threshold.
*/
class moLinearCoolingSchedule: public moCoolingSchedule
{
public:
//! Simple constructor
/*!
\param __threshold the threshold.
\param __quantity the quantity used to descrease the temperature.
*/
moLinearCoolingSchedule (double __threshold, double __quantity):threshold (__threshold), quantity (__quantity)
{}
//! Function which proceeds to the cooling.
/*!
It decreases the temperature and indicates if it is greater than the threshold.
\param __temp the current temperature.
\return if the new temperature (current temperature - quantity) is greater than the threshold.
*/
bool operator() (double &__temp)
{
return (__temp -= quantity) > threshold;
}
private:
//! The temperature threhold.
double threshold;
//! The quantity that allows the temperature to decrease.
double quantity;
};
#endif