-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
89 lines (69 loc) · 2.26 KB
/
main.cpp
File metadata and controls
89 lines (69 loc) · 2.26 KB
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
#include "LGPConfig/LGPConfig.h"
#include "symreg/XPop.h"
#include "mexican_hat/XPop.h"
#include "spiral_classification/XPop.h"
#include <iostream>
#include "LGPComp/LGPStats.h"
/*
#define VLD_MAX_DATA_DUMP 0
#define VLD_AGGREGATE_DUPLICATES 1
#include <vld.h>
*/
void spiral_classification_demo();
void symreg_demo();
void mexican_hat_demo();
int main()
{
//spiral_classification_demo();
//symreg_demo();
mexican_hat_demo();
return 0;
}
void mexican_hat_demo()
{
LGPConfig config("mexican_hat\\LGPConfig.xml");
std::cout << config.ToString() << std::endl;
mexican_hat::XPop pop(&config);
//LGPStats stats(&pop);
pop.BreedInitialPopulation();
while(!pop.Terminated())
{
pop.Evolve();
std::cout << "mexican hat generation: " << pop.GetCurrentGeneration() << std::endl;
std::cout << "global fitness: " << pop.GetGlobalFittestProgram()->GetFitness() << "\tcurrent fitness: " << pop.GetFittestProgram()->GetFitness() << std::endl;
//stats.LogStatistics();
}
std::cout << pop.GetGlobalFittestProgram()->ToString(true) << std::endl;
}
void spiral_classification_demo()
{
LGPConfig config("spiral_classification\\LGPConfig.xml");
std::cout << config.ToString() << std::endl;
spiral_classification::XPop pop(&config);
//LGPStats stats(&pop);
pop.BreedInitialPopulation();
while(!pop.Terminated())
{
pop.Evolve();
std::cout << "spiral classification generation: " << pop.GetCurrentGeneration() << std::endl;
std::cout << "global fitness: " << pop.GetGlobalFittestProgram()->GetFitness() << "\tcurrent fitness: " << pop.GetFittestProgram()->GetFitness() << std::endl;
//stats.LogStatistics();
}
std::cout << pop.GetGlobalFittestProgram()->ToString(true) << std::endl;
}
void symreg_demo()
{
LGPConfig config("symreg\\LGPConfig.xml");
std::cout << config.ToString() << std::endl;
symreg::XPop pop(&config);
//LGPStats stats(&pop);
pop.BreedInitialPopulation();
while(!pop.Terminated())
{
pop.Evolve();
std::cout << "mexican hat generation: " << pop.GetCurrentGeneration() << std::endl;
std::cout << "global fitness: " << pop.GetGlobalFittestProgram()->GetFitness() << "\tcurrent fitness: " << pop.GetFittestProgram()->GetFitness() << std::endl;
//stats.LogStatistics();
}
std::cout << pop.GetGlobalFittestProgram()->ToString(true) << std::endl;
}