![]() |
CMR
1.3.0
|
#include <permutations.hpp>
Public Types | |
| typedef size_t | size_type |
| typedef std::vector< permutation::value_type > | memberlist_type |
| typedef std::pair< memberlist_type *, permutation * > | groupinfo_type |
| typedef std::map< int, groupinfo_type > | state_type |
Public Member Functions | |
| permutation_enumerator (permutation::size_type size) | |
| permutation_enumerator (const std::vector< permutation::value_type > &groups) | |
| virtual | ~permutation_enumerator () |
| bool | empty () |
| virtual bool | enumerate () |
Protected Member Functions | |
| virtual bool | visitor (const permutation &perm)=0 |
Enumerates all permutations of a given size with optional constraints. You must derive from it and override the visitor() method.
| typedef std::pair<memberlist_type*, permutation*> tu::permutation_enumerator::groupinfo_type |
| typedef std::vector<permutation::value_type> tu::permutation_enumerator::memberlist_type |
| typedef size_t tu::permutation_enumerator::size_type |
| typedef std::map<int, groupinfo_type> tu::permutation_enumerator::state_type |
|
inline |
Constructs an enumerator without constraints. Has O(size!) running time.
| size | Size of the permutations |
|
inline |
Constructs an enumerator with grouping constraints: Only those permutations are enumerated where k and p(k) are in the same group for all i.
| groups | Vector of groups |
|
inlinevirtual |
Destructor.
|
inline |
|
inlinevirtual |
Starts the enumeration which is aborted if any visitor returns false.
|
protectedpure virtual |
Method which is called for each enumerated permutation. Needs to be overridden.
| perm | Current permutation |