* indentations + whitespace cleanup

This commit is contained in:
Caner Candan 2011-05-05 16:54:00 +02:00
commit 56c6edab04
285 changed files with 6068 additions and 6223 deletions

View file

@ -3,7 +3,7 @@
//-----------------------------------------------------------------------------
// eoSteadyFitContinue.h
// (c) GeNeura Team, 1999, Marc Schoenauer, 2000
/*
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
@ -28,9 +28,9 @@
#include <eoContinue.h>
#include <utils/eoLogger.h>
/**
/**
A continuator: does a minimum number of generations, then
stops whenever a given number of generations takes place without improvement
stops whenever a given number of generations takes place without improvement
@ingroup Continuators
*/
@ -45,10 +45,10 @@ public:
: repMinGenerations( _minGens ), repSteadyGenerations( _steadyGens),
steadyState(false), thisGenerationPlaceHolder(0),
thisGeneration(thisGenerationPlaceHolder){};
/// Ctor for enabling the save/load the no. of generations counted
eoSteadyFitContinue( unsigned long _minGens, unsigned long _steadyGen,
unsigned long& _currentGen)
unsigned long& _currentGen)
: repMinGenerations( _minGens ), repSteadyGenerations( _steadyGen),
steadyState(_currentGen>_minGens), thisGenerationPlaceHolder(0),
thisGeneration(_currentGen){};
@ -57,54 +57,54 @@ public:
* reached withtout improvement */
virtual bool operator() ( const eoPop<EOT>& _vEO ) {
thisGeneration++;
Fitness bestCurrentFitness = _vEO.nth_element_fitness(0);
if (steadyState) { // already after MinGenenerations
if (steadyState) { // already after MinGenenerations
if (bestCurrentFitness > bestSoFar) {
bestSoFar = bestCurrentFitness;
lastImprovement = thisGeneration;
bestSoFar = bestCurrentFitness;
lastImprovement = thisGeneration;
} else {
if (thisGeneration - lastImprovement > repSteadyGenerations) {
eo::log << eo::progress << "STOP in eoSteadyFitContinue: Done " << repSteadyGenerations
<< " generations without improvement\n";
return false;
}
}
} else { // not yet in steady state
if (thisGeneration - lastImprovement > repSteadyGenerations) {
eo::log << eo::progress << "STOP in eoSteadyFitContinue: Done " << repSteadyGenerations
<< " generations without improvement\n";
return false;
}
}
} else { // not yet in steady state
if (thisGeneration > repMinGenerations) { // go to steady state
steadyState = true;
bestSoFar = bestCurrentFitness;
lastImprovement = thisGeneration;
steadyState = true;
bestSoFar = bestCurrentFitness;
lastImprovement = thisGeneration;
eo::log << eo::progress << "eoSteadyFitContinue: Done the minimum number of generations\n";
}
}
return true;
}
/** Sets the parameters (minimum nb of gen. + steady nb of gen.)
/** Sets the parameters (minimum nb of gen. + steady nb of gen.)
and sets the current generation to 0 (the begin)
@todo replace thi by an init method ?
*/
virtual void totalGenerations( unsigned long _mg, unsigned long _sg ) {
repMinGenerations = _mg;
virtual void totalGenerations( unsigned long _mg, unsigned long _sg ) {
repMinGenerations = _mg;
repSteadyGenerations = _sg;
reset();
};
/// Resets the state after it's been reached
/// Resets the state after it's been reached
virtual void reset () {
steadyState=false;
thisGeneration = 0;
}
/** accessors*/
virtual unsigned long minGenerations( )
{ return repMinGenerations; };
virtual unsigned long steadyGenerations( )
{ return repSteadyGenerations; };
virtual unsigned long minGenerations( )
{ return repMinGenerations; };
virtual unsigned long steadyGenerations( )
{ return repSteadyGenerations; };
virtual std::string className(void) const { return "eoSteadyFitContinue"; }
private:
unsigned long repMinGenerations;
@ -117,4 +117,3 @@ private:
};
#endif