eoParam, added specialization for eoValueParam<string>::getValue
FDCStat and FileSnapshot: better error messageing Scalar fitness: is now a vector of doubles exercise3.1 added gnuplot again Don't know about eoCombinedContinue
This commit is contained in:
parent
434010d221
commit
195ad72838
6 changed files with 56 additions and 46 deletions
|
|
@ -43,7 +43,7 @@ public:
|
|||
/// Define Fitness
|
||||
typedef typename EOT::Fitness FitnessType;
|
||||
|
||||
/// Ctor
|
||||
/// Ctor, make sure that at least on continuator is present
|
||||
eoCombinedContinue( eoContinue<EOT>& _cont)
|
||||
: eoContinue<EOT> ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -119,14 +119,14 @@ public:
|
|||
eoFileSnapshot(_dirname, _frequency, _filename, _delim),
|
||||
FDCstat(_FDCstat)
|
||||
{
|
||||
eoMonitor::add(FDCstat.theDist());
|
||||
eoMonitor::add(FDCstat.theFit());
|
||||
eoFileSnapshot::add(FDCstat.theDist());
|
||||
eoFileSnapshot::add(FDCstat.theFit());
|
||||
}
|
||||
|
||||
/** just to be sure the add method is not called further
|
||||
*/
|
||||
virtual void add(const eoParam& _param)
|
||||
{ throw runtime_error("Trying to add stats to an eoFDCFileSnapshot"); }
|
||||
{ throw runtime_error("eoFDCFileSnapshot::add(). Trying to add stats to an eoFDCFileSnapshot"); }
|
||||
|
||||
private:
|
||||
eoFDCStat<EOT> & FDCstat;
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public :
|
|||
{
|
||||
if (!dynamic_cast<const eoValueParam<vector<double> >*>(&_param))
|
||||
{
|
||||
throw logic_error("eoFileSnapshot: I can only monitor vectors of doubles, sorry");
|
||||
throw logic_error(string("eoFileSnapshot: I can only monitor vectors of doubles, sorry. The offending parameter name = ") + _param.longName());
|
||||
}
|
||||
eoMonitor::add(_param);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,16 @@ private :
|
|||
ValueType repValue;
|
||||
};
|
||||
|
||||
/*
|
||||
Specialization for string
|
||||
*/
|
||||
template <>
|
||||
std::string eoValueParam<std::string>::getValue(void) const
|
||||
{
|
||||
return repValue;
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
void eoValueParam<bool>::setValue(std::string _value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@
|
|||
The fitnesses of a whole population, as a vector
|
||||
*/
|
||||
template <class EOT, class FitT = typename EOT::Fitness>
|
||||
class eoScalarFitnessStat : public eoSortedStat<EOT, vector<FitT> >
|
||||
class eoScalarFitnessStat : public eoSortedStat<EOT, vector<double> >
|
||||
{
|
||||
public :
|
||||
eoScalarFitnessStat(std::string _description = "FitnessES") :
|
||||
eoSortedStat<EOT, vector<FitT> >(vector<FitT>(0), _description) {}
|
||||
eoSortedStat<EOT, vector<double> >(vector<double>(0), _description) {}
|
||||
|
||||
virtual void operator()(const vector<const EOT*>& _popPters)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ void main_function(int argc, char **argv)
|
|||
|
||||
// send a scaling command to gnuplot
|
||||
gnuMonitor.gnuplotCommand("set yrange [0:500]");
|
||||
/*
|
||||
|
||||
// a specific plot monitor for FDC
|
||||
// first into a file (it adds everything ti itself
|
||||
eoFDCFileSnapshot<Indi> fdcFileSnapshot(fdcStat);
|
||||
|
|
@ -338,7 +338,7 @@ void main_function(int argc, char **argv)
|
|||
fitSnapshot.add(fitStat);
|
||||
// and of course add it to the checkpoint
|
||||
checkpoint.add(fitSnapshot);
|
||||
*/
|
||||
|
||||
// Last type of item the eoCheckpoint can handle: state savers:
|
||||
eoState outState;
|
||||
// Register the algorithm into the state (so it has something to save!!)
|
||||
|
|
|
|||
Reference in a new issue