Passage du code dans un pretty printer
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1813 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
cc31901008
commit
3d8057ac4d
88 changed files with 2726 additions and 2720 deletions
|
|
@ -39,23 +39,23 @@
|
|||
|
||||
/**
|
||||
* Cooling Schedule of the temperature in the simulated algorithm
|
||||
*
|
||||
*
|
||||
*/
|
||||
template< class EOT >
|
||||
class moCoolingSchedule : public eoUF<double, bool>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Initial temperature
|
||||
* @param _solution initial solution
|
||||
*/
|
||||
virtual double init(EOT & _solution) = 0;
|
||||
/**
|
||||
* Initial temperature
|
||||
* @param _solution initial solution
|
||||
*/
|
||||
virtual double init(EOT & _solution) = 0;
|
||||
|
||||
/**
|
||||
* update the temperature
|
||||
* @param _temp current temperature to update
|
||||
*/
|
||||
virtual void update(double& _temp) = 0;
|
||||
/**
|
||||
* update the temperature
|
||||
* @param _temp current temperature to update
|
||||
*/
|
||||
virtual void update(double& _temp) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -39,86 +39,86 @@
|
|||
|
||||
/**
|
||||
* Cooling Schedule of the temperature in the simulated algorithm
|
||||
*
|
||||
*
|
||||
*/
|
||||
template< class EOT >
|
||||
class moDynSpanCoolingSchedule : public moCoolingSchedule<EOT>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* default constructor
|
||||
* @param _initT initial temperature
|
||||
* @param _alpha factor of decreasing
|
||||
* @param _spanMove maximum number of move with equal temperature
|
||||
* @param _spanNoMove maximum number of no improvement with equal temperature
|
||||
* @param _nbSpan maximum number of span with no improvmement before stopping the search
|
||||
*/
|
||||
moDynSpanCoolingSchedule(double _initT, double _alpha, unsigned int _spanMove, unsigned int _spanNoMove, unsigned int _nbSpan) : initT(_initT), alpha(_alpha), spanMove(_spanMove), spanNoMove(_spanNoMove), nbSpan(_nbSpan) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial temperature
|
||||
* @param _solution initial solution
|
||||
*/
|
||||
virtual double init(EOT & _solution) {
|
||||
// number of successive moves since the last temperature change
|
||||
nbMove = 0;
|
||||
|
||||
// number of no improvement since the last temperature change
|
||||
nbNoMove = 0;
|
||||
|
||||
// number of span with no improvement
|
||||
nbSpan = 0;
|
||||
|
||||
return initT;
|
||||
}
|
||||
|
||||
/**
|
||||
* update the temperature by a factor
|
||||
* @param _temp current temperature to update
|
||||
*/
|
||||
virtual void update(double& _temp) {
|
||||
if (nbMove >= spanMove || nbNoMove >= spanNoMove) {
|
||||
_temp *= alpha;
|
||||
|
||||
nbMove = 0;
|
||||
nbNoMove = 0;
|
||||
} else {
|
||||
nbMove++;
|
||||
nbNoMove++;
|
||||
/**
|
||||
* default constructor
|
||||
* @param _initT initial temperature
|
||||
* @param _alpha factor of decreasing
|
||||
* @param _spanMove maximum number of move with equal temperature
|
||||
* @param _spanNoMove maximum number of no improvement with equal temperature
|
||||
* @param _nbSpan maximum number of span with no improvmement before stopping the search
|
||||
*/
|
||||
moDynSpanCoolingSchedule(double _initT, double _alpha, unsigned int _spanMove, unsigned int _spanNoMove, unsigned int _nbSpan) : initT(_initT), alpha(_alpha), spanMove(_spanMove), spanNoMove(_spanNoMove), nbSpan(_nbSpan) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* compare the temperature to the threshold
|
||||
* @param _temp current temperature
|
||||
* @return true if the current temperature is over the threshold (final temperature)
|
||||
*/
|
||||
virtual bool operator()(double _temp) {
|
||||
return _temp > finalT;
|
||||
}
|
||||
/**
|
||||
* Initial temperature
|
||||
* @param _solution initial solution
|
||||
*/
|
||||
virtual double init(EOT & _solution) {
|
||||
// number of successive moves since the last temperature change
|
||||
nbMove = 0;
|
||||
|
||||
// number of no improvement since the last temperature change
|
||||
nbNoMove = 0;
|
||||
|
||||
// number of span with no improvement
|
||||
nbSpan = 0;
|
||||
|
||||
return initT;
|
||||
}
|
||||
|
||||
/**
|
||||
* update the temperature by a factor
|
||||
* @param _temp current temperature to update
|
||||
*/
|
||||
virtual void update(double& _temp) {
|
||||
if (nbMove >= spanMove || nbNoMove >= spanNoMove) {
|
||||
_temp *= alpha;
|
||||
|
||||
nbMove = 0;
|
||||
nbNoMove = 0;
|
||||
} else {
|
||||
nbMove++;
|
||||
nbNoMove++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* compare the temperature to the threshold
|
||||
* @param _temp current temperature
|
||||
* @return true if the current temperature is over the threshold (final temperature)
|
||||
*/
|
||||
virtual bool operator()(double _temp) {
|
||||
return _temp > finalT;
|
||||
}
|
||||
|
||||
private:
|
||||
// initial temperature
|
||||
double initT;
|
||||
// initial temperature
|
||||
double initT;
|
||||
|
||||
// coefficient of decrease
|
||||
double alpha;
|
||||
// coefficient of decrease
|
||||
double alpha;
|
||||
|
||||
//
|
||||
unsigned int spanMove;
|
||||
//
|
||||
unsigned int spanMove;
|
||||
|
||||
//
|
||||
unsigned int spanNoMove;
|
||||
//
|
||||
unsigned int spanNoMove;
|
||||
|
||||
// maximum number of iterations at the same temperature
|
||||
unsigned int nbSpan;
|
||||
// maximum number of iterations at the same temperature
|
||||
unsigned int nbSpan;
|
||||
|
||||
// threshold temperature
|
||||
double finalT;
|
||||
// threshold temperature
|
||||
double finalT;
|
||||
|
||||
// number of steps with the same temperature
|
||||
unsigned int step;
|
||||
// number of steps with the same temperature
|
||||
unsigned int step;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,65 +39,65 @@
|
|||
|
||||
/**
|
||||
* Classical cooling Schedule of the temperature in the simulated algorithm with initial and final temperature and a factor of decrease
|
||||
*
|
||||
*
|
||||
*/
|
||||
template< class EOT >
|
||||
class moSimpleCoolingSchedule : public moCoolingSchedule<EOT>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* default constructor
|
||||
* @param _initT initial temperature
|
||||
* @param _alpha factor of decreasing
|
||||
* @param _span number of iteration with equal temperature
|
||||
* @param _finalT final temperature, threshold of the stopping criteria
|
||||
*/
|
||||
moSimpleCoolingSchedule(double _initT, double _alpha, unsigned _span, double _finalT) : initT(_initT), alpha(_alpha), span(_span), finalT(_finalT) {}
|
||||
/**
|
||||
* default constructor
|
||||
* @param _initT initial temperature
|
||||
* @param _alpha factor of decreasing
|
||||
* @param _span number of iteration with equal temperature
|
||||
* @param _finalT final temperature, threshold of the stopping criteria
|
||||
*/
|
||||
moSimpleCoolingSchedule(double _initT, double _alpha, unsigned _span, double _finalT) : initT(_initT), alpha(_alpha), span(_span), finalT(_finalT) {}
|
||||
|
||||
/**
|
||||
* Initial temperature
|
||||
* @param _solution initial solution
|
||||
* @return the initial temperature
|
||||
*/
|
||||
virtual double init(EOT & _solution) {
|
||||
// number of iteration with the same temperature
|
||||
step = 0;
|
||||
/**
|
||||
* Initial temperature
|
||||
* @param _solution initial solution
|
||||
* @return the initial temperature
|
||||
*/
|
||||
virtual double init(EOT & _solution) {
|
||||
// number of iteration with the same temperature
|
||||
step = 0;
|
||||
|
||||
return initT;
|
||||
}
|
||||
return initT;
|
||||
}
|
||||
|
||||
/**
|
||||
* update the temperature by a factor
|
||||
* @param _temp current temperature to update
|
||||
*/
|
||||
virtual void update(double& _temp) {
|
||||
if (step >= span) {
|
||||
_temp *= alpha;
|
||||
step = 0;
|
||||
} else
|
||||
step++;
|
||||
}
|
||||
/**
|
||||
* update the temperature by a factor
|
||||
* @param _temp current temperature to update
|
||||
*/
|
||||
virtual void update(double& _temp) {
|
||||
if (step >= span) {
|
||||
_temp *= alpha;
|
||||
step = 0;
|
||||
} else
|
||||
step++;
|
||||
}
|
||||
|
||||
/**
|
||||
* compare the temperature to the threshold
|
||||
* @param _temp current temperature
|
||||
* @return true if the current temperature is over the threshold (final temperature)
|
||||
*/
|
||||
virtual bool operator()(double _temp) {
|
||||
return _temp > finalT;
|
||||
}
|
||||
/**
|
||||
* compare the temperature to the threshold
|
||||
* @param _temp current temperature
|
||||
* @return true if the current temperature is over the threshold (final temperature)
|
||||
*/
|
||||
virtual bool operator()(double _temp) {
|
||||
return _temp > finalT;
|
||||
}
|
||||
|
||||
private:
|
||||
// initial temperature
|
||||
double initT;
|
||||
// coefficient of decrease
|
||||
double alpha;
|
||||
// maximum number of iterations at the same temperature
|
||||
unsigned int span;
|
||||
// threshold temperature
|
||||
double finalT;
|
||||
// number of steps with the same temperature
|
||||
unsigned int step;
|
||||
// initial temperature
|
||||
double initT;
|
||||
// coefficient of decrease
|
||||
double alpha;
|
||||
// maximum number of iterations at the same temperature
|
||||
unsigned int span;
|
||||
// threshold temperature
|
||||
double finalT;
|
||||
// number of steps with the same temperature
|
||||
unsigned int step;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue