From: Rafał Długołęcki Date: Sun, 29 Mar 2015 19:54:22 +0000 (+0200) Subject: Cleanup code. X-Git-Url: https://git.dlugolecki.net.pl/?a=commitdiff_plain;h=0fae11625d18cbb4978c5eb84b7eac36ec597213;p=genetic.git Cleanup code. --- diff --git a/src/algorithm.h b/src/algorithm.h index c12dfce..162fdd0 100644 --- a/src/algorithm.h +++ b/src/algorithm.h @@ -67,11 +67,8 @@ namespace genetic { for(int i = 0; i < this->numberOfGenerations; i++) { cout << i; _Selection selection(this->generation, fitness); -// cout << "[+] Algorithm::Selection.draw()\n"; this->generation = selection.draw(); -// cout << "[+] Crossover\n"; this->generation = crossover.cross(this->generation); -// cout << "[+] Mutate\n"; this->generation = mutation.mutate(this->generation); // cout << "New Generation:\n"; @@ -90,25 +87,20 @@ namespace genetic { cout << "\n"; } } - + void showAvgFitness() { double avg = 0; -// cout << "Fitness:\n"; for (unsigned int i = 0; i < this->generation.get().size(); i++) { -// cout << "# " << i << ") "; WSTI<_Chromosome, FitnessValueType> fit(this->generation.get()[i], 0.5, 2.5); -// cout << fit.calculate() << "\n"; avg += fit.calculate(); } cout << " " << avg / this->generation.get().size(); } - + void showBestFitness() { double best = -100000; for (unsigned int i = 0; i < this->generation.get().size(); i++) { -// cout << "# " << i << ") "; WSTI<_Chromosome, FitnessValueType> fit(this->generation.get()[i], 0.5, 2.5); -// cout << fit.calculate() << "\n"; double tmp = fit.calculate(); if (tmp > best) { best = tmp; diff --git a/src/mutation/mutation.h b/src/mutation/mutation.h index 014ca70..20d7873 100644 --- a/src/mutation/mutation.h +++ b/src/mutation/mutation.h @@ -9,7 +9,7 @@ using namespace std; namespace genetic { -// namespace crossover { +// namespace mutation { template < typename _Chromosome> class Mutation { public: