-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstrategy.h
53 lines (41 loc) · 1.03 KB
/
strategy.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
#ifndef STRATEGY_H
#define STRATEGY_H
#include"traveller.h"
#include"timetable.h"
#include<QtSql/QSql>
#include<QtSql/QSqlDatabase>
#include<QtSql/QSqlQuery>
#include<QSqlError>
#include<QMessageBox>
#include<QSqlRecord>
#include<QDebug>
#include<algorithm>
#include<vector>
#define LEAST_TIME_STRA 1 //最少时间
#define LEAST_FEE_STRA 2 //最少费用
#define LEAST_TIME_AND_FEE 3 //限时最少费用
#define ALLCITY 13
#define INFINITY 9999
typedef int STRATEGY_TYPE;
class Traveller;
class TimeTable;
/*三种策略*/
class Strategy
{
public:
Strategy();
~Strategy();
//friend class Traveller;
//最少时间策略
void leastTime_strategy(Traveller& customer);
//最少费用策略
int leastFee__strategy(Traveller& customer);
//返回最少费用
//限时最少费用策略
void leastFeeTime_strategy(Traveller& customer);
void initStrategy();
private:
int shortPathTable[ALLCITY][ALLCITY];//记录路径
int Path[ALLCITY][ALLCITY];//记录最短的费用
};
#endif // STRATEGY_H