-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathant.h
52 lines (41 loc) · 1.09 KB
/
ant.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
#ifndef ANT_H
#define ANT_H
#include "entity.h"
#include <QSet>
#include <QPair>
#include "city.h"
#define MOVE_SPEED 5
class Ant : public Entity
{
public:
Ant(QSharedPointer<City> &startingCity, int index, int numCities);
virtual ~Ant();
virtual QGraphicsItem *getGraphicsItem();
bool update(QList<QSP<City> > &cities);
bool removeCity(int city);
void addCity();
BestDistancePheromone addPheromoneToTour(QList<QSP<City> > &cities);
void resetTour();
QList<int> getTour();
int tourLength();
static void setSpeed(int speed);
static void setPheromoneImportance(int val);
static void setDistanceImportance(int val);
static void setMutation(int val);
protected:
void updateEllipse();
void chooseNextCity(QList<QSP<City> > &cities);
void chooseRandomCity();
QGraphicsEllipseItem *ellipse;
QList<bool> tabu;
QList<int> tour;
int startCity;
int fromCity;
int toCity;
bool doneTour;
static int speed;
static double pheromoneExponent;
static double distanceExponent;
static int mutation;
};
#endif // ANT_H