fix #13: remove the use of the verbose members, replaced by the eo::log system ; functions prototypes keep their verbose parameters, but display a warning until next version
This commit is contained in:
parent
77e97a6ba0
commit
a9f382a30c
7 changed files with 32 additions and 37 deletions
|
|
@ -44,15 +44,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The usual method to add objects to the combination
|
/** The usual method to add objects to the combination
|
||||||
* note the _verbose parameter, that allows to print what's
|
|
||||||
* inside the combination with scaled rates
|
|
||||||
*/
|
*/
|
||||||
void add(eoInit<EOT> & _init, double _rate, bool _verbose=false)
|
void add(eoInit<EOT> & _init, double _rate, bool _verbose=false)
|
||||||
{
|
{
|
||||||
|
eo::log << eo::warnings << "WARNING: the use of the verbose parameter in eoCombinedInit::add is deprecated and will be removed in the next release." << std::endl;
|
||||||
|
|
||||||
initializers.push_back(&_init);
|
initializers.push_back(&_init);
|
||||||
rates.push_back(_rate);
|
rates.push_back(_rate);
|
||||||
// compute the relative rates in percent - to warn the user!
|
// compute the relative rates in percent - to warn the user!
|
||||||
if (_verbose)
|
|
||||||
printOn( eo::log << eo::logging );
|
printOn( eo::log << eo::logging );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,14 +42,16 @@ public:
|
||||||
: eoValueParam<unsigned>(0, "Generations", "Generations"),
|
: eoValueParam<unsigned>(0, "Generations", "Generations"),
|
||||||
repTotalGenerations( _totalGens ),
|
repTotalGenerations( _totalGens ),
|
||||||
thisGenerationPlaceHolder(0),
|
thisGenerationPlaceHolder(0),
|
||||||
thisGeneration(thisGenerationPlaceHolder), verbose(true) {};
|
thisGeneration(thisGenerationPlaceHolder)
|
||||||
|
{};
|
||||||
|
|
||||||
/// 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)
|
||||||
: eoValueParam<unsigned>(0, "Generations", "Generations"),
|
: eoValueParam<unsigned>(0, "Generations", "Generations"),
|
||||||
repTotalGenerations( _totalGens ),
|
repTotalGenerations( _totalGens ),
|
||||||
thisGenerationPlaceHolder(0),
|
thisGenerationPlaceHolder(0),
|
||||||
thisGeneration(_currentGen), verbose(true){};
|
thisGeneration(_currentGen)
|
||||||
|
{};
|
||||||
|
|
||||||
/** Returns false when a certain number of generations is
|
/** Returns false when a certain number of generations is
|
||||||
* reached */
|
* reached */
|
||||||
|
|
@ -60,7 +62,6 @@ public:
|
||||||
|
|
||||||
if (thisGeneration >= repTotalGenerations)
|
if (thisGeneration >= repTotalGenerations)
|
||||||
{
|
{
|
||||||
if (verbose)
|
|
||||||
eo::log << eo::logging << "STOP in eoGenContinue: Reached maximum number of generations [" << thisGeneration << "/" << repTotalGenerations << "]\n";
|
eo::log << eo::logging << "STOP in eoGenContinue: Reached maximum number of generations [" << thisGeneration << "/" << repTotalGenerations << "]\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -97,9 +98,6 @@ 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
|
||||||
|
|
|
||||||
|
|
@ -176,10 +176,11 @@ virtual std::string className() const { return "eoPropCombinedQuadOp"; }
|
||||||
// addition of a true operator
|
// addition of a true operator
|
||||||
virtual void add(eoQuadOp<EOT> & _op, const double _rate, bool _verbose=false)
|
virtual void add(eoQuadOp<EOT> & _op, const double _rate, bool _verbose=false)
|
||||||
{
|
{
|
||||||
|
eo::log << eo::warnings << "WARNING: the use of the verbose parameter in eoPropCombinedQuadOp::add is deprecated and will be removed in the next release." << std::endl;
|
||||||
|
|
||||||
ops.push_back(&_op);
|
ops.push_back(&_op);
|
||||||
rates.push_back(_rate);
|
rates.push_back(_rate);
|
||||||
// compute the relative rates in percent - to warn the user!
|
// compute the relative rates in percent - to warn the user!
|
||||||
if (_verbose)
|
|
||||||
printOn( eo::log << eo::logging );
|
printOn( eo::log << eo::logging );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,6 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// some defines to make things easier to get at first sight
|
// some defines to make things easier to get at first sight
|
||||||
|
|
||||||
// tuning the amount of output using a boolean argument:
|
|
||||||
// true should always mean more output
|
|
||||||
#define eo_verbose true
|
|
||||||
#define eo_no_verbose false
|
|
||||||
// to be used in selection / replacement procedures to indicate whether
|
// to be used in selection / replacement procedures to indicate whether
|
||||||
// the argument (rate, a double) shoudl be treated as a rate (number=rate*popSize)
|
// the argument (rate, a double) shoudl be treated as a rate (number=rate*popSize)
|
||||||
// or as an absolute integer (number=rate regardless of popsize).
|
// or as an absolute integer (number=rate regardless of popsize).
|
||||||
|
|
|
||||||
|
|
@ -25,38 +25,33 @@ eoMonitor& eoOStreamMonitor::operator()(void)
|
||||||
|
|
||||||
if (firsttime) {
|
if (firsttime) {
|
||||||
|
|
||||||
if (verbose) {
|
|
||||||
eo::log << eo::progress << "First Generation" << std::endl;
|
eo::log << eo::progress << "First Generation" << std::endl;
|
||||||
|
|
||||||
} else { // else verbose
|
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
||||||
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
out << (*it)->longName ();
|
||||||
out << (*it)->longName ();
|
out << delim << std::left << std::setfill(fill) << std::setw(width);
|
||||||
out << delim << std::left << std::setfill(fill) << std::setw(width);
|
}
|
||||||
}
|
out << std::endl;
|
||||||
out << std::endl;
|
|
||||||
} // else verbose
|
|
||||||
|
|
||||||
firsttime = false;
|
firsttime = false;
|
||||||
} // if firstime
|
} // if firstime
|
||||||
|
|
||||||
// ok, now the real saving. write out
|
// ok, now the real saving. write out
|
||||||
if (verbose) {
|
/* TODO old verbose formatting, do we still need it?
|
||||||
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
||||||
// name: value
|
// name: value
|
||||||
out << (*it)->longName () << ": " << (*it)->getValue () << std::endl;
|
out << (*it)->longName () << ": " << (*it)->getValue () << std::endl;
|
||||||
} // for it in vec
|
} // for it in vec
|
||||||
|
*/
|
||||||
|
|
||||||
eo::log << eo::progress << "End of Generation" << std::endl;
|
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
||||||
|
// value only
|
||||||
|
out << (*it)->getValue ();
|
||||||
|
out << delim << std::left << std::setfill(fill) << std::setw(width);
|
||||||
|
} // for it in vec
|
||||||
|
|
||||||
} else { // else verbose
|
out << std::endl;
|
||||||
for (iterator it = vec.begin (); it != vec.end (); ++it) {
|
eo::log << eo::progress << "End of Generation" << std::endl;
|
||||||
// value only
|
|
||||||
out << (*it)->getValue ();
|
|
||||||
out << delim << std::left << std::setfill(fill) << std::setw(width);
|
|
||||||
} // for it in vec
|
|
||||||
|
|
||||||
out << std::endl;
|
|
||||||
} // if verbose
|
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,10 @@ class eoOStreamMonitor : public eoMonitor
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
eoOStreamMonitor( std::ostream & _out, bool _verbose=true, std::string _delim = "\t", unsigned int _width=20, char _fill=' ' ) :
|
eoOStreamMonitor( std::ostream & _out, bool _verbose=true, std::string _delim = "\t", unsigned int _width=20, char _fill=' ' ) :
|
||||||
out(_out), verbose(_verbose), delim(_delim), width(_width), fill(_fill), firsttime(true) {}
|
out(_out), delim(_delim), width(_width), fill(_fill), firsttime(true)
|
||||||
|
{
|
||||||
|
eo::log << eo::warnings << "WARNING: the use of the verbose parameter in eoOStreamMonitor constructor is deprecated and will be removed in the next release" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
eoMonitor& operator()(void);
|
eoMonitor& operator()(void);
|
||||||
|
|
||||||
|
|
@ -51,7 +54,6 @@ public :
|
||||||
|
|
||||||
private :
|
private :
|
||||||
std::ostream & out;
|
std::ostream & out;
|
||||||
bool verbose;
|
|
||||||
std::string delim;
|
std::string delim;
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
char fill;
|
char fill;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,11 @@ class eoStdoutMonitor : public eoOStreamMonitor
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
eoStdoutMonitor(bool _verbose=true, std::string _delim = "\t", unsigned int _width=20, char _fill=' ' ) :
|
eoStdoutMonitor(bool _verbose=true, std::string _delim = "\t", unsigned int _width=20, char _fill=' ' ) :
|
||||||
eoOStreamMonitor( std::cout, _verbose, _delim, _width, _fill) {}
|
eoOStreamMonitor( std::cout, _verbose, _delim, _width, _fill)
|
||||||
|
{
|
||||||
|
|
||||||
|
eo::log << eo::warnings << "WARNING: the use of the verbose parameter in eoStdutMonitor constructor is deprecated and will be removed in the next release" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
virtual std::string className(void) const { return "eoStdoutMonitor"; }
|
virtual std::string className(void) const { return "eoStdoutMonitor"; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Reference in a new issue