Remove some not used namespace declarations.
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Fri, 1 May 2015 07:54:23 +0000 (09:54 +0200)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Fri, 1 May 2015 07:54:23 +0000 (09:54 +0200)
12 files changed:
include/chromosome.h
include/condition/condition.h
include/condition/generationLimitCondition.h
include/crossover/crossover.h
include/generation.h
include/generator/bitGenerator.h
include/generator/generator.h
include/mutation/mutation.h
include/selection/linearRankSelection.h
include/selection/rouletteSelection.h
include/selection/selection.h
src/main.cpp

index 378300aa5621f138992d2d06e50b71ce096eb86f..bad2bdd410efb1805e72b6a4b3715a4888cf7750 100644 (file)
@@ -5,8 +5,6 @@
 
 #include "gene.h"
 
-using namespace std;
-
 namespace genetic {
     /**
      * Chromosome of given Genes.
index 2b175751fb66d15510ae3380d36d28b7c0a8102c..29ac133194254e03896dde7bf2d41e2e18de93f0 100644 (file)
@@ -4,8 +4,6 @@
 #include "chromosome.h"
 #include "generation.h"
 
-using namespace std;
-
 namespace genetic {
     /**
      * Base Condition class.
index e120a9655a99bbf1f3b04409677c44a733ac2c6a..3101191d8d31ad5f1804d02a529612db082d552a 100644 (file)
@@ -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
index 395ac60636c21fc788a969736babcb6d4f70228b..3befaed60c50698b904ba945afe18230f3aabf2b 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __CROSSOVER_CROSSOVER_H
 #define __CROSSOVER_CROSSOVER_H
 
+#include <vector>
+
 #include "chromosome.h"
 #include "generation.h"
 
@@ -55,7 +57,7 @@ namespace genetic {
 //                     }
 //                 }
 
-                vector<GeneType> crossedChromosome;
+                std::vector<GeneType> crossedChromosome;
                 for (unsigned int i = 0; i < chromosomeSize; i++) {
                     if (i < splitPlace) {
                         crossedChromosome.push_back(first[i].get());
index f460a7fbe62cc408a6034b8ad42bf84420d9f78d..5dab37c2d5ae070fe210e20e4a8d0896e45339a2 100644 (file)
@@ -3,10 +3,8 @@
 
 #include <vector>
 
-#include <gene.h>
-#include <chromosome.h>
-
-using namespace std;
+#include "gene.h"
+#include "chromosome.h"
 
 namespace genetic {
     /**
@@ -18,7 +16,7 @@ namespace genetic {
         /**
          * Chromosomes in the given Generation
          */
-        vector<_Chromosome> chromosomes;
+        std::vector<_Chromosome> chromosomes;
 
         template<typename> friend class Generation;
     public:
index 8e92521a608e7c553f1689600dd0d622f1828232..3b93420248386d3f5a85d5f9db2a0af895c4a100 100644 (file)
@@ -52,7 +52,7 @@ namespace genetic {
              * @param generationSize Indicates size of the generation
              * @param chromosomeSize Indicates size of the chromosome
              */
-            BitGenerator(unsigned int generationSize, unsigned int chromosomeSize)
+            BitGenerator(const unsigned int generationSize, const unsigned int chromosomeSize)
                 : Generator<_Chromosome>(generationSize, chromosomeSize) {
             }
         };
index 64f2720820530fadb84d1b1fabc94deb76598864..b9e5680757a648f7d4d87c2585b55aef0c55e89c 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __GENERATOR_GENERATOR_H
 #define __GENERATOR_GENERATOR_H
 
+#include <ctime>
 #include <cstdlib>
 
 #include "../gene.h"
@@ -25,12 +26,12 @@ namespace genetic {
             /**
              * Size of the generation to generate
              */
-            unsigned int generationSize;
+            const unsigned int generationSize;
 
             /**
              * Size of the chromosome to generate
              */
-            unsigned int chromosomeSize;
+            const unsigned int chromosomeSize;
 
             /**
              * Breeding calculations should be done here...
@@ -46,9 +47,8 @@ namespace genetic {
              * @param generationSize Indicates size of the generation
              * @param chromosomeSize Indicates size of the chromosome
              */
-            Generator(unsigned int generationSize, unsigned int chromosomeSize) {
-                this->generationSize = generationSize;
-                this->chromosomeSize = chromosomeSize;
+            Generator(const unsigned int generationSize, const unsigned int chromosomeSize)
+                : generationSize(generationSize), chromosomeSize(chromosomeSize) {
 
                 time_t t;
                 srand((unsigned)time(&t));
index 49b6094649c9bc09b15003df1f89593846746d51..6c2b853b0855e72f89c75c6922e84a6835d96f7e 100644 (file)
@@ -1,13 +1,11 @@
 #ifndef __MUTATION_MUTATION_H
 #define __MUTATION_MUTATION_H
 
-#include <iostream>
+#include <vector>
 
 #include "chromosome.h"
 #include "generation.h"
 
-using namespace std;
-
 namespace genetic {
 //     namespace mutation {
         /**
@@ -51,7 +49,7 @@ namespace genetic {
             Generation<_Chromosome> mutate(Generation<_Chromosome>& _generation) {
                 const unsigned int generationSize = _generation.size();
                 const unsigned int chromosomeSize = _generation[0].size();
-                vector<_Chromosome> newGeneration;
+                std::vector<_Chromosome> newGeneration;
 
                 for (unsigned int i = 0; i < generationSize; i++) {
                     MutationChanceType random = (rand() % 10000) / 10000.0;
index ee119d60543490f41bd932f94ba9e2c255c46e45..16a3cf82a469340077cfdabb62e6d33f51200d69 100644 (file)
@@ -8,8 +8,6 @@
 #include "fitness/fitness.h"
 #include "selection/selection.h"
 
-using namespace std;
-
 namespace genetic {
 //     namespace selection {
         /**
index afb3ac7f74828a4c0dfe8c1e28ef6b29aac354e3..bd4e67ca3bfd6ccf191a52933e29e7f59dbde58c 100644 (file)
@@ -8,8 +8,6 @@
 #include "chromosome.h"
 #include "selection.h"
 
-using namespace std;
-
 namespace genetic {
 //     namespace selection {
         /**
index 187db12802fc22ee152e211a96e27ad2d33e2362..de899c11d24b1b840ebe6c0a31e2831e2cfaa0c3 100644 (file)
@@ -5,8 +5,6 @@
 #include "generation.h"
 #include "../fitness/fitness.h"
 
-using namespace std;
-
 namespace genetic {
 //     namespace selection {
         /**
index ccaa43e3c497a281316f3f3011a262b590d678ee..a208bbf863505071fd5af846174d223d045840c2 100644 (file)
@@ -1,8 +1,3 @@
-#include <iostream>
-#include <vector>
-#include <map>
-#include <string>
-
 #include "gene.h"
 #include "chromosome.h"
 #include "generation.h"
@@ -18,7 +13,6 @@
 #include "condition/condition.h"
 #include "condition/generationLimitCondition.h"
 
-using namespace std;
 using namespace genetic;
 
 int main() {