-
Notifications
You must be signed in to change notification settings - Fork 0
/
MCE.cpp
97 lines (87 loc) · 2.09 KB
/
MCE.cpp
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// Created by admin on 15/03/2017.
//
#include "MCE.h"
void MCE::init()
{
ifstream f(FILE_NAME);
int n, m, t1, t2;
f >> n >> m;
graph.init(n);
while(!f.eof()) {
f >> t1 >> t2;
if(t1 != t2) graph.createConnection(t1, t2);
}
#if DEBUG
graph.print();
#endif
vNum = n;
sumMCE = 0;
f.close();
}
void MCE::printR(set<int> R)
{
#if MCE_OUTPUT
if(R.size() >= lb) {
//cout << "Maximal Clique found: " << endl;
fo << "["; //cout << "[ ";
for (set<int>::iterator rt = R.begin(); rt != R.end(); rt++)
fo << *rt << " ";
//std::cout << *rt << " ";
//cout << "] " << endl;
fo << "]" << endl;
sumMCE++;
#if ANS_ANALYSIS
ans.insert(R);
#endif
#if REPEAT_ANALYSIS
if(ans2.find(R) != ans2.end()) ans2.insert(R);
else
assert("ERROR! REPEATED VALUE!");
#endif
}
#endif
}
void MCE::printR(vector<int> R)
{
#if MCE_OUTPUT
if(R.size() >= lb) {
//cout << "Maximal Clique found: " << endl;
fo << "["; //cout << "[ ";
for (vector<int>::iterator rt = R.begin(); rt != R.end(); rt++)
fo << *rt << " ";
//std::cout << *rt << " ";
//cout << "] " << endl;
fo << "]" << endl;
sumMCE++;
#if ANS_ANALYSIS
ans.insert(R);
#endif
#if REPEAT_ANALYSIS
if(ans2.find(R) != ans2.end()) ans2.insert(R);
else
assert("ERROR! REPEATED VALUE!");
#endif
}
#endif
}
void MCE::preprocessing() {
cout << "Error! Preprocessing haven't been implemented!" << endl;
}
void MCE::solve() {
cout << "Error! Solve haven't been implemented!" << endl;
}
void MCE::run(int i) {
auto start = high_resolution_clock::now();
init();
fo.open("ans.txt");
cout << "Start Run:" << i << endl;
graph.setLowerBound(i);
lb = i;//just for debug! lb = i;
preprocessing();
solve();
cout << "Sum of all maximal clique:" << sumMCE << endl << endl;
cout << "finished.";
cout << duration_cast<milliseconds>(high_resolution_clock::now() - start).count() << "ms\n";
fo.close();
}