1 #ifndef __CONDITION_CONDITION_H
2 #define __CONDITION_CONDITION_H
4 #include "chromosome.h"
5 #include "generation.h"
11 * Base Condition class.
12 * It is used for checking if algorithm should stop.
14 template < typename _Chromosome>
18 * Check calculations for current generation if it passes stop condition
19 * If condition is satisfied, we can check another generation.
20 * All the custom Condition checks should be invoked in this method.
22 * @param generation current generation to check
24 * @return true if condition is satisfied and another generation can checked;
25 * false if condition is not satisfied and algorithm should stop.
27 virtual bool do_check(Generation<_Chromosome>) = 0;
31 * Checks if current generation passes stop condition.
32 * If condition is satisfied, we can check another generation.
34 * @param generation current generation to check
36 * @return true if condition is satisfied and another generation can checked;
37 * false if condition is not satisfied and algorithm should stop.
39 bool check(Generation<_Chromosome> generation) {
40 return do_check(generation);
45 #endif /* __CONDITION_CONDITION_H */