moSolContinue(s) modifications, maximization ==> minimization

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@585 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
jboisson 2007-08-02 07:04:07 +00:00
commit 20f0a9fef4
155 changed files with 296 additions and 296 deletions

View file

@ -29,14 +29,14 @@ public:
//! Basic constructor.
/*!
\param __fitness The fitness to reach.
\param __maximization Indicate if the the aim is to maximize or minimize the fitness.
\param __minimization Indicate if the the aim is to maximize or minimize the fitness.
*/
moFitSolContinue (Fitness __fitness, bool __maximization=true): fitness (__fitness), maximization(__maximization)
moFitSolContinue (Fitness __fitness, bool __minimization=true): fitness (__fitness), minimization(__minimization)
{}
//! Function that activates the stopping criterion.
/*!
Indicates if the fitness threshold has not been yet reached.
Indicates if the fitness threshold has not yet been reached.
\param __sol the current solution.
\return true or false according to the value of the fitness.
@ -48,11 +48,11 @@ public:
return true;
}
if(maximization)
if(minimization)
{
return __sol.fitness()<fitness;
return __sol.fitness()>fitness;
}
return __sol.fitness()>fitness;
return __sol.fitness()<=fitness;
}
//! Procedure which allows to initialise all the stuff needed.
@ -64,12 +64,12 @@ private:
//! Fitness target.
Fitness fitness;
//! Flag that indicate if there is a maximization (true) or a minimization (false) of the fitness value.
//! Flag that indicate if there is a minimization (true) or a maximization (false) of the fitness value.
/*!
It can be interesting to know this information because some solution-based metaheuristics can generate solution with a fitness that
is worse that the best known fitness (in this case, the counter is not reinitialized).
*/
bool maximization;
bool minimization;
};
#endif

View file

@ -29,10 +29,10 @@ public:
//! Basic constructor.
/*!
\param __maxNumberOfIterationWithoutImprovement The number of iterations without fitness improvement to reach for stop.
\param __maximization Indicate if the the aim is to maximize or minimize the fitness.
\param __minimization Indicate if the the aim is to maximize or minimize the fitness.
*/
moNoFitImprSolContinue (unsigned int __maxNumberOfIterationWithoutImprovement, bool __maximization=true)
: maxNumberOfIterationsWithoutImprovement(__maxNumberOfIterationWithoutImprovement),maximization(__maximization),
moNoFitImprSolContinue (unsigned int __maxNumberOfIterationWithoutImprovement, bool __minimization=true)
: maxNumberOfIterationsWithoutImprovement(__maxNumberOfIterationWithoutImprovement),minimization(__minimization),
firstFitnessSaved(true), counter(0)
{}
@ -59,8 +59,8 @@ public:
counter++;
if( ((maximization) && (__sol.fitness() > fitness)) ||
((!maximization) && (__sol.fitness() < fitness)) )
if( ((minimization) && (__sol.fitness() < fitness)) ||
((!minimization) && (__sol.fitness() > fitness)) )
{
fitness=__sol.fitness();
counter=0;
@ -88,12 +88,12 @@ private:
//! Current Fitness.
Fitness fitness;
//! Flag that indicate if there is a maximization (true) or a minimization (false) of the fitness value.
//! Flag that indicate if there is a minimization (true) or a maximization (false) of the fitness value.
/*!
It can be interesting to know this information because some solution-based metaheuristics can generate solutions wiht a fitness that
is worse that the best known fitness (in this case, the counter is not reinitialized).
*/
bool maximization;
bool minimization;
//! The iteration couter.
unsigned int counter;

View file

@ -30,11 +30,11 @@ public:
/*!
\param __maxNumberOfIterations The number of iterations to reach before looking for the fitness.
\param __maxNumberOfIterationWithoutImprovement The number of iterations without fitness improvement to reach for stop.
\param __maximization Indicate if the the aim is to maximize or minimize the fitness.
\param __minimization Indicate if the the aim is to maximize or minimize the fitness.
*/
moSteadyFitSolContinue (unsigned int __maxNumberOfIterations, unsigned int __maxNumberOfIterationWithoutImprovement, bool __maximization=true)
moSteadyFitSolContinue (unsigned int __maxNumberOfIterations, unsigned int __maxNumberOfIterationWithoutImprovement, bool __minimization=true)
: maxNumberOfIterations (__maxNumberOfIterations), maxNumberOfIterationsWithoutImprovement(__maxNumberOfIterationWithoutImprovement),
maximization(__maximization), maxNumberOfIterationsReached(false), firstFitnessSaved(true), counter(0)
minimization(__minimization), maxNumberOfIterationsReached(false), firstFitnessSaved(true), counter(0)
{}
//! Function that activates the stopping criterion.
@ -71,8 +71,8 @@ public:
counter++;
if( ((maximization) && (__sol.fitness() > fitness)) ||
((!maximization) && (__sol.fitness() < fitness)) )
if( ((minimization) && (__sol.fitness() < fitness)) ||
((!minimization) && (__sol.fitness() > fitness)) )
{
fitness=__sol.fitness();
counter=0;
@ -106,12 +106,12 @@ private:
//! Current Fitness.
Fitness fitness;
//! Flag that indicate if there is a maximization (true) or a minimization (false) of the fitness value.
//! Flag that indicate if there is a minimization (true) or a maximization (false) of the fitness value.
/*!
It can be interesting to know this information because some solution-based metaheuristics can generate solution with a fitness that
is worse that the best known fitness (in this case, the counter is not reinitialized).
*/
bool maximization;
bool minimization;
//! The iteration couter.
unsigned int counter;