forked from 77sup/circuitSolver
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
46 lines (43 loc) · 1.13 KB
/
main.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 "include/solver.h"
#include "include/iscas89_parser.h"
#include "include/Time.h"
#include <string>
#include <fstream>
#include <time.h>
int main(int argc, char *argv[])
{
if (argc < 2)
{
log_error() << "no input file specified";
return 1;
}
std::ifstream ifs(argv[1]);
if (!ifs.good())
{
log_error() << "can't open file" << argv[1];
return 1;
}
auto Parser = 0;
auto Structure = 0;
auto Solver = 0;
ElapsedTimer t(true);
CircuitGraph graph;
Iscas89Parser parser;
if (!parser.parse(ifs, graph))
{
log_error() << "can't parse file" << argv[1];
return 1;
}
Parser = t.get_elapsed_us();
srand(time(NULL));
solver solver(graph);
Structure = t.get_elapsed_us();
solver.CDCLsolver(graph);
//std::cout<<"end function CDCLsolver"<<std::endl;
//std::cout<<"number: "<<number<<std::endl;
Solver = t.get_elapsed_us();
std::cout << "the time of parser: " << 1.0 * Parser/1000 << " ms" << std :: endl;
std::cout << "the time of structure:" << 1.0 * (Structure - Parser)/1000 << " ms" << std :: endl;
std::cout << "the time of solver: " << 1.0 * (Solver - Structure)/1000 << " ms" << std :: endl;
return 0;
}