-
Notifications
You must be signed in to change notification settings - Fork 0
/
Colony.h
54 lines (51 loc) · 1.42 KB
/
Colony.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
#ifndef COLONY_H_INCLUDED
#define COLONY_H_INCLUDED
#include "Ant.h"
#include "Node.h"
#include <list>
#include <vector>
class Colony{
private:
typedef struct prob{
double probability;
double distance;
bool visited;
}Edges;
Ant** ants;
int population_size;
int hotels_number;
std::vector<int> bestTour;
int costumer_number;
int points_number;
double limit;
Edges** edges;
double** pheromone;
std::vector<double> bestSolutions;
Node** points;
Node** hotels;
Node** costumers;
void resetPaths();
void cleanEdges();
void normalize(Ant* ant);
int verifyHotel(double cost, int i, int j);
public:
Colony(int population_size);
~Colony();
void readInstance();
void UpdatePheromone();
Ant* findBestAnt();
int chooseEdge(int i);
void firstConstruction();
void constructSolution();
void cheapestInsertion(Ant* ant);
double functionValue(Ant* ant);
bool checkSolution(Ant* ant);
void twoOpt(Ant *ant);
void twoOptInter(Ant *ant);
std::vector<int> threeOpt(Ant *ant);
std::vector<int> changeHotels(Ant *ant);
std::vector<int> exchange(Ant *ant);
void localSearch(Ant *ant);
void vnd(Ant* ant);
};
#endif // COLONY_H_INCLUDED