ECF 1.5
Permutation.h
1#ifndef PERMUTATION_H_
2#define PERMUTATION_H_
3
4#include "PermutationCrsPMX.h"
5#include "PermutationMutToggle.h"
6#include "PermutationMutIns.h"
7#include "PermutationMutInv.h"
8#include "PermutationCrsPBX.h"
9#include "PermutationCrsOX.h"
10#include "PermutationCrsCOSA.h"
11#include "PermutationCrsCyclic.h"
12#include "PermutationCrsCyclic2.h"
13#include "PermutationCrsOBX.h"
14#include "PermutationCrsULX.h"
15#include "PermutationCrsOX2.h"
16#include "PermutationCrsOPX.h"
17#include "PermutationCrsSPX.h"
18#include "PermutationCrsDPX.h"
19#include "PermutationCrsUPMX.h"
20
21
22#include "../Genotype.h"
23
24
25namespace Permutation
26{
27
37class Permutation: public Genotype {
38protected:
39 uint size_;
40public:
41 typedef std::vector<int> var;
42 var variables;
43
44 Permutation () {name_ = "Permutation";}
45
46 uint getSize()
47 { return size_; }
48
49 bool initialize (StateP state);
50
51 void registerParameters(StateP state);
52
54 {
55 Permutation *newObject = new Permutation(*this);
56 return newObject;
57 }
58
59 std::vector<CrossoverOpP> getCrossoverOp()
60 {
61 std::vector<CrossoverOpP> crx;
62 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsPMX));
63 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsPBX));
64 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOX));
65 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsCOSA));
66 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsCyclic));
67 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsCyclic2));
68 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOBX));
69 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsULX));
70 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOX2));
71 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsOPX));
72 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsSPX));
73 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsDPX));
74 crx.push_back(static_cast<CrossoverOpP> (new PermutationCrsUPMX));
75 return crx;
76 }
77
78 std::vector<MutationOpP> getMutationOp()
79 {
80 std::vector<MutationOpP> mut;
81 mut.push_back(static_cast<MutationOpP> (new PermutationMutToggle));
82 mut.push_back(static_cast<MutationOpP> (new PermutationMutIns));
83 mut.push_back(static_cast<MutationOpP> (new PermutationMutInv));
84 return mut;
85
86 }
87
88 void write(XMLNode&);
89 void read(XMLNode&);
90};
91}
92
93typedef boost::shared_ptr<Permutation::Permutation> PermutationP;
94#endif
Genotype base class.
Definition: Genotype.h:36
Permutation genotype: COSA crossover operator (adapted from HeuristicLab)
Permutation genotype: Cyclic version 2 crossover operator (adapted from HeuristicLab)
Permutation genotype: Cyclic crossover operator (see e.g. http://www.rubicite.com/Tutorials/GeneticAl...
Permutation genotype: DPX crossover operator (see e.g. itc.ktu.lt/itc342/Misev342....
Permutation genotype: Order based crossover operator (see e.g. http://dx.doi.org/10....
Permutation genotype: OPX crossover operator (see e.g. itc.ktu.lt/itc342/Misev342....
Permutation genotype: Order crossover operator variant where algorithm starts from the beginning when...
Permutation genotype: OX crossover operator (see e.g. http://dx.doi.org/10.1016/j....
Permutation genotype: PBX crossover operator (see e.g. http://dx.doi.org/10.1016/j....
Permutation genotype: PMX crossover operator (see e.g. http://dx.doi.org/10.1016/j....
Permutation genotype: SPX crossover operator (see e.g. itc.ktu.lt/itc342/Misev342....
Permutation genotype: Uniform like crossover operator (see e.g. itc.ktu.lt/itc342/Misev342....
Permutation genotype: UMPX crossover operator (see e.g. itc.ktu.lt/itc342/Misev342....
Permutation class - implements genotype as a vector of indices 0..(n-1) (permutation of indices)
Definition: Permutation.h:37
Permutation * copy()
Create an identical copy of the genotype object.
Definition: Permutation.h:53
uint size_
permutation vector size
Definition: Permutation.h:39
std::vector< CrossoverOpP > getCrossoverOp()
Create and return a vector of crossover operators.
Definition: Permutation.h:59
std::vector< MutationOpP > getMutationOp()
Create and return a vector of mutation operators.
Definition: Permutation.h:78
Permutation genotype: insert mutation operator (see e.g. http://dx.doi.org/10.1016/j....
Permutation genotype: inversion mutation operator (see e.g. http://dx.doi.org/10.1016/j....
Permutation genotype: toggle mutation operator (see e.g. http://dx.doi.org/10.1016/j....