template < typename _Chromosome >
class Crossover {
public:
+ /**
+ * Type of probability of crossover chance
+ */
typedef double CrossoverChanceType;
+
+ /**
+ * Type representing Chromosome Gene
+ */
typedef typename _Chromosome::GeneType GeneType;
protected:
+ /**
+ * Probability of Crossover (0 = 0%, 1 = 100%)
+ */
CrossoverChanceType chance;
+ /**
+ * Crossover two Chromosome's between themself.
+ *
+ * @param first first Chromosome to Crossover
+ * @param second second Chromosome to Crossover
+ * @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) {
const unsigned int chromosomeSize = first.get().size();
}
public:
+ /**
+ * Class constructor. Initializes values.
+ *
+ * @param chance probability of Crossover (0 = 0%, 1 = 100%)
+ */
Crossover(CrossoverChanceType chance) :
chance(chance) {
}
+ /**
+ * Invokes Crossover calculations
+ *
+ * @param _generation Generation for which the crossover should be applied
+ * @return new Generation of Chromosome's after the Crossover
+ */
Generation<_Chromosome> cross(Generation<_Chromosome> _generation) {
const unsigned int generationSize = _generation.get().size();
vector<_Chromosome> newGeneration;