* @return true if condition is satisfied and another generation can checked;
* false if condition is not satisfied and algorithm should stop.
*/
- virtual bool check(Generation<_Chromosome> generation) {
- if (currentGeneration >= maxNumberOfGenerations) {
- return false;
- }
+ virtual bool check(Generation<_Chromosome>) {
+ /* Initial population is never checked, as method is invoked after
+ * selection, crossover and mutation. It is safe to increment it now.
+ */
currentGeneration++;
- return true;
+ if (currentGeneration < maxNumberOfGenerations) {
+ return true;
+ }
+
+ return false;
}
};
}