-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTour.h
More file actions
47 lines (37 loc) · 928 Bytes
/
Tour.h
File metadata and controls
47 lines (37 loc) · 928 Bytes
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
/*
* File: Tour.h
* Author: btacklind
*
* Created on May 21, 2015, 11:11 PM
*
* Has a tour as well as all distances between points
*/
#ifndef TOUR_H
#define TOUR_H
#include "DistanceMatrix.h"
using namespace std;
class Tour {
public:
static Tour Opt2(Tour t);
static Tour LinKernighan(Tour t);
Tour(int* tr, DistanceMatrix* dMat, int pnts, int l);
Tour(const Tour& orig);
virtual ~Tour();
inline int getlength(){return length;};
void printTour();
bool opt2();
void LinKern();
void opt3swap(int a, int b, int c);
private:
bool opt3();
void updateLength();
inline int d(int i, int j){return distMatrix->get(tour[i],tour[j]);};
void opt2swap(int i, int j);
bool opt2check(int i, int j);
bool opt3check(int a, int b, int c);
int points;
DistanceMatrix* distMatrix;
int* tour;
int length;
};
#endif /* TOUR_H */