#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 {
/**
/**
* Type of probability of mutation chance
*/
- typedef double MutationChanceType;
+ typedef float MutationChanceType;
/**
* Type representing Chromosome Gene
*
* @param chance Chance on which Mutation can occur.
*/
- Mutation(MutationChanceType chance) :
+ Mutation(const MutationChanceType& chance) :
chance(chance) {
}
* @param _generation Generation for which the mutation should be applied
* @return new Generation of Chromosome's that passed the mutation
*/
- Generation<_Chromosome> mutate(Generation<_Chromosome> _generation) {
+ 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;