-
Notifications
You must be signed in to change notification settings - Fork 0
/
KMStrategy.h
57 lines (49 loc) · 2.51 KB
/
KMStrategy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <vector>
#include <boost/shared_ptr.hpp>
#include "TablePruner.h"
#ifndef MatrixGenerator_KMStrategy_h
#define MatrixGenerator_KMStrategy_h
class GInvariant;
/**
* A KMStrategy is used by a TablePruner in determining the algorithm specifics with regards to which GInvariants to use in
* various situations.
*/
struct KMStrategy {
/**
* Constructs the initial list of GInvariants to be fed into the TablePruner from the TablePrunerData in the previous
* iteration.
*
* Precondition: output.isTrivial() == false, so output.getDiscriminator() can be safely cast to
* boost::shared_ptr<Discriminator>
*
* Postcondition: If GInvariantType is the true type of any GInvariant in the returned list, then it is the case that
* isDiscriminator<GInvariantType>::value == false and isTrivial<GInvariantType>::value == false
*/
virtual std::vector<boost::shared_ptr<GInvariant> > createInitialGInvariants(const Group& G, unsigned int k, const TablePrunerData& output) = 0;
/**
* Constructs a new GInvariant to be fed into the TablePruner when all of the GInvariant functions in the initial list
* have been fed and a Discriminator has yet to be found.
*
* Postcondition: If GInvariantType is the returned GInvariant's actual type, then it is the case that
* isDiscriminator<GInvariantType>::value == false and isTrivial<GInvariantType>::value == false
*/
virtual boost::shared_ptr<GInvariant> createNewGInvariant(const Group& G, unsigned int k) = 0;
};
/**
* Concrete implementation of the KMStrategy interface, which uses a Taxonomy2 as its only initial candidate, and resorts
* to random AnchorSets in the event that the Taxonomy2 fails to discriminate.
*/
struct Taxonomy2Strategy : public KMStrategy {
std::vector<boost::shared_ptr<GInvariant> > createInitialGInvariants(const Group& G, unsigned int k, const TablePrunerData& output);
boost::shared_ptr<GInvariant> createNewGInvariant(const Group& G, unsigned int k);
};
/**
* Concrete implementation of the KMStrategy interface, which reuses the functions used bo build the Discriminator as its
* initial candidates, and resorts to random AnchorSets in the event that the list fails to discriminate. Note that this
* exclusively uses the size-independent AnchorSet to do all its work.
*/
struct RecyclerStrategy : public KMStrategy {
std::vector<boost::shared_ptr<GInvariant> > createInitialGInvariants(const Group& G, unsigned int k, const TablePrunerData& output);
boost::shared_ptr<GInvariant> createNewGInvariant(const Group& G, unsigned int k);
};
#endif