effspm 0.2.7__cp312-cp312-win_amd64.whl → 0.3.3__cp312-cp312-win_amd64.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.cp312-win_amd64.pyd +0 -0
  2. effspm/_effspm.cpp +961 -210
  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 +211 -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.7.dist-info → effspm-0.3.3.dist-info}/METADATA +1 -1
  50. effspm-0.3.3.dist-info/RECORD +60 -0
  51. effspm-0.2.7.dist-info/RECORD +0 -53
  52. {effspm-0.2.7.dist-info → effspm-0.3.3.dist-info}/WHEEL +0 -0
  53. {effspm-0.2.7.dist-info → effspm-0.3.3.dist-info}/licenses/LICENSE +0 -0
  54. {effspm-0.2.7.dist-info → effspm-0.3.3.dist-info}/top_level.txt +0 -0
@@ -6,18 +6,35 @@
6
6
  #include <map>
7
7
  #include <unordered_set>
8
8
  #include <unordered_map>
9
+ #include <time.h>
10
+
9
11
  namespace htminer {
10
- using namespace std;
12
+
13
+ using std::string;
14
+ using std::vector;
11
15
 
12
16
  bool Load_instance(string& items_file, double thresh);
13
17
 
14
18
  extern string out_file, folder;
15
19
 
16
- extern bool b_disp, b_write, use_dic, just_build, pre_pro, itmset_exists;
20
+ extern bool b_disp;
21
+ extern bool b_write;
22
+ extern bool use_dic;
23
+ extern bool just_build;
24
+ extern bool pre_pro;
25
+ extern bool itmset_exists;
26
+
27
+ extern unsigned int M;
28
+ extern unsigned int mlim;
29
+ extern unsigned int time_limit;
30
+ extern unsigned long long N;
31
+ extern unsigned long long L;
32
+ extern unsigned long long theta;
33
+ extern unsigned long long E;
17
34
 
18
- extern unsigned int M, mlim, time_limit;
35
+ // 🔥 This is the missing declaration that fixes the error:
36
+ extern vector<int> item_dic;
19
37
 
20
- extern unsigned long long int N, L, theta;
38
+ extern clock_t start_time;
21
39
 
22
- extern clock_t start_time;
23
- }
40
+ } // namespace htminer
@@ -0,0 +1,97 @@
1
+ #include <iostream>
2
+ #include <time.h>
3
+ #include <string.h>
4
+ #include <string>
5
+ #include "load_inst.hpp"
6
+ #include "build_mdd.hpp"
7
+ #include "utility.hpp"
8
+ #include "freq_miner.hpp"
9
+ namespace htminer {
10
+ using namespace std;
11
+
12
+ string out_file;
13
+
14
+ bool b_disp = 0, b_write = 0, use_dic = 0, just_build = 0, pre_pro = 1;
15
+
16
+ unsigned int time_limit = 10 * 3600;
17
+
18
+ clock_t start_time;
19
+
20
+ string folder;
21
+
22
+ int main(int argc, char* argv[]) {
23
+
24
+ string VV, attr;
25
+
26
+ double thresh = 0;
27
+ for (int i = 1; i<argc; i++) {
28
+ if (argv[i][0] != '-' || isdigit(argv[i][1]))
29
+ continue;
30
+ else if (strcmp(argv[i], "-thr") == 0)
31
+ thresh = stod(argv[i + 1]);
32
+ else if (strcmp(argv[i], "-file") == 0)
33
+ VV = argv[i + 1];
34
+ else if (strcmp(argv[i], "-time") == 0)
35
+ time_limit = stoi(argv[i + 1]);
36
+ else if (strcmp(argv[i], "-jbuild") == 0)
37
+ just_build = 1;
38
+ else if (strcmp(argv[i], "-folder") == 0)
39
+ folder = argv[i + 1];
40
+ else if (strcmp(argv[i], "-npre") == 0)
41
+ pre_pro = 0;
42
+ else if (strcmp(argv[i], "-dic") == 0)
43
+ use_dic = 1;
44
+ else if (strcmp(argv[i], "-out") == 0) {
45
+ if (i + 1 == argc || argv[i + 1][0] == '-')
46
+ b_disp = 1;
47
+ else if (argv[i + 1][0] == '+') {
48
+ b_disp = 1;
49
+ b_write = 1;
50
+ if (strlen(argv[i + 1]) > 1) {
51
+ out_file = argv[i + 1];
52
+ out_file = out_file.substr(1, out_file.size() - 1);
53
+ }
54
+ else
55
+ out_file = VV;
56
+ }
57
+ else {
58
+ b_write = 1;
59
+ out_file = argv[i + 1];
60
+ }
61
+ }
62
+
63
+ else
64
+ cout << "Command " << argv[i] << " not recognized and skipped.\n";
65
+ }
66
+
67
+
68
+
69
+ cout << "\n********************** " << VV << "**********************\n";
70
+
71
+ string item_file = folder + VV + ".txt";
72
+
73
+ cout << "loading instances...\n";
74
+
75
+ clock_t start_time_all = clock();
76
+ start_time = clock();
77
+
78
+ if (!Load_instance(item_file, thresh)) {
79
+ cout << "Files invalid, exiting.\n";
80
+ cin.get();
81
+ return 0;
82
+ }
83
+
84
+ start_time = clock();
85
+
86
+ if (!just_build && give_time(clock() - start_time) < time_limit) {
87
+ Freq_miner();
88
+ if (give_time(clock() - start_time) >= time_limit)
89
+ cout << "TIME LIMIT REACHED\n";
90
+ cout << "Mining Complete\n\nFound a total of " << num_patt << " patterns\n";
91
+ cout << "\nTotal CPU time " << give_time(clock() - start_time_all) << " seconds\n\n";
92
+ }
93
+
94
+
95
+ return 0;
96
+ }
97
+ }
@@ -1,72 +1,53 @@
1
1
  #include "utility.hpp"
