-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathANT_INIT.h
86 lines (44 loc) · 1.23 KB
/
ANT_INIT.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
80
81
82
83
84
85
#include<cstdlib>
#include<cstdio>
#include<iostream>
#include<math.h>
#include<vector>
#include<fstream>
#include<time.h>
#include<stdlib.h>
#include <cmath>
#include <limits>
#include <climits>
#include "INIT.cpp"
class ACO {
public:
ACO (int nAnts, int nCities, double alpha, double beta, double q, double ro, double taumax, int initCity);
virtual ~ACO ();
void init ();
void connectCITIES (int cityi, int cityj);
void setCITYPOSITION (int city, double x, double y,double z);
void printPHEROMONES ();
void printGRAPH ();
void printRESULTS ();
double maxer(int x);
double ratio (int x);
void optimize (int ITERATIONS,int dest);
private:
double distance (int cityi, int cityj);
bool exists (int cityi, int cityc);
bool vizited (int antk, int c);
double PHI (int cityi, int cityj, int antk);
double length (int antk);
int city ();
void route (int antk);
int valid (int antk, int iteration);
void updatePHEROMONES ();
int NUMBEROFANTS, NUMBEROFCITIES, INITIALCITY;
double ALPHA, BETA, Q, RO, TAUMAX;
double BESTLENGTH,BESTRATIO;
int *BESTROUTE;
int **GRAPH, **ROUTES,**BR,**PRINT;
double **PHEROMONES, **DELTAPHEROMONES, **PROBS;
double **CITIES;
Randoms *randoms;
};