00001 #ifndef PERMUTATION_H_
00002 #define PERMUTATION_H_
00003
00004 #include "PermutationCrsPMX.h"
00005 #include "PermutationMutToggle.h"
00006 #include "PermutationMutIns.h"
00007 #include "PermutationMutInv.h"
00008 #include "PermutationCrsPBX.h"
00009 #include "PermutationCrsOX.h"
00010 #include "PermutationCrsCOSA.h"
00011 #include "PermutationCrsCyclic.h"
00012 #include "PermutationCrsCyclic2.h"
00013 #include "PermutationCrsOBX.h"
00014 #include "PermutationCrsULX.h"
00015 #include "PermutationCrsOX2.h"
00016 #include "PermutationCrsOPX.h"
00017 #include "PermutationCrsSPX.h"
00018 #include "PermutationCrsDPX.h"
00019 #include "PermutationCrsUPMX.h"
00020
00021
00022 #include "../Genotype.h"
00023
00024
00025 namespace Permutation
00026 {
00027
00037 class Permutation: public Genotype {
00038 protected:
00039 uint size_;
00040 public:
00041 typedef std::vector<int> var;
00042 var variables;
00043
00044 Permutation () {name_ = "Permutation";}
00045
00046 uint getSize()
00047 { return size_; }
00048
00049 bool initialize (StateP state);
00050
00051 void registerParameters(StateP state);
00052
00053 Permutation* copy()
00054 {
00055 Permutation *newObject = new Permutation(*this);
00056 return newObject;
00057 }
00058
00059 std::vector<CrossoverOpP> getCrossoverOp()
00060 {
00061 std::vector<CrossoverOpP> crx;
00062 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsPMX));
00063 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsPBX));
00064 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOX));
00065 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsCOSA));
00066 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsCyclic));
00067 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsCyclic2));
00068 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOBX));
00069 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsULX));
00070 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOX2));
00071 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOPX));
00072 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsSPX));
00073 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsDPX));
00074 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsUPMX));
00075 return crx;
00076 }
00077
00078 std::vector<MutationOpP> getMutationOp()
00079 {
00080 std::vector<MutationOpP> mut;
00081 mut.push_back(static_cast<MutationOpP> (new PermutationMutToggle));
00082 mut.push_back(static_cast<MutationOpP> (new PermutationMutIns));
00083 mut.push_back(static_cast<MutationOpP> (new PermutationMutInv));
00084 return mut;
00085
00086 }
00087
00088 void write(XMLNode&);
00089 void read(XMLNode&);
00090 };
00091 }
00092
00093 typedef boost::shared_ptr<Permutation::Permutation> PermutationP;
00094 #endif