2
+ #include "build_mdd.hpp"
2
3
  #include "load_inst.hpp"
3
- #include "freq_miner.hpp"
4
- #include <vector>
5
- namespace htminer {
6
-
7
- // ─── Flag‐like globals ──────────────────────────────────────────────────────
8
- bool use_list = false;
9
- bool just_build = false;
10
- bool b_disp = false;
11
- bool b_write = false;
12
- bool use_dic = false;
13
- bool pre_pro = false;
4
+ #include <iostream>
14
5
 
15
- unsigned int time_limit = 0;
16
- std::string out_file = "";
17
- std::clock_t start_time = 0;
6
+ namespace htminer {
18
7
 
19
- // ─── Dataset‐level globals ─────────────────────────────────────────────────
20
- std::vector<std::vector<int>> items;
21
- unsigned long long N = 0;
22
- unsigned long long L = 0;
23
- unsigned long long theta = 0;
24
- unsigned int M = 0;
25
- unsigned long long E = 0;
26
- unsigned int mlim = 0;
27
- // ─── DFS stacks ─────────────────────────────────────────────────────────────
28
- std::vector<Pattern> DFS;
29
- std::vector<VPattern> VDFS;
8
+ using std::vector;
30
9
 
31
- // ─── Collected patterns storage ────────────────────────────────────────────
32
- std::vector<std::vector<int>> collectedPatterns;
33
- const std::vector<std::vector<int>>& GetCollected() {
34
- return collectedPatterns;
35
- }
36
-
37
- // ─── give_time and check_parent get their definitions here (as provided) ───
38
- float give_time(std::clock_t kk) {
39
- return static_cast<float>(kk) / static_cast<float>(CLOCKS_PER_SEC);
40
- }
41
- bool check_parent(unsigned int cur_anct, unsigned int str_pnt, unsigned int start, vector<unsigned int>& strpnt_vec) {
10
+ vector<vector<int>> collectedPatterns;
42
11
 
43
- vector<unsigned int> ancestors;
44
-
45
- while (abs(Tree[cur_anct].itmset) > abs(Tree[str_pnt].itmset)) {
46
- if (Tree[cur_anct].item > 0)
47
- ancestors.push_back(cur_anct);
48
- cur_anct = Tree[cur_anct].anct;
49
- }
12
+ bool check_parent(unsigned int cur_anct, unsigned int str_pnt,
13
+ unsigned int start, vector<unsigned int>& strpnt_vec) {
50
14
 
51
- if (abs(Tree[cur_anct].itmset) == abs(Tree[str_pnt].itmset))
52
- return 1;
53
- else {
54
- for (vector<unsigned int>::reverse_iterator it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
55
- for (unsigned int i = start; i < strpnt_vec.size(); ++i) {
56
- if (strpnt_vec[i] == *it)
57
- return 1;
58
- }
59
- }
60
- }
15
+ vector<unsigned int> ancestors;
61
16
 
17
+ while (std::abs(Tree[cur_anct].itmset) >
18
+ std::abs(Tree[str_pnt].itmset)) {
19
+ if (Tree[cur_anct].item > 0)
20
+ ancestors.push_back(cur_anct);
21
+ cur_anct = Tree[cur_anct].anct;
22
+ }
62
23
 
63
- return 0;
24
+ if (std::abs(Tree[cur_anct].itmset) ==
25
+ std::abs(Tree[str_pnt].itmset))
26
+ return true;
27
+ else {
28
+ for (vector<unsigned int>::reverse_iterator it = ancestors.rbegin();
29
+ it != ancestors.rend(); ++it) {
30
+ for (unsigned int i = start; i < strpnt_vec.size(); ++i) {
31
+ if (strpnt_vec[i] == *it)
32
+ return true;
33
+ }
34
+ }
35
+ }
64
36
 
37
+ return false;
65
38
  }
66
39
 
40
+ float give_time(clock_t kk) {
41
+ float ll = ((float)kk) / CLOCKS_PER_SEC;
42
+ return ll;
43
+ }
67
44
 
45
+ void ClearCollected() {
46
+ collectedPatterns.clear();
47
+ }
68
48
 
49
+ const vector<vector<int>>& GetCollected() {
50
+ return collectedPatterns;
51
+ }
69
52
 
70
-
71
-
72
- }
53
+ } // namespace htminer
@@ -1,77 +1,22 @@
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 htminer {
11
9
 
12
- // ─── Global flags and counters ─────────────────────────────────────────────
13
- /// Controls whether to mine in “list” mode (unused for HTMiner, but declared)
14
- extern bool use_list;
15
- /// If true, only build MDD and exit (don’t actually mine)
16
- extern bool just_build;
17
- /// If true, print each pattern to stdout as it’s found
18
- extern bool b_disp;
19
- /// If true, write each pattern to file (see out_file)
20
- extern bool b_write;
21
- /// If true, use a dictionary‐file mapping items → new IDs
22
- extern bool use_dic;
23
- /// If true, preprocess input (create dictionary) instead of mining
24
- extern bool pre_pro;
10
+ using std::vector;
25
11
 
26
- /// Time limit (in seconds) for mining before forced exit
27
- extern unsigned int time_limit;
28
- /// Output filename (if b_write is true)
29
- extern std::string out_file;
30
- /// Clock tick when mining started
31
- extern std::clock_t start_time;
12
+ float give_time(clock_t kk);
13
+ bool check_parent(unsigned int cur_arc, unsigned int str_pnt,
14
+ unsigned int start, vector<unsigned int>& strpnt_vec);
32
15
 
33
- // ─── Data‐set‐level globals ─────────────────────────────────────────────────
34
- /// The input sequences (each sequence is a vector of integers)
35
- extern std::vector<std::vector<int>> items;
36
- /// Number of sequences (items.size())
37
- extern unsigned long long N;
38
- /// Number of distinct items (max absolute item ID)
39
- extern unsigned long long L;
40
- /// Minimum support threshold (absolute count, not fraction)
41
- extern unsigned long long theta;
42
- /// Maximum sequence length across all items
43
- extern unsigned int M;
44
- /// Total number of “entries” (sum of all sequence lengths)
45
- extern unsigned long long E;
16
+ // pattern collection for Python
17
+ extern vector<vector<int>> collectedPatterns;
46
18
 
47
- // ─── Per‐pattern DFS stacks ─────────────────────────────────────────────────
48
- /// DFS stack of “in‐memory” patterns (each Pattern holds its own ilist/slist, freq, str_pnt, etc.)
49
- extern std::vector<Pattern> DFS;
50
-
51
- extern std::vector<std::vector<int>> collectedPatterns;
52
- // ─── Collected output ───────────────────────────────────────────────────────
53
- /// Clears any patterns left in DFS (called at the start of each run)
54
- inline void ClearCollected() {
55
- DFS.clear();
56
- collectedPatterns.clear();
57
- }
58
- /// Returns a reference to the entire “collected patterns” vector
59
- /// (each Pattern knows how to output itself as a vector<int>)
60
- const std::vector<std::vector<int>>& GetCollected();
61
-
62
- // ─── Helper functions ───────────────────────────────────────────────────────
63
- /// Given a clock‐tick difference, return elapsed seconds as a float
64
- float give_time(std::clock_t kk);
65
-
66
- /// Check whether a candidate can extend its parent pattern:
67
- /// cur_arc = current Arc node ID in MDD
68
- /// str_pnt = string‐pointer of the existing pattern
69
- /// start = starting index within the MDD arc‐list
70
- /// strpnt_vec = parent’s “string pointers” vector
71
- /// Returns true if `cur_arc` is a valid child of `str_pnt` from position `start`.
72
- bool check_parent(unsigned int cur_arc,
73
- unsigned int str_pnt,
74
- unsigned int start,
75
- std::vector<unsigned int>& strpnt_vec);
19
+ void ClearCollected();
20
+ const vector<vector<int>>& GetCollected();
76
21
 
77
22
  } // namespace htminer
@@ -1,137 +1,96 @@
1
- // File: effspm/largebm/src/load_inst.cpp
2
-
3
- #include <vector>
4
- #include <iostream>
5
1
  #include <unordered_map>
6
- #include "load_inst.hpp"
2
+ #include <cstdlib>
7
3
  #include "build_mdd.hpp"
8
4
  #include "freq_miner.hpp"
9
- #include "utility.hpp"
5
+ #include "load_inst.hpp"
10
6
 
11
7
  namespace largebm {
12
8
 
13
- // Forward declaration for Add_arc
14
- int Add_arc(int item, unsigned long long int last_arc, int& itmset,
15
- std::unordered_map<int, unsigned long long int>& ancest_map);
16
-
17
- // Global MDD tree and other globals (declared in headers)
18
- std::vector<Arc> Tree;
9
+ std::vector<Arc> Tree;
19
10
 
20
- void Build_MDD(std::vector<int>& items) {
21
- std::unordered_map<int, unsigned long long int> ancest_map;
22
- unsigned long long int last_arc = 0;
23
- int itmset = 0;
11
+ static int Add_arc(int item,
12
+ unsigned long long last_arc,
13
+ int& itmset,
14
+ std::unordered_map<int, unsigned long long>& ancest_map);
24
15
 
25
- for (auto it = items.begin(); it != items.end(); ++it) {
26
- last_arc = Add_arc(*it, last_arc, itmset, ancest_map);
27
- }
16
+ void Build_MDD(const std::vector<int>& items) {
17
+ std::unordered_map<int, unsigned long long> ancest_map;
18
+ unsigned long long last_arc = 0;
19
+ int itmset = 0;
20
+ for (int v : items) {
21
+ last_arc = Add_arc(v, last_arc, itmset, ancest_map);
28
22
  }
23
+ }
29
24
 
25
+ static int Add_arc(int item,
26
+ unsigned long long last_arc,
27
+ int& itmset,
28
+ std::unordered_map<int, unsigned long long>& ancest_map) {
29
+ ++E;
30
30
 
31
- int Add_arc(int item, unsigned long long int last_arc, int& itmset,
32
- std::unordered_map<int, unsigned long long int>& ancest_map) {
33
-
34
- unsigned idx = std::abs(item) - 1;
31
+ unsigned idx = static_cast<unsigned>(std::abs(item) - 1);
35
32
 
36
- // ─── DEBUG ────────────────────────────────────────────────
37
- // std::cout << "[Add_arc] item=" << item
38
- // << " idx=" << idx
39
- // << " last_arc=" << last_arc
40
- // << " Tree.size=" << Tree.size()
41
- // << " DFS.size=" << DFS.size()
42
- // << std::endl;
43
-
44
- // Ensure DFS can hold this index
45
- if (idx >= DFS.size()) {
46
- // std::cout << "[Add_arc] • resizing DFS to " << (idx + 1) << std::endl;
47
- DFS.reserve(idx + 1);
48
- while (DFS.size() <= idx) {
49
- DFS.emplace_back(-static_cast<int>(DFS.size()) - 1); // Pattern(-id)
50
- }
33
+ if (idx >= DFS.size()) {
34
+ DFS.reserve(idx + 1);
35
+ while (DFS.size() <= idx) {
36
+ DFS.emplace_back(-static_cast<int>(DFS.size()) - 1);
51
37
  }
38
+ }
52
39
 
53
- unsigned long long int anct;
54
- auto p = ancest_map.find(std::abs(item));
55
- if (p == ancest_map.end()) {
56
- anct = 0;
57
- } else {
58
- anct = p->second;
59
- }
40
+ unsigned long long anct = 0;
41
+ {
42
+ std::unordered_map<int, unsigned long long>::const_iterator p =
43
+ ancest_map.find(std::abs(item));
44
+ if (p != ancest_map.end()) anct = p->second;
45
+ }
60
46
 
61
- if (item < 0) {
62
- ++itmset;
63
- }
47
+ if (item < 0) {
48
+ ++itmset;
49
+ }
64
50
 
65
- // Before accessing Tree[last_arc].chld, check bounds
66
- if (last_arc >= Tree.size()) {
67
- // std::cout << "[Add_arc] !!! last_arc OOB last_arc="
68
- // << last_arc << " Tree.size=" << Tree.size()
69
- // << std::endl;
70
- // We still proceed so we can see crash context:
71
- }
51
+ unsigned long long last_sibl = 0;
52
+ if (last_arc < Tree.size()) {
53
+ last_sibl = Tree[last_arc].chld;
54
+ }
72
55
 
73
- unsigned long long int last_sibl = 0;
56
+ if (last_sibl == 0) {
57
+ Tree.emplace_back(item, itmset, anct);
58
+ last_sibl = Tree.size() - 1;
74
59
  if (last_arc < Tree.size()) {
75
- last_sibl = Tree[last_arc].chld;
60
+ Tree[last_arc].chld = last_sibl;
76
61
  }
77
-
78
- if (last_sibl == 0) {
79
- // Insert new node as first child
80
- Tree.emplace_back(item, itmset, anct);
81
- last_sibl = Tree.size() - 1;
82
-
83
- if (last_arc < Tree.size()) {
84
- Tree[last_arc].chld = last_sibl;
85
- }
86
- if (anct == 0) {
87
- // Debug before DFS access
88
- // std::cout << "[Add_arc] • DFS access at index=" << (std::abs(item) - 1)
89
- // << " DFS.size=" << DFS.size() << std::endl;
90
- DFS[std::abs(item) - 1].str_pnt.push_back(last_sibl);
62
+ if (anct == 0) {
63
+ DFS[std::abs(item) - 1].str_pnt.push_back(last_sibl);
64
+ }
65
+ } else {
66
+ while (true) {
67
+ if (last_sibl >= Tree.size()) break;
68
+ if (Tree[last_sibl].item == item) {
69
+ break;
91
70
  }
92
-
93
- } else {
94
-
95
- // Walk siblings until find matching item or end
96
- while (true) {
97
- if (last_sibl >= Tree.size()) {
98
- // std::cout << "[Add_arc] !!! last_sibl OOB last_sibl="
99
- // << last_sibl << " Tree.size=" << Tree.size()
100
- // << std::endl;
101
- break;
102
- }
103
- if (Tree[last_sibl].item == item) {
104
- break;
105
- }
106
- if (Tree[last_sibl].sibl == 0) {
107
- Tree.emplace_back(item, itmset, anct);
108
- Tree[last_sibl].sibl = Tree.size() - 1;
109
- last_sibl = Tree.size() - 1;
110
- if (anct == 0) {
111
- // std::cout << "[Add_arc] • DFS access at index=" << (std::abs(item) - 1)
112
- // << " DFS.size=" << DFS.size() << std::endl;
113
- DFS[std::abs(item) - 1].str_pnt.push_back(last_sibl);
114
- }
115
- break;
71
+ if (Tree[last_sibl].sibl == 0) {
72
+ Tree.emplace_back(item, itmset, anct);
73
+ Tree[last_sibl].sibl = Tree.size() - 1;
74
+ last_sibl = Tree.size() - 1;
75
+ if (anct == 0) {
76
+ DFS[std::abs(item) - 1].str_pnt.push_back(last_sibl);
116
77
  }
117
- last_sibl = Tree[last_sibl].sibl;
78
+ break;
118
79
  }
80
+ last_sibl = Tree[last_sibl].sibl;
119
81
  }
82
+ }
120
83
 
121
- if (anct == 0) {
122
- // std::cout << "[Add_arc] • increment DFS.freq at index=" << (std::abs(item) - 1)
123
- // << " DFS.size=" << DFS.size() << std::endl;
124
- DFS[std::abs(item) - 1].freq++;
125
- }
126
-
127
- if (last_sibl < Tree.size()) {
128
- // std::cout << "[Add_arc] • increment Tree.freq at node=" << last_sibl
129
- // << " Tree.size=" << Tree.size() << std::endl;
130
- Tree[last_sibl].freq++;
131
- }
84
+ if (anct == 0) {
85
+ DFS[std::abs(item) - 1].freq++;
86
+ }
132
87
 
133
- ancest_map[std::abs(item)] = last_sibl;
134
- return last_sibl;
88
+ if (last_sibl < Tree.size()) {
89
+ Tree[last_sibl].freq++;
135
90
  }
136
91
 
137
- } // namespace largebm
92
+ ancest_map[std::abs(item)] = last_sibl;
93
+ return static_cast<int>(last_sibl);
94
+ }
95
+
96
+ } // namespace largebm
@@ -1,47 +1,32 @@
1
1
  #pragma once
2
-
3
- #include<vector>
4
- #include <cmath>
5
- #include "load_inst.hpp"
2
+ #include <vector>
3
+ #include <cstdint>
6
4
 
7
5
  namespace largebm {
8
- void Build_MDD(std::vector<int>& items);
9
6
 
10
7
  class Arc {
11
8
  public:
9
+ unsigned long long chld = 0;
10
+ unsigned long long sibl = 0;
11
+ unsigned long long freq = 0;
12
+ unsigned long long anct = 0;
13
+ int itmset = 0;
14
+ int item = 0;
15
+
16
+ Arc() = default;
17
+ Arc(int _itm, int _itmset, unsigned long long _anc)
18
+ : chld(0), sibl(0), freq(0), anct(_anc), itmset(_itmset), item(_itm) {}
19
+ Arc(int _itm, unsigned long long _anc)
20
+ : chld(0), sibl(0), freq(0), anct(_anc), item(_itm) {}
21
+ };
12
22
 
13
- unsigned long long int chld;
14
- unsigned long long int sibl;
15
- unsigned long long int freq;
16
- unsigned long long int anct;
17
- int itmset;
18
- int item;
19
-
20
- Arc(int _itm, int _itmset, unsigned long long int _anc) {
21
- itmset = _itmset;
22
- anct = _anc;
23
- item = _itm;
24
- freq = 0;
25
- chld = 0;
26
- sibl = 0;
27
- }
28
-
29
- Arc(int _itm, int _anc) {
30
- item = _itm;
31
- anct = _anc;
32
- freq = 0;
33
- chld = 0;
34
- sibl = 0;
35
- }
36
-
37
- Arc() {
38
- freq = 0;
39
- chld = 0;
40
- sibl = 0;
41
- }
23
+ // Single global MDD, defined in build_mdd.cpp
24
+ extern std::vector<Arc> Tree;
42
25
 
26
+ // [2025-10-25 NEW]: const-correct signature used everywhere
27
+ void Build_MDD(const std::vector<int>& items);
43
28
 
44
- };
29
+ // [2025-10-25 NEW]: debug helper to read how many anct==0 ticks we did
30
+ unsigned long long _effspm_dbg_anct0_ticks();
45
31
 
46
- extern std::vector<Arc> Tree;
47
- }
32
+ } // namespace largebm