#include "condition.h"
-using namespace std;
-
namespace genetic {
/**
* Condition class. It is used for checking if algorithm should stop after
*/
template < typename _Chromosome>
class GenerationLimitCondition : public Condition<_Chromosome> {
- public:
protected:
/**
* Variable indicating current generation
* @return true if limit is not reached and another iteration of
* calculations should be started, false otherwise
*/
- bool do_check(Generation<_Chromosome>) {
+ bool do_check(const Generation<_Chromosome> &) {
/* Initial population is never checked, as method is invoked after
* selection, crossover and mutation. It is safe to increment it now.
*/
*
* @param limit number of generations after which algorithm should stop
*/
- GenerationLimitCondition(unsigned int limit)
+ GenerationLimitCondition(const unsigned int limit)
: maxNumberOfGenerations(limit) {
}
};