#include <NChooseKBitset.hpp>
Inheritance diagram for NChooseKBitset< N0 >:
Public Member Functions | |
| NChooseKBitset () | |
| Default constructor. | |
| void | setUseConstraint (bool x) |
| Turn on/off usage of constraint function in choose() and generate(). | |
| virtual void | choose () |
| Find all subsets. | |
| virtual bool | constraint (const bitset< N0 > &x) |
| A constraint function for selecting interesting subset of subset generated. Called by choose(). | |
Public Attributes | |
| int | N |
| Number of elements in set. | |
| int | K |
| Number of elements to choose. | |
| std::vector< bitset< N0 > > | subset |
| Holds the subset after choose() is called. | |
Protected Member Functions | |
| void | generate (int N, int K, std::vector< std::bitset< N0 > > &words, size_t &c, size_t &calls, std::bitset< N0 > prefix=0) |
| Recursive helper function for choose. | |
Protected Attributes | |
| bool | use_constraint |
| Indicate whether we wish to use a constraint or not. | |
| virtual bool NChooseKBitset< N0 >::constraint | ( | const bitset< N0 > & | x | ) | [inline, virtual] |
A constraint function for selecting interesting subset of subset generated. Called by choose().
Re-implement in derived class in order to choose a different interesting subset. This default implementation is trivial -- returns true.
| x | Candidate to check against constraint |
Reimplemented in NChooseKBitsetExternal< Caller, N0 >.
| void NChooseKBitset< N0 >::generate | ( | int | N, | |
| int | K, | |||
| std::vector< std::bitset< N0 > > & | words, | |||
| size_t & | c, | |||
| size_t & | calls, | |||
| std::bitset< N0 > | prefix = 0 | |||
| ) | [protected] |
Recursive helper function for choose.
In the code, notice from the commented out code, that it is easy to introduce a constraint on the choices made. This can be useful ...
| void NChooseKBitset< N0 >::setUseConstraint | ( | bool | x | ) | [inline] |
1.4.7