-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaphMain.cpp
46 lines (38 loc) · 2.72 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
#include <cstdlib>
#include <fstream>
#include <iostream>
#include "maphSat.hpp"
void printError(char * prog) {
std::cerr << R"(
███╗ ███╗ █████╗ ██████╗ ██╗ ██╗███████╗ ██████╗ ██╗ ██╗ ██╗███████╗██████╗
████╗ ████║██╔══██╗██╔══██╗██║ ██║██╔════╝██╔═══██╗██║ ██║ ██║██╔════╝██╔══██╗
██╔████╔██║███████║██████╔╝███████║███████╗██║ ██║██║ ██║ ██║█████╗ ██████╔╝
██║╚██╔╝██║██╔══██║██╔═══╝ ██╔══██║╚════██║██║ ██║██║ ╚██╗ ██╔╝██╔══╝ ██╔══██╗
██║ ╚═╝ ██║██║ ██║██║ ██║ ██║███████║╚██████╔╝███████╗ ╚████╔╝ ███████╗██║ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚══════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
)" << "\nUsage: " << prog << " <DIMACS file>" << " selection heuristic:\n <FIRST=0 | RANDOM=1 | DLIS=2 | RDLIS=3 | DLCS=4 | RDLCS=5 | JW=6 | RJW=7 | MOMS=8 | RMOMS=9>\n\n"
<< "Available selection heuristics: \n" << "- FIRST: select the first available literal\n"
<< "- RANDOM: select a random literal\n" << "- DLIS: Dynamic Largest Individual Sum\n" << "- RDLIS: randomized Dynamic Largest Individual Sum\n"
<< "- DLCS: Dynamic Largest Combined Sum\n" << "- RDLCS: randomized Dynamic Largest Combined Sum\n" << "- JW: Jeroslow-Wang heuristic\n"
<< "- RJW: randomized Jeroslow-Wang heuristic\n" << "- MOMS: Maximum [number of] Occurrences in Minimum [length] Clauses\n"
<< "- RMOMS: randomized Maximum [number of] Occurrences in Minimum [length] Clauses\n";
}
int main(int argc, char ** argv) {
if (argc < 3) {
printError(argv[0]);
return 1;
}
std::ifstream stream(argv[1]);
const int heuristic = atoi(argv[2]);
if (stream.fail() || heuristic < 0 || heuristic > 9) {
printError(argv[0]);
return 1;
}
MaphSAT solver(stream, static_cast<MaphSAT::Heuristic>(heuristic));
solver.solve();
std::cout << solver;
if (std::cout.bad()) {
std::cerr << "Error while printing.\n";
return 1;
}
}