-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
38 lines (30 loc) · 908 Bytes
/
main.cpp
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
#include "ZTEGenetic.h"
using namespace ZTE_crb;
int generations = 100;
int genetics = 200;
int maxNum = 9;
double crossRate = 0.1;
double muteRate = 0.2;
void InitGenetic(ZTEGenetic &genetic)
{
genetic.LoadGraph("../Graph1.csv");
genetic.SetVex(7, VexType::MUST);
genetic.SetVex(12, VexType::MUST);
genetic.SetEdge(2, 4, 2, EdgeType::MUST);
genetic.SetEdge(13, 14, 1, EdgeType::MUST);
genetic.SetEdge(11, 12, 1, EdgeType::FORBID);
genetic.InitGenetic();
}
int main(int argc, char *argv[]) {
ZTEGenetic genetic1 = ZTEGenetic(genetics, maxNum, crossRate, muteRate);
InitGenetic(genetic1);
genetic1.DisplayGraph();
for (int i = 0; i < generations-1; ++i){
genetic1.GeneticInfo();
genetic1.Evolution();
}
std::cout << std::endl << "------------\nevolution done!" << std::endl;
genetic1.GeneticInfo();
getchar();
return 0;
}