-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsp.h
79 lines (56 loc) · 1.36 KB
/
tsp.h
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
72
73
74
75
76
77
78
79
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <pthread.h>
#include <queue>
#include <stack>
#include <string>
#include <stdio.h>
#include <vector>
using namespace std;
class TSP
{
private:
// Filename supplied on command line to read from
string inFname;
// Program-generated filename to output to
string outFname;
// Initialization function
void getNodeCount();
//void addNode(vector<pair<int, int>> *adjList, int next, int cost);
int nearestNeighbour();
bool isVisited(bool* arr);
protected:
public:
// Number of nodes
int n;
int minpath;
void readFile();
// Current shortest path length
//int pathLength;
// Adjacency list
// Array of n dynamic arrays, each holding a list of nodes it's index is attached to
vector<pair<int, int>> *adjlist;
//int start_idx[THREADS];
//int end_idx[THREADS];
// Constructor
TSP(string in, string out);
// Destructor
~TSP();
// Initialization functions
// Greedy function
void greedyTSP(int start);
// Debugging functions
//void printCities();
void printAdjList();
void printResult();
// Get node count
int get_size() {return n;};
// void init(string in, string out);
};