-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
71 lines (65 loc) · 1.51 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* @Descripttion:
* @version:
* @Author: springhser
* @Date: 2021-04-18 23:32:34
* @LastEditors: springhser
* @LastEditTime: 2021-06-13 20:55:34
*/
#include "DataReader.hpp"
#include "TSP.hpp"
// void testDataReader()
// {
// TESTMODULE("read data")
// TESTCASE("read data")
// std::ifstream infile("Data/att48.tsp");
// Points point_list;
// DataReader::addContents(infile, point_list);
// helptool::PrintContainer<Point2D> pprint;
// pprint.printVecMultiLines(point_list);
// }
// void testInitTSP()
// {
// TESTMODULE("Initialise TSP")
// std::ifstream infile("Data/test.tsp");
// Points point_list;
// DataReader::addContents(infile, point_list);
// TSP tsp(point_list);
// TESTCASE("print node distance matrix")
// tsp.printTour();
// }
void testDoOpt()
{
TESTMODULE("Execute TSP")
// std::ifstream infile("Data/test.tsp");
std::ifstream infile("Data/att48.tsp");
Points point_list;
DataReader::addContents(infile, point_list);
TSP tsp(point_list);
tsp.printCost();
TESTCASE("Optimise the Tour")
tsp.optTour();
tsp.printCost();
tsp.printRes();
}
void testAll()
{
// testDataReader();
// testInitTSP();
// testDoOpt();
#ifdef NO_TEST
EdgeTest e_test;
e_test.test();
TourTest tour_test;
tour_test.test();
TSPTest tsp_test;
tsp_test.test();
#endif
helptool::Timer<std::chrono::milliseconds> timer("LKH", "milliseconds");
testDoOpt();
}
int main()
{
testAll();
return 0;
}