-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheaders.h
76 lines (65 loc) · 2.34 KB
/
headers.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
# include <vector>
# include <string>
using namespace std;
// instance.cpp
class Instance {
public:
Instance(int n, int l, int u, int b, int o, vector<vector<int>> distances);
int getN();
int getL();
int getU();
int getB();
int getO();
vector<vector<int>> getDistances();
void print();
private:
int n;
int l;
int u;
int b;
int o;
vector<vector<int>> distances;
};
Instance readTxtInstance(string filename);
// tournament.cpp
class Tournament {
public:
Tournament(vector<vector<int>> schedule);
vector<vector<int>> getSchedule();
int getImprovements();
void setImprovements(int improvements);
vector<int> calculateTotalDistanceByTeam(vector<vector<int>> distances);
int calculateTotalDistance(vector<vector<int>> distances);
int verifyConsecutiveLocalGamesBounds(int l, int u);
int verifyConsecutiveAwayGamesBounds(int l, int u);
int verifyConsecutiveMaxGames(int b);
int verifyConsecutiveMaxByes(int o);
int countViolationsConsecutiveLocalGamesBounds(int l, int u);
int countViolationsConsecutiveAwayGamesBounds(int l, int u);
int countViolationsConsecutiveMaxGames(int b);
int countViolationsConsecutiveMaxByes(int o);
int verifyAllConstraints(Instance instance);
int countAllViolations(Instance instance);
int calculateConstraintsViolated(Instance instance);
int calculateFitness(Instance instance);
int calculateAverageDistance(vector<vector<int>> distances);
void writeToTxt(string filename, Instance instance, int execution_time);
void print();
private:
vector<vector<int>> schedule;
int improvements;
};
// initial_solution.cpp
Tournament initialSolution(Instance instance, int random_seed);
// moves.cpp
Tournament swapRounds(Tournament tournament, int round1, int round2);
Tournament swapHomes(Tournament tournament, int team1, int team2);
Tournament swapTeams(Tournament tournament, int team1, int team2);
Tournament hyperMove(Tournament tournament, Instance instance);
// hc.cpp
Tournament hillClimbingFI(Tournament initial_solution, Instance instance, int iter);
Tournament HCFI(Instance instance, int n_iter, int n_restarts, int seed);
// test.cpp
void testHC(int restarts, int n_iter, Instance instance);
void testRestarts(Instance instance);
void testHCFI(Instance instance, int n_iter, int n_restarts, int n_exec);