added verbose flag that can be used to turn off annoying message to cout
This commit is contained in:
parent
57881e56c4
commit
dbd0a46d75
1 changed files with 8 additions and 3 deletions
|
|
@ -39,13 +39,13 @@ public:
|
||||||
eoGenContinue( unsigned long _totalGens)
|
eoGenContinue( unsigned long _totalGens)
|
||||||
: repTotalGenerations( _totalGens ),
|
: repTotalGenerations( _totalGens ),
|
||||||
thisGenerationPlaceHolder(0),
|
thisGenerationPlaceHolder(0),
|
||||||
thisGeneration(thisGenerationPlaceHolder){};
|
thisGeneration(thisGenerationPlaceHolder), verbose(true) {};
|
||||||
|
|
||||||
/// Ctor for enabling the save/load the no. of generations counted
|
/// Ctor for enabling the save/load the no. of generations counted
|
||||||
eoGenContinue( unsigned long _totalGens, unsigned long& _currentGen)
|
eoGenContinue( unsigned long _totalGens, unsigned long& _currentGen)
|
||||||
: repTotalGenerations( _totalGens ),
|
: repTotalGenerations( _totalGens ),
|
||||||
thisGenerationPlaceHolder(0),
|
thisGenerationPlaceHolder(0),
|
||||||
thisGeneration(_currentGen){};
|
thisGeneration(_currentGen), verbose(true){};
|
||||||
|
|
||||||
/** Returns false when a certain number of generations is
|
/** Returns false when a certain number of generations is
|
||||||
* reached */
|
* reached */
|
||||||
|
|
@ -54,7 +54,8 @@ public:
|
||||||
// std::cout << " [" << thisGeneration << "] ";
|
// std::cout << " [" << thisGeneration << "] ";
|
||||||
if (thisGeneration >= repTotalGenerations)
|
if (thisGeneration >= repTotalGenerations)
|
||||||
{
|
{
|
||||||
std::cout << "STOP in eoGenContinue: Reached maximum number of generations [" << thisGeneration << "/" << repTotalGenerations << "]\n";
|
if (verbose)
|
||||||
|
std::cout << "STOP in eoGenContinue: Reached maximum number of generations [" << thisGeneration << "/" << repTotalGenerations << "]\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -72,12 +73,16 @@ public:
|
||||||
{
|
{
|
||||||
return repTotalGenerations;
|
return repTotalGenerations;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
virtual std::string className(void) const { return "eoGenContinue"; }
|
virtual std::string className(void) const { return "eoGenContinue"; }
|
||||||
private:
|
private:
|
||||||
unsigned long repTotalGenerations;
|
unsigned long repTotalGenerations;
|
||||||
unsigned long thisGenerationPlaceHolder;
|
unsigned long thisGenerationPlaceHolder;
|
||||||
unsigned long& thisGeneration;
|
unsigned long& thisGeneration;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool verbose; // allows to turn off annoying message to cout
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Reference in a new issue