-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.cpp
55 lines (46 loc) · 1.18 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
47
48
49
50
51
52
53
54
55
#include <bits/stdc++.h>
#include "input.h"
#include "Graph.h"
#include "Reduction.h"
#include "BranchingSolution.h"
#include "checker.h"
#include "Timer.h"
using namespace std;
int32_t main(int argc, char*argv[]) {
// Main Function
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if(argc != 4) {
cout<<"Usage : "<<argv[0]<<"<InputFileName> "<<"<outputFileName> "<<"<value K>"<<endl;
return 0;
}
freopen(argv[2], "a", stdout);
Graph graph;
graph.K = atoi(argv[3]);;
readInput(graph, argv[1]);
auto start = high_resolution_clock::now();
RRTimeLog time1, time2;
time1.start_time = start;
time2.start_time = start;
cout << argv[1] << ",";
if(solve(graph, time1, time2) == 0) {
cout << "false" << ",";
}
else {
auto end = high_resolution_clock::now();
if(!time2.matroid_matching_completed){
time2.matroid_matching_time = end;
}
if(check(graph.adjList, graph.solution)) {
auto duration = duration_cast<milliseconds>(end - start);
cout<<duration.count()<<",";
duration = duration_cast<milliseconds>(time2.matroid_matching_time - time2.start_time);
cout<<duration.count()<<",";
time1.logMsg();
time2.logMsg();
}
}
cout<<endl;
return 0;
}