MTK++ Latest version: 0.2.0

gaCrossOver.h
Go to the documentation of this file.
00001 
00041 #ifndef GACROSSOVER_H
00042 #define GACROSSOVER_H
00043 
00044 #include <iostream>
00045 #include <string>
00046 #include <vector>
00047 
00048 #include "Utils/constants.h"
00049 
00050 namespace MTKpp
00051 {
00052 
00053 class gaOutput;
00054 class gaPopulation;
00055 class gaIndividual;
00056 
00057 // ============================================================
00058 // Class : gaCrossOver()
00059 // ------------------------------------------------------------
00067 // ============================================================
00068 
00069 class gaCrossOver
00070 {
00071 public:
00072 
00081     gaCrossOver(gaOutput *out, std::vector<int> genePerChr, int nChild = 1, 
00082                 std::string crossover = "random-locus", int chrPerInd = 1);
00083 
00085     virtual ~gaCrossOver();
00086 
00095     bool reproduce(gaIndividual* ind1, gaIndividual* ind2, gaPopulation* pop, std::string name);
00096 
00097 protected:
00098 
00115     bool __singleGene(gaIndividual* newInd, gaIndividual* parent);
00116 
00132     bool __multipleGene(gaIndividual* newInd, gaIndividual* parent);
00133 
00151     bool __randomLocus(gaIndividual* newInd, gaIndividual* parent);
00152 
00153 protected:
00154 
00156     gaOutput*                     pGaOutput;
00157 
00159     int                           nChild;
00160 
00162     std::string                   crossover;
00163 
00165     int                           chrPerInd;
00166 
00168     std::vector<int>              genePerChr;
00169 };
00170 
00171 } // MTKpp namespace
00172 
00173 #endif // GACROSSOVER_H

Generated on Fri Dec 23 2011 09:28:50 for MTK++ by Doxygen 1.7.5.1