effspm 0.2.8__cp39-cp39-macosx_11_0_arm64.whl → 0.3.2__cp39-cp39-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. effspm/_effspm.cpp +850 -210
  2. effspm/_effspm.cpython-39-darwin.so +0 -0
  3. effspm/btminer/src/build_mdd.cpp +42 -17
  4. effspm/btminer/src/build_mdd.hpp +13 -19
  5. effspm/btminer/src/freq_miner.cpp +134 -49
  6. effspm/btminer/src/freq_miner.hpp +16 -0
  7. effspm/btminer/src/load_inst.cpp +202 -126
  8. effspm/btminer/src/load_inst.hpp +22 -4
  9. effspm/btminer/src/main.cpp +83 -0
  10. effspm/btminer/src/utility.cpp +26 -41
  11. effspm/btminer/src/utility.hpp +6 -30
  12. effspm/freq_miner.hpp +2 -1
  13. effspm/htminer/src/build_mdd.cpp +46 -124
  14. effspm/htminer/src/build_mdd.hpp +56 -49
  15. effspm/htminer/src/freq_miner.cpp +341 -307
  16. effspm/htminer/src/freq_miner.hpp +39 -40
  17. effspm/htminer/src/load_inst.cpp +287 -336
  18. effspm/htminer/src/load_inst.hpp +23 -6
  19. effspm/htminer/src/main.cpp +97 -0
  20. effspm/htminer/src/utility.cpp +38 -57
  21. effspm/htminer/src/utility.hpp +9 -64
  22. effspm/largebm/src/build_mdd.cpp +69 -110
  23. effspm/largebm/src/build_mdd.hpp +22 -37
  24. effspm/largebm/src/freq_miner.cpp +241 -291
  25. effspm/largebm/src/freq_miner.hpp +25 -36
  26. effspm/largebm/src/load_inst.cpp +20 -26
  27. effspm/largebm/src/load_inst.hpp +24 -34
  28. effspm/largebm/src/main.cpp +95 -0
  29. effspm/largebm/src/utility.cpp +11 -21
  30. effspm/largebm/src/utility.hpp +7 -10
  31. effspm/largehm/src/build_mdd.cpp +75 -110
  32. effspm/largehm/src/build_mdd.hpp +53 -73
  33. effspm/largehm/src/freq_miner.cpp +134 -191
  34. effspm/largehm/src/freq_miner.hpp +37 -60
  35. effspm/largehm/src/load_inst.cpp +137 -174
  36. effspm/largehm/src/load_inst.hpp +13 -50
  37. effspm/largehm/src/main.cpp +95 -0
  38. effspm/largehm/src/utility.cpp +46 -28
  39. effspm/largehm/src/utility.hpp +18 -16
  40. effspm/largepp/src/freq_miner.cpp +184 -156
  41. effspm/largepp/src/freq_miner.hpp +11 -36
  42. effspm/largepp/src/load_inst.cpp +32 -12
  43. effspm/largepp/src/load_inst.hpp +15 -9
  44. effspm/largepp/src/main.cpp +108 -0
  45. effspm/largepp/src/pattern.hpp +31 -0
  46. effspm/load_inst.cpp +8 -8
  47. effspm/load_inst.hpp +1 -1
  48. effspm/main.cpp +103 -0
  49. {effspm-0.2.8.dist-info → effspm-0.3.2.dist-info}/METADATA +1 -1
  50. effspm-0.3.2.dist-info/RECORD +60 -0
  51. effspm-0.2.8.dist-info/RECORD +0 -53
  52. {effspm-0.2.8.dist-info → effspm-0.3.2.dist-info}/WHEEL +0 -0
  53. {effspm-0.2.8.dist-info → effspm-0.3.2.dist-info}/licenses/LICENSE +0 -0
  54. {effspm-0.2.8.dist-info → effspm-0.3.2.dist-info}/top_level.txt +0 -0
@@ -1,12 +1,11 @@
1
-
1
+ // effspm/btminer/src/load_inst.cpp
2
2
  #include <iostream>
3
- #include <sstream>
4
3
  #include <fstream>
5
- #include <cmath>
6
- #include <ctime>
7
- #include <map>
8
- #include <vector>
4
+ #include <sstream>
9
5
  #include <algorithm>
6
+ #include <math.h>
7
+ #include <time.h>
8
+
10
9
  #include "load_inst.hpp"
11
10
  #include "utility.hpp"
12
11
  #include "build_mdd.hpp"
@@ -16,184 +15,261 @@ namespace btminer {
16
15
 
17
16
  using namespace std;
18
17
 
19
- extern int num_nodes, cur_node;
20
-
21
-
22
- map<string, int> item_map;
23
- map<int, string> item_map_rev;
24
- vector<int> freq;
25
- vector<int> item_dic;
26
-
27
- void Load_items_pre(string& inst_name);
28
- bool Load_items(string& inst_name);
29
- bool Preprocess(string& inst, double thresh);
30
-
31
-
32
-
33
-
34
- bool Load_instance(string& items_file, double thresh) {
18
+ // ---------------------------------------------------------------------
19
+ // global definitions (must match load_inst.hpp)
20
+ // ---------------------------------------------------------------------
21
+ int M = 0;
22
+ int N = 0;
23
+ int L = 0;
24
+ unsigned long long E = 0ULL; // matches header: extern unsigned long long E;
25
+ int num_nodes = 0;
26
+ int theta = 0;
27
+ int cur_node = 0;
28
+
29
+ map<string, int> item_map;
30
+ map<int, string> item_map_rev;
31
+
32
+ std::vector<int> freq;
33
+ std::vector<int> item_dic;
34
+
35
+ // ✅ REAL DEFINITION lives here:
36
+ std::vector<Pattern> DFS;
37
+
38
+ string out_file, folder;
39
+ bool b_disp = 0;
40
+ bool b_write = 0;
41
+ bool use_dic = 0;
42
+ bool just_build= 0;
43
+ bool pre_pro = 1;
44
+
45
+ int N_mult = 1;
46
+ int M_mult = 1;
47
+ int time_limit= 30 * 3600; // 30 hours, same as professor
48
+
49
+ clock_t start_time;
50
+
51
+ // ---------------------------------------------------------------------
52
+ // forward decls
53
+ // ---------------------------------------------------------------------
54
+ void Load_items_pre(string &inst_name);
55
+ bool Load_items(string &inst_name);
56
+ bool Preprocess(string &inst, double thresh);
57
+
58
+ // ---------------------------------------------------------------------
59
+ // main loader
60
+ // ---------------------------------------------------------------------
61
+ bool Load_instance(string &items_file, double thresh) {
35
62
  clock_t kk = clock();
63
+
64
+ // root node for MDD
36
65
  Tree.emplace_back(0, 0, 0);
37
66
 
38
67
  if (pre_pro) {
39
68
  if (!Preprocess(items_file, thresh))
40
69
  return false;
70
+ if (b_disp)
71
+ cout << "\nPreprocess done in " << give_time(clock() - kk) << " seconds\n\n";
41
72
 
42
- cout << "\nPreprocess done in " << give_time(clock() - kk) << " seconds\n\n";
43
-
73
+ // build empty DFS of size L
74
+ DFS.clear();
44
75
  DFS.reserve(L);
45
76
  for (int i = 0; i < L; ++i)
46
77
  DFS.emplace_back(-i - 1);
47
78
 
48
79
  kk = clock();
49
80
  Load_items_pre(items_file);
50
- } else if (!Load_items(items_file))
81
+ }
82
+ else if (!Load_items(items_file)) {
51
83
  return false;
84
+ }
52
85
  else {
53
- theta = (thresh < 1) ? ceil(thresh * N * N_mult) : thresh;
86
+ if (thresh < 1)
87
+ theta = static_cast<int>(ceil(thresh * N * N_mult));
88
+ else
89
+ theta = static_cast<int>(thresh);
54
90
  }
55
-
56
- cout << "\nMDD Database built in " << give_time(clock() - kk) << " seconds\n\n";
57
- cout << "Found " << N * N_mult << " sequence, with max line len " << M << ", and " << L << " items, and " << E << " enteries\n";
58
- cout << "Total MDD nodes: " << Tree.size() << endl;
91
+ if (b_disp)
92
+ cout << "\nMDD Database built in " << give_time(clock() - kk) << " seconds\n\n";
93
+ if (b_disp)
94
+ cout << "Found " << N * N_mult
95
+ << " sequence, with max line len " << M
96
+ << ", and " << L << " items, and " << E << " enteries\n";
97
+ //cout << "Total MDD nodes: " << Tree.size() << endl;
59
98
 
60
99
  return true;
61
100
  }
62
101
 
63
- bool Preprocess(string& inst, double thresh) {
102
+ // ---------------------------------------------------------------------
103
+ // preprocessing pass
104
+ // ---------------------------------------------------------------------
105
+ bool Preprocess(string &inst, double thresh) {
64
106
  ifstream file(inst);
65
- if (!file.good()) {
66
- cout << "!!!!!! No such file exists: " << inst << " !!!!!!\n";
67
- return false;
68
- }
69
107
 
70
- string line;
71
- int size_m, ditem;
72
- while (getline(file, line) && give_time(clock() - start_time) < time_limit) {
73
- ++N;
74
- vector<bool> counted(L, 0);
75
- istringstream word(line);
76
- string itm;
77
- while (word >> itm) {
78
- ditem = stoi(itm);
79
- if (L < abs(ditem)) L = abs(ditem);
80
- while (freq.size() < L) {
81
- freq.push_back(0);
82
- counted.push_back(0);
83
- }
84
- if (!counted[abs(ditem) - 1]) {
85
- ++freq[abs(ditem) - 1];
86
- counted[abs(ditem) - 1] = 1;
108
+ if (file.good()) {
109
+ string line;
110
+ while (getline(file, line) && give_time(clock() - start_time) < time_limit) {
111
+ ++N;
112
+ vector<bool> counted(L, false);
113
+
114
+ istringstream word(line);
115
+ string itm;
116
+ while (word >> itm) {
117
+ int ditem = stoi(itm);
118
+ if (L < abs(ditem))
119
+ L = abs(ditem);
120
+
121
+ // extend freq / counted if L grew
122
+ while (static_cast<int>(freq.size()) < L) {
123
+ freq.push_back(0);
124
+ counted.push_back(false);
125
+ }
126
+
127
+ int idx = abs(ditem) - 1;
128
+ if (!counted[idx]) {
129
+ ++freq[idx];
130
+ counted[idx] = true;
131
+ }
87
132
  }
88
133
  }
134
+ } else {
135
+ cout << "!!!!!! No such file exists: " << inst << " !!!!!!\n";
136
+ return false;
89
137
  }
90
138
 
91
- theta = (thresh < 1) ? ceil(thresh * N * N_mult) : thresh;
139
+ if (thresh < 1)
140
+ theta = static_cast<int>(ceil(thresh * N * N_mult));
141
+ else
142
+ theta = static_cast<int>(thresh);
92
143
 
144
+ // build item_dic with only frequent items
93
145
  int real_L = 0;
94
146
  item_dic = vector<int>(L, -1);
95
147
  for (int i = 0; i < L; ++i) {
96
148
  if (freq[i] >= theta)
97
149
  item_dic[i] = ++real_L;
98
150
  }
151
+ if (b_disp)
152
+ cout << "Original number of items: " << L
153
+ << " Reduced to: " << real_L << endl;
99
154
 
100
- cout << "Original number of items: " << L << " Reduced to: " << real_L << endl;
101
155
  L = real_L;
102
- N = 0;
156
+ N = 0; // will be recounted in Load_items_pre
157
+
103
158
  return true;
104
159
  }
105
160
 
106
- void Load_items_pre(string& inst_name) {
161
+ // ---------------------------------------------------------------------
162
+ // load after preprocessing
163
+ // ---------------------------------------------------------------------
164
+ void Load_items_pre(string &inst_name) {
107
165
  ifstream file(inst_name);
108
- if (!file.good()) return;
109
-
110
- string line;
111
- int ditem;
112
- while (getline(file, line) && give_time(clock() - start_time) < time_limit) {
113
- istringstream word(line);
114
- string itm;
115
- vector<int> temp_vec;
116
- bool sgn = 0;
117
- while (word >> itm) {
118
- if (use_dic) {
119
- auto it = item_map.find(itm);
120
- if (it == item_map.end()) {
121
- item_map[itm] = ++L;
122
- item_map_rev[L] = itm;
123
- ditem = L;
166
+
167
+ if (file.good()) {
168
+ string line;
169
+ while (getline(file, line) && give_time(clock() - start_time) < time_limit) {
170
+ istringstream word(line);
171
+ string itm;
172
+ vector<int> temp_vec;
173
+ bool sgn = false;
174
+ while (word >> itm) {
175
+ int ditem;
176
+ if (use_dic) {
177
+ auto it = item_map.find(itm);
178
+ if (it == item_map.end()) {
179
+ item_map[itm] = ++L;
180
+ item_map_rev[L] = itm;
181
+ ditem = L;
182
+ } else {
183
+ ditem = it->second;
184
+ }
124
185
  } else {
125
- ditem = it->second;
186
+ ditem = stoi(itm);
126
187
  }
127
- } else {
128
- ditem = stoi(itm);
129
- }
130
188
 
131
- if (pre_pro && freq.size() > abs(ditem) - 1 && freq[abs(ditem) - 1] < theta) {
132
- if (!sgn)
133
- sgn = ditem < 0;
134
- continue;
135
- } else if (pre_pro) {
136
- ditem = (ditem > 0) ? item_dic[ditem - 1] : -item_dic[-ditem - 1];
137
- }
189
+ // drop infrequent items
190
+ if (freq[abs(ditem) - 1] < theta) {
191
+ if (!sgn)
192
+ sgn = (ditem < 0);
193
+ continue;
194
+ } else {
195
+ if (ditem > 0)
196
+ ditem = item_dic[ditem - 1];
197
+ else
198
+ ditem = -item_dic[-ditem - 1];
199
+ }
138
200
 
139
- if (sgn && ditem > 0)
140
- ditem = -ditem;
141
- sgn = 0;
201
+ if (sgn) {
202
+ if (ditem > 0)
203
+ ditem = -ditem;
204
+ sgn = false;
205
+ }
142
206
 
143
- temp_vec.push_back(ditem);
144
- }
207
+ temp_vec.push_back(ditem);
208
+ }
145
209
 
146
- if (temp_vec.empty()) continue;
210
+ if (temp_vec.empty())
211
+ continue;
212
+
213
+ ++N;
147
214
 
148
- ++N;
149
- if (temp_vec.size() > M) M = temp_vec.size();
215
+ if (static_cast<int>(temp_vec.size()) > M)
216
+ M = static_cast<int>(temp_vec.size());
150
217
 
151
- E += temp_vec.size(); // <-- make sure E gets incremented
152
- Build_MDD(temp_vec);
218
+ // this increments E inside Build_MDD
219
+ Build_MDD(temp_vec);
220
+ }
153
221
  }
154
222
  }
155
223
 
156
- bool Load_items(string& inst_name) {
224
+ // ---------------------------------------------------------------------
225
+ // load without preprocessing
226
+ // ---------------------------------------------------------------------
227
+ bool Load_items(string &inst_name) {
157
228
  ifstream file(inst_name);
158
- if (!file.good()) {
159
- cout << "!!!!!! No such file exists: " << inst_name << " !!!!!!\n";
160
- return false;
161
- }
162
229
 
163
- string line;
164
- int ditem;
165
- while (getline(file, line) && give_time(clock() - start_time) < time_limit) {
166
- ++N;
167
- istringstream word(line);
168
- string itm;
169
- vector<int> temp_vec;
170
- while (word >> itm) {
171
- if (use_dic) {
172
- auto it = item_map.find(itm);
173
- if (it == item_map.end()) {
174
- item_map[itm] = ++L;
175
- item_map_rev[L] = itm;
176
- ditem = L;
230
+ if (file.good()) {
231
+ string line;
232
+ while (getline(file, line) && give_time(clock() - start_time) < time_limit) {
233
+ ++N;
234
+ istringstream word(line);
235
+ string itm;
236
+ vector<int> temp_vec;
237
+ while (word >> itm) {
238
+ int ditem;
239
+ if (use_dic) {
240
+ auto it = item_map.find(itm);
241
+ if (it == item_map.end()) {
242
+ item_map[itm] = ++L;
243
+ item_map_rev[L] = itm;
244
+ ditem = L;
245
+ } else {
246
+ ditem = it->second;
247
+ }
177
248
  } else {
178
- ditem = it->second;
179
- }
180
- } else {
181
- ditem = stoi(itm);
182
- if (L < abs(ditem)) {
183
- L = abs(ditem);
184
- while (DFS.size() < L && !just_build) {
185
- DFS.reserve(L);
186
- DFS.emplace_back(-DFS.size() - 1);
249
+ ditem = stoi(itm);
250
+ if (L < abs(ditem)) {
251
+ L = abs(ditem);
252
+ // make sure DFS is large enough (unless just_build)
253
+ while (static_cast<int>(DFS.size()) < L && !just_build) {
254
+ DFS.reserve(L);
255
+ DFS.emplace_back(-((int)DFS.size()) - 1);
256
+ }
187
257
  }
188
258
  }
259
+
260
+ temp_vec.push_back(ditem);
189
261
  }
190
- temp_vec.push_back(ditem);
191
- }
192
262
 
193
- if (temp_vec.size() > M) M = temp_vec.size();
194
- E += temp_vec.size(); // <-- make sure E gets incremented
195
- Build_MDD(temp_vec);
263
+ if (static_cast<int>(temp_vec.size()) > M)
264
+ M = static_cast<int>(temp_vec.size());
265
+
266
+ Build_MDD(temp_vec);
267
+ }
268
+ } else {
269
+ cout << "!!!!!! No such file exists: " << inst_name << " !!!!!!\n";
270
+ return false;
196
271
  }
272
+
197
273
  return true;
198
274
  }
199
275
 
@@ -10,16 +10,34 @@
10
10
 
11
11
  namespace btminer {
12
12
 
13
- bool Load_instance(std::string& items_file, double thresh);
13
+ using std::string;
14
+ using std::vector;
15
+ using std::map;
16
+ using std::unordered_map;
17
+ using std::unordered_set;
14
18
 
15
- extern std::string out_file, folder;
19
+ bool Load_instance(string& items_file, double thresh);
20
+
21
+ extern string out_file, folder;
16
22
 
17
23
  extern bool b_disp, b_write, use_dic, just_build, pre_pro;
18
24
 
19
- extern int N, M, L, theta, num_nodes, M_mult, N_mult, time_limit, cur_node;
25
+ extern int N, M, L, theta, num_nodes, M_mult, N_mult, time_limit, cur_node;
26
+ extern unsigned long long E; // total number of entries (we need this for _effspm.cpp)
27
+
28
+ extern std::clock_t start_time;
29
+
30
+ // these 2 are for dictionary mode
31
+ extern map<string,int> item_map;
32
+ extern map<int,string> item_map_rev;
20
33
 
21
- extern clock_t start_time;
34
+ extern vector<int> freq;
35
+ extern vector<int> item_dic;
22
36
 
37
+ // expose items so _effspm.cpp can fall back to seeding (it expects btminer::items)
38
+ extern vector<vector<int>> items;
23
39
 
40
+ class Pattern;
41
+ extern vector<Pattern> DFS;
24
42
 
25
43
  } // namespace btminer
@@ -0,0 +1,83 @@
1
+ #include <iostream>
2
+ #include <string.h>
3
+ #include "load_inst.hpp"
4
+ #include "freq_miner.hpp"
5
+ #include "utility.hpp"
6
+ #include "build_mdd.hpp"
7
+
8
+ namespace btminer {
9
+ // everything is already declared
10
+ }
11
+
12
+ int main(int argc, char* argv[]) {
13
+ using namespace btminer;
14
+
15
+ std::string VV, attr;
16
+
17
+ double thresh = 0;
18
+ for (int i = 1; i<argc; i++) {
19
+ if (argv[i][0] != '-' || isdigit(argv[i][1]))
20
+ continue;
21
+ else if (strcmp(argv[i], "-thr") == 0)
22
+ thresh = std::stod(argv[i + 1]);
23
+ else if (strcmp(argv[i], "-file") == 0)
24
+ VV = argv[i + 1];
25
+ else if (strcmp(argv[i], "-N_mult") == 0)
26
+ N_mult = std::stoi(argv[i + 1]);
27
+ else if (strcmp(argv[i], "-M_mult") == 0)
28
+ M_mult = std::stoi(argv[i + 1]);
29
+ else if (strcmp(argv[i], "-time") == 0)
30
+ time_limit = std::stoi(argv[i + 1]);
31
+ else if (strcmp(argv[i], "-jbuild") == 0)
32
+ just_build = 1;
33
+ else if (strcmp(argv[i], "-folder") == 0)
34
+ folder = argv[i + 1];
35
+ else if (strcmp(argv[i], "-npre") == 0)
36
+ pre_pro = 0;
37
+ else if (strcmp(argv[i], "-dic") == 0)
38
+ use_dic = 1;
39
+ else if (strcmp(argv[i], "-out") == 0) {
40
+ if (i + 1 == argc || argv[i + 1][0] == '-')
41
+ b_disp = 1;
42
+ else if (argv[i + 1][0] == '+') {
43
+ b_disp = 1;
44
+ b_write = 1;
45
+ if (strlen(argv[i + 1]) > 1) {
46
+ out_file = argv[i + 1];
47
+ out_file = out_file.substr(1, out_file.size() - 1);
48
+ }
49
+ else
50
+ out_file = VV;
51
+ }
52
+ else {
53
+ b_write = 1;
54
+ out_file = argv[i + 1];
55
+ }
56
+ }
57
+ else
58
+ std::cout << "Command " << argv[i] << " not recognized and skipped.\n";
59
+ }
60
+
61
+ std::cout << "\n********************** " << VV << " N_mult: " << N_mult << " M_mult: " << M_mult << "**********************\n";
62
+
63
+ std::string item_file = folder + VV + ".txt";
64
+
65
+ std::cout << "loading instances...\n";
66
+
67
+ start_time = clock();
68
+
69
+ if (!Load_instance(item_file, thresh)) {
70
+ std::cout << "Files invalid, exiting.\n";
71
+ return 0;
72
+ }
73
+
74
+ if (!just_build && give_time(clock() - start_time) < time_limit) {
75
+ Freq_miner();
76
+ if (give_time(clock() - start_time) >= time_limit)
77
+ std::cout << "TIME LIMIT REACHED\n";
78
+ std::cout << "Mining Complete\n\nFound a total of " << num_patt << " patterns\n";
79
+ std::cout << "\nTotal CPU time " << give_time(clock() - start_time) << " seconds\n\n";
80
+ }
81
+
82
+ return 0;
83
+ }
@@ -5,61 +5,46 @@
5
5
 
6
6
  namespace btminer {
7
7
 
8
- // ─── Global definitions ──────────────────────────────────────────
9
- bool use_dic = false;
10
- std::vector<std::vector<int>> items;
11
- bool use_list = false;
12
- bool just_build = false;
13
- int E = 0, M = 0, N = 0, L = 0, theta = 0;
14
- std::vector<Pattern> DFS;
15
- clock_t start_time = 0;
16
- bool b_disp = false, b_write = false;
17
- std::string out_file;
18
-
19
- bool pre_pro = true;
20
- int N_mult = 1, M_mult = 1;
21
- int time_limit = 30 * 3600;
22
-
23
- // buffer of mined patterns returned to Python
24
- std::vector<std::vector<int>> collected;
25
-
26
- void ClearCollected() { collected.clear(); }
27
- const std::vector<std::vector<int>>& GetCollected() { return collected; }
28
-
29
- // ─── Utility functions ───────────────────────────────────────────
30
- int find_ID(std::vector<int>& vec, int itm)
31
- {
8
+ int find_ID(vector<int>& vec, int itm) {
32
9
  int plc = 0;
33
- while (plc < static_cast<int>(vec.size()) && vec[plc] != itm) ++plc;
34
- return (plc == static_cast<int>(vec.size())) ? -1 : plc;
10
+ while (plc < static_cast<int>(vec.size()) && vec[plc] != itm)
11
+ ++plc;
12
+
13
+ if (plc == static_cast<int>(vec.size()))
14
+ return -1;
15
+ else
16
+ return plc;
35
17
  }
36
18
 
37
- bool check_parent(int cur_arc, int str_pnt, int start,
38
- std::vector<int>& strpnt_vec)
39
- {
19
+ bool check_parent(int cur_arc, int str_pnt, int start, std::vector<int>& strpnt_vec) {
20
+
40
21
  std::vector<int> ancestors;
22
+
41
23
  int cur_anct = Tree[cur_arc].anct;
42
24
 
43
25
  while (Tree[cur_anct].itmset > Tree[str_pnt].itmset) {
44
- if (Tree[cur_anct].item > 0) ancestors.push_back(cur_anct);
26
+ if (Tree[cur_anct].item > 0)
27
+ ancestors.push_back(cur_anct);
45
28
  cur_anct = Tree[cur_anct].anct;
46
29
  }
47
- if (Tree[cur_anct].itmset == Tree[str_pnt].itmset) return true;
48
30
 
49
- for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it)
50
- for (int i = start; i < static_cast<int>(strpnt_vec.size()); ++i)
51
- if (strpnt_vec[i] == *it) return true;
31
+ if (Tree[cur_anct].itmset == Tree[str_pnt].itmset)
32
+ return true;
33
+ else {
34
+ for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
35
+ for (int i = start; i < static_cast<int>(strpnt_vec.size()); ++i) {
36
+ if (strpnt_vec[i] == *it)
37
+ return true;
38
+ }
39
+ }
40
+ }
52
41
 
53
42
  return false;
54
43
  }
55
44
 
56
- bool find_pnt(Arc* pnt, std::vector<Arc*>& vec, int pos)
57
- {
58
- for (size_t i = pos; i < vec.size(); ++i)
59
- if (vec[i] == pnt) return true;
60
- return false;
45
+ float give_time(clock_t kk) {
46
+ float ll = static_cast<float>(kk) / CLOCKS_PER_SEC;
47
+ return ll;
61
48
  }
62
49
 
63
- double give_time(clock_t kk) { return double(kk) / CLOCKS_PER_SEC; }
64
-
65
50
  } // namespace btminer
@@ -1,40 +1,16 @@
1
1
  #pragma once
2
2
 
3
3
  #include <vector>
4
- #include <ctime>
4
+ #include <time.h>
5
5
  #include <string>
6
6
  #include "build_mdd.hpp"
7
- #include "freq_miner.hpp"
8
- #include "load_inst.hpp"
9
7
 
10
8
  namespace btminer {
11
9
 
12
- // === Utility function declarations ===
13
- bool find_pnt(Arc* pnt, std::vector<Arc*>& vec, int pos);
14
- int find_ID(std::vector<int>& vec, int itm);
15
- double give_time(clock_t kk);
16
- bool check_parent(int cur_arc, int str_pnt, int start, std::vector<int>& strpnt_vec);
10
+ using std::vector;
17
11
 
18
- // === Global variables (DECLARATIONS ONLY) ===
12
+ int find_ID(vector<int>& vec, int itm);
13
+ float give_time(clock_t kk);
14
+ bool check_parent(int cur_arc, int str_pnt, int start, vector<int>& strpnt_vec);
19
15
 
20
- extern bool use_list;
21
- extern bool just_build;
22
- extern int E, M, N, L, theta;
23
- extern std::vector<Pattern> DFS;
24
- extern clock_t start_time;
25
- extern bool b_disp, b_write;
26
- extern std::string out_file;
27
- extern bool pre_pro;
28
- extern int N_mult, M_mult;
29
- extern int time_limit;
30
- extern std::vector<std::vector<int>> items;
31
-
32
- extern std::vector<std::vector<int>> collected;
33
-
34
- void ClearCollected();
35
- const std::vector<std::vector<int>>& GetCollected();
36
-
37
- }
38
-
39
-
40
- // namespace btminer
16
+ } // namespace btminer
effspm/freq_miner.hpp CHANGED
@@ -24,7 +24,8 @@ public:
24
24
 
25
25
  Pattern(vector<int>& _seq, int item) {
26
26
  seq.reserve(_seq.size());
27
- for (std::size_t i = 0; i < _seq.size(); ++i)
27
+ for (int i = 0; i < _seq.size(); ++i)
28
+
28
29
 
29
30
  seq.push_back(_seq[i]);
30
31
  seq.push_back(item);