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