Big optimizations and securing code.
[genetic.git] / include / crossover / crossover.h
index 4d38ba0ea824da0b94bd20622c0b4a540a93e181..395ac60636c21fc788a969736babcb6d4f70228b 100644 (file)
@@ -34,7 +34,7 @@ namespace genetic {
              * @param splitPlace Gene number on which the Genes should be swapped
              * @return new Chromosome crossed between given two
              */
-            _Chromosome do_cross(_Chromosome& first, _Chromosome& second, unsigned int splitPlace) {
+            _Chromosome do_cross(_Chromosome& first, _Chromosome& second, const unsigned int splitPlace) {
                 const unsigned int chromosomeSize = first.size();
 
 //                 cout << "        ";
@@ -80,7 +80,7 @@ namespace genetic {
              *
              * @param chance probability of Crossover (0 = 0%, 1 = 100%)
              */
-            Crossover(CrossoverChanceType chance) :
+            Crossover(const CrossoverChanceType& chance) :
                 chance(chance) {
             }
 
@@ -92,7 +92,7 @@ namespace genetic {
              */
             Generation<_Chromosome> cross(Generation<_Chromosome>& _generation) {
                 const unsigned int generationSize = _generation.size();
-                vector<_Chromosome> newGeneration;
+                std::vector<_Chromosome> newGeneration;
 
                 for (unsigned int i = 0; i < generationSize; i++) {
                     CrossoverChanceType random = (rand() + 1 % 10000) / 10000.0;