-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaphMain.cpp
62 lines (52 loc) · 3.02 KB
/
maphMain.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
#include <cstdlib>
#include <fstream>
#include <iostream>
#include "maphSat.hpp"
namespace fs = std::__fs::filesystem;
void printError(char * prog) {
std::cerr << R"(
███╗ ███╗ █████╗ ██████╗ ██╗ ██╗███████╗ ██████╗ ██╗ ██╗ ██╗███████╗██████╗
████╗ ████║██╔══██╗██╔══██╗██║ ██║██╔════╝██╔═══██╗██║ ██║ ██║██╔════╝██╔══██╗
██╔████╔██║███████║██████╔╝███████║███████╗██║ ██║██║ ██║ ██║█████╗ ██████╔╝
██║╚██╔╝██║██╔══██║██╔═══╝ ██╔══██║╚════██║██║ ██║██║ ╚██╗ ██╔╝██╔══╝ ██╔══██╗
██║ ╚═╝ ██║██║ ██║██║ ██║ ██║███████║╚██████╔╝███████╗ ╚████╔╝ ███████╗██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚══════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
)" << "\nUsage: " << prog << " <DIMACS file>" << " selection heuristic:\n <VSIDS=0 | EVSIDS=1>"
<< " optional DRAT proof logging: <Y>\n\n"
<< "Available selection heuristics:\n" << "- VSIDS: Variable State Independent Decaying Sum\n"
<< "- EVSIDS: Exponential Variable State Independent Decaying Sum\n"
<< "- WEVSIDS: Weighted Exponential Variable State Independent Decaying Sum\n";
// I suggest we git rid of the choice of heuristics (switching between cases is too slow when updating scores).
// I also think we should leave them in code and allow the user to comment them out to check that they really work.
// We should also use all three heuristics for overlaying cactus plots.
}
int main(int argc, char ** argv) {
bool proofLogging = false;
std::string proofName = "";
if (argc < 3) {
printError(argv[0]);
return 1;
}
else if (argc == 4) {
if (argv[3][0] == 'Y' || argv[3][0] == 'y') {
proofLogging = true;
proofName = fs::path(argv[1]).filename();
}
else {
printError(argv[0]);
}
}
std::ifstream stream(argv[1]);
const int heuristic = atoi(argv[2]);
if (stream.fail() || heuristic < 0 || heuristic > 1) {
printError(argv[0]);
return 1;
}
MaphSAT solver(stream, static_cast<MaphSAT::Heuristic>(heuristic), proofLogging, proofName);
solver.solve();
std::cout << solver;
if (std::cout.bad()) {
std::cerr << "Error while printing.\n";
return 1;
}
}