forked from woodbri/vrpdptw
-
Notifications
You must be signed in to change notification settings - Fork 1
/
TabuSearch.h
76 lines (53 loc) · 1.24 KB
/
TabuSearch.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
#ifndef TABUSEARCH
#define TABUSEARCH
#include <stdexcept>
#include <limits>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include "Solution.h"
#include "Move.h"
#include "Tabu.h"
class TabuSearch {
public:
// variables for Tabu Search
int iter;
Solution S;
double SCost;
Solution Best;
double BestCost;
std::vector<Tabu> T;
Move bestMove;
int tabuLength;
bool debugTabu;
bool debugPlots;
TabuSearch(Solution &s) : S(s), Best(s) {
iter = 0;
tabuLength = 30; // set a reasonable default
SCost = BestCost = Best.getCost(); // cost of the best
debugTabu = false;
debugPlots = false;
};
Solution solve();
bool doSPI();
bool doSBR();
bool doWRI();
double getAverageRouteDurationLength();
void applyMove(Move& m);
void addMoveTabu(Move& m);
void addTabu(Tabu& tm);
bool isMoveTabu(Move& m);
bool isTabu(Tabu& tm);
void cleanTabuList();
void dumpTabu() {
std::cout << "Tabu List:" << std::endl;
for (int i=0; i<T.size(); i++) {
std::cout << i <<": ";
T[i].dump();
}
};
};
#endif