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 "../Genotype.h"
00011
00012
00013 namespace Permutation
00014 {
00015
00025 class Permutation: public Genotype {
00026 protected:
00027 uint size_;
00028 public:
00029 typedef std::vector<int> var;
00030 var variables;
00031
00032 Permutation () {name_ = "Permutation";}
00033
00034 uint getSize()
00035 { return size_; }
00036
00037 bool initialize (StateP state);
00038
00039 void registerParameters(StateP state);
00040
00041 Permutation* copy()
00042 {
00043 Permutation *newObject = new Permutation(*this);
00044 return newObject;
00045 }
00046
00047 std::vector<CrossoverOpP> getCrossoverOp()
00048 {
00049 std::vector<CrossoverOpP> crx;
00050 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsPMX));
00051 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsPBX));
00052 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOX));
00053 return crx;
00054 }
00055
00056 std::vector<MutationOpP> getMutationOp()
00057 {
00058 std::vector<MutationOpP> mut;
00059 mut.push_back(static_cast<MutationOpP> (new PermutationMutToggle));
00060 mut.push_back(static_cast<MutationOpP> (new PermutationMutIns));
00061 mut.push_back(static_cast<MutationOpP> (new PermutationMutInv));
00062 return mut;
00063
00064 }
00065
00066 void write(XMLNode&);
00067 void read(XMLNode&);
00068 };
00069 }
00070
00071 typedef boost::shared_ptr<Permutation::Permutation> PermutationP;
00072 #endif