X-Git-Url: https://git.dlugolecki.net.pl/?p=genetic.git;a=blobdiff_plain;f=include%2Fcondition%2FgenerationLimitCondition.h;h=3101191d8d31ad5f1804d02a529612db082d552a;hp=ffe977f3430a494411944cbecce1e764662b1b2e;hb=1e175fb658e55f4cc8b894fff288be22998e78af;hpb=2a8fc81203107eb3495a50fb2666803fda3e0517 diff --git a/include/condition/generationLimitCondition.h b/include/condition/generationLimitCondition.h index ffe977f..3101191 100644 --- a/include/condition/generationLimitCondition.h +++ b/include/condition/generationLimitCondition.h @@ -6,8 +6,6 @@ #include "condition.h" -using namespace std; - namespace genetic { /** * Condition class. It is used for checking if algorithm should stop after @@ -15,7 +13,6 @@ namespace genetic { */ template < typename _Chromosome> class GenerationLimitCondition : public Condition<_Chromosome> { - public: protected: /** * Variable indicating current generation @@ -34,7 +31,7 @@ namespace genetic { * @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. */ @@ -52,7 +49,7 @@ namespace genetic { * * @param limit number of generations after which algorithm should stop */ - GenerationLimitCondition(unsigned int limit) + GenerationLimitCondition(const unsigned int limit) : maxNumberOfGenerations(limit) { } };