-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (34 loc) · 1.29 KB
/
Copy pathmain.cpp
File metadata and controls
35 lines (34 loc) · 1.29 KB
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
#include "GraphColoring.h"
#include "RandomGenerator.h"
#include "Solver.h"
#include <chrono>
#include <iostream>
int main(int argc, char *argv[])
{
if (argc != 3 && argc != 4)
{
std::cerr << "Usage: " << argv[0] << " <time_out> <seed> [tabu_iterations]" << std::endl;
return EXIT_FAILURE;
}
GraphColoring gc;
std::cin >> gc;
long long time_out = atoll(argv[1]);
int seed = atoi(argv[2]);
uint64_t tabu_iterations = argc == 4 ? strtoull(argv[3], nullptr, 10) : 80000;
#ifdef DEBUG
std::clog << "Node num\t" << gc.node_num << std::endl;
std::clog << "Edge num\t" << gc.edge_num << std::endl;
std::clog << "Color num\t" << gc.color_num << std::endl;
std::clog << "Limit time\t" << time_out << "s" << std::endl;
std::clog << "Random seed\t" << seed << std::endl;
std::clog << "Tabu iterations\t" << tabu_iterations << std::endl;
auto start = std::chrono::high_resolution_clock::now();
#endif
Solver(std::move(gc), seed).solve(time_out, tabu_iterations);
#ifdef DEBUG
auto end = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
std::clog << "Time used " << duration.count() << " milliseconds to execute." << std::endl;
#endif
return 0;
}