1234567891011121314151617181920212223 |
- #ifndef PERMUTATION_H
- #define PERMUTATION_H
- #include <vector>
- // permutation with fixpoint pi[0]=0
- class permutation {
- public:
- permutation(int size); // initialize to identity
- void transpose(int i, int j);
- void random();
- int operator[](int i); // return the image of i (i and its image 0-based)
- bool check(); // check invariant : sigma[0] = 0 and it is a permutation
- int get_size();
- friend permutation permutation_crossover(permutation &a, permutation &b);
- protected:
- int size;
- std::vector<int> sigma; // sigma[i] is the image of i
- };
- permutation permutation_crossover(permutation &a, permutation &b);
- #endif // PERMUTATION_H
|