-
Notifications
You must be signed in to change notification settings - Fork 1
/
subsampling2.h
59 lines (22 loc) · 1.76 KB
/
subsampling2.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
58
59
#include <vector>
#include <list>
using namespace std;
// FUNCTIONS FOR GENERATING COLLECTIONS OF SUBSAMPLES
void generateSubsamples(list< vector<int> >& subsamples, const int& n, const int& k);
void generateSubsamplesNoInitialSampling(list< vector<int> >& subsamples, const int& n, const int& k);
void randomSubsampling(list< vector<int> >& subsamples, const int& n, const int& k, const int& terminationLimit);
void randomSubsampling(vector< vector<int> >& subsamples, const int& n, const int& k, const int& terminationLimit);
void randomSubsamplingWithLimit(vector< vector<int> >& subsamples, const int& n, const int& k, const int& failLimit, const int& maxNumSubsamples, const int& randomSeed);
// FUNCTIONS FOR DRAWING INDIVIDUAL SUBSAMPLES
bool backtrackingSearch(const vector< vector<int> >& domains, const vector<int> currentDomain, vector<int>& subsample, const int& n, const int& k, int var);
bool randomDraw(const vector< vector<int> >& domains, vector<int> currentDomain, vector<int>& subsample, const int& n, const int& k);
// FUNCTIONS FOR SELECTING VARIABLE FROM A DOMAIN
int selectNewVar(const vector<int>& currentDomain);
int selectRandomVar(const vector<int>& currentDomain);
// UTILITY FUNCTIONS
void generateFirstSamples(list< vector<int> >& subsamples, vector< vector<int> >& domains, const int& n, const int& k);
bool validDomain(const vector<int>& currentDomain, const vector<int>& subsample, const int& k);
void updateDomains(vector< vector<int> >& domains, const vector<int>& subsample);
void removeValuePair(vector< vector<int> >& domains, const int& val1, const int& val2);
void initializeDomains(vector< vector<int> >& domains, const int& n);
void intersect(const vector<int>& domain1, const vector<int>& domain2, vector<int>& intersection);