-
Notifications
You must be signed in to change notification settings - Fork 0
/
evolution_game.h
112 lines (91 loc) · 2.28 KB
/
evolution_game.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef EVG
#define EVG
#define egX 20
#define egY 20
//#include "macro.h"
//#include "mpi.h"
const int ILOOP = 100; // I loop times in main rerun the whole sytem repeat times
const int JLOOP = 1000; //k loop times in main ,Gene algrithm generations
#include <omp.h>
//网络拓扑
#define MIX 10//全连接网络
#define LAT 11//网格网络
//博弈类型
#define G2X2 20
#define PD 21 //囚徒博弈
#define SD 22 //雪堆博弈
#define SH 23 //猎鹿博弈
#define EG2X2 24
#define GEN 25
//学习类型
#define IMX 30 //学习最大者
#define IRD 31 //随机学习
#define IDY 32 // replicator dynamic 动态学习
#define IGA 33 //遗传算法
#define ISD 34 //学习次大者
//策略更新规则
#define SYNC 40//同步更新
#define ASYNC 41//异步更新
#define HSKP 50
#define HS25 51
#define HS50 52
#define HS75 53
//移动网络移动步数
#define M0 0/// the mean changed in mobile game the number games in a meet .
#define M1 1
#define M2 2
#define M3 3
#define M4 4
#define M5 5
#define M6 6
#define M7 7
#define M8 8
#define M9 9
#define M10 10
#ifndef LINUX
#include "direct.h"
#include "io.h"
#endif
#include <fstream>
#include <vector>
using namespace std;
#ifndef TTTT
#define TTTT 10
#endif
class Evgame
{
// double mcr[ILOOP][egX][egY][JLOOP];
double mst[ILOOP][egX][egY][16];//存放策略
// double stdcr[egX][egY][JLOOP];
// double mfg[ILOOP][egX][egY][4096];
double tpf[ILOOP][egX][egY];//存放收益
// double smcr[egX][egY][JLOOP];
double smst[egX][egY][16];//存放某一轮策略
// double smfg[egX][egY][4096];
double stpf[egX][egY];//存放某一轮收益
vector<vector<vector<vector<double> > > > mcr;//存放合作历史
vector<vector<vector<double> > > smcr;//某一轮合作历史
vector<vector<vector<vector<double> > > > mfg;//存放策略的分布??
vector<vector<vector<double> > > smfg;//存放某一轮策略分布
vector<vector<vector<double> > > stdcr;//统计偏差
/*
double mpicr[ILOOP][JLOOP];
int mpimst[16];
double mpifg[64];
double mpipf[ILOOP];
*/
int tsize, ttmplen;
char fhead[30];
int nettype, gametype, imittype, synctype, mem, netsize;
int dataproc();
int crhp();
int fchmp();
int histp();
int pfp();
public:
Evgame(int nett, int gamet, int imitt, int synct, int meml);
//~eVgame();
int evgm();
int writefile();
};
#endif