-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.h
47 lines (39 loc) · 1 KB
/
utils.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
#ifndef PAR_DPLL_UTILS_H
#define PAR_DPLL_UTILS_H
#include <unordered_set>
#include <vector>
#include <iostream>
#include "intset.h"
using namespace std;
#define Set IntSet
unordered_set<int>* set_diff(unordered_set<int>& s1, unordered_set<int>& s2) {
auto* s1Copy = new unordered_set<int>(s1);
for (auto& s2Item: s2) {
s1Copy->erase(s2Item);
}
return s1Copy;
}
unordered_set<int>* set_add(unordered_set<int>& s1, unordered_set<int>& s2) {
auto* s1Copy = new unordered_set<int>(s1);
for (auto& s2Item: s2) {
s1Copy->insert(s2Item);
}
return s1Copy;
}
unordered_set<int>* set_neg(unordered_set<int>& s) {
auto* sCopy = new unordered_set<int>();
for (auto& item: s) {
sCopy->insert(-item);
}
return sCopy;
}
void print_cnf(vector<vector<int>>& cnf) {
for (auto& cnfClause: cnf) {
for (auto& cnfLiteral: cnfClause) {
cout << cnfLiteral << " ";
}
cout << ", ";
}
cout << endl;
}
#endif //PAR_DPLL_UTILS_H