Added a comment to stdout upon termination - so we know why we stop in case
of multiple criteria
This commit is contained in:
parent
5aa258fbcb
commit
e4b735b17f
2 changed files with 15 additions and 3 deletions
|
|
@ -47,8 +47,15 @@ public:
|
|||
* reached. Assumes pop is not sorted! */
|
||||
virtual bool operator() ( const eoPop<EOT>& _pop )
|
||||
{
|
||||
return (_pop.nth_element_fitness(0) < maximum);
|
||||
}
|
||||
FitnessType bestCurrentFitness = _pop.nth_element_fitness(0);
|
||||
if (bestCurrentFitness >= maximum)
|
||||
{
|
||||
cout << "STOP in eoFitContinue: Best fitness has reached " <<
|
||||
bestCurrentFitness << "\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
FitnessType maximum;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,12 @@ public:
|
|||
virtual bool operator() ( const eoPop<EOT>& _vEO ) {
|
||||
thisGeneration++;
|
||||
// cout << " [" << thisGeneration << "] ";
|
||||
return (thisGeneration < repTotalGenerations) ; // for the postincrement
|
||||
if (thisGeneration >= repTotalGenerations)
|
||||
{
|
||||
cout << "STOP in eoGenContinue: Reached maximum number of generations\n";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Sets the number of generations to reach
|
||||
|
|
|
|||
Reference in a new issue