This repository was archived by the owner on Jul 1, 2021. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
120 lines (100 loc) · 3.46 KB
/
Copy pathmain.cpp
File metadata and controls
120 lines (100 loc) · 3.46 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include <iostream>
#include "utils.h"
#include "xor_experiment.h"
#include "genome_mutations_crossovers.h"
#include "random_evolution.h"
#include "serialization_tests.h"
#include "novelty_tests.h"
enum choice_t {
EXIT,
XOR_EV_EXP,
XOR_EV_100_EXP,
XOR_EV_STATS_EXP,
NOVELTY_EV_EXP,
NOVELTY_EV_100_EXP,
NOVELTY_EV_STATS_EXP,
EX_XOR_NET,
RT_XOR_EXP,
RAND_EVO,
GEN_MUT_CROSS,
SERDES,
NOVELTY_TESTS,
COFFEE
};
int main() {
std::cout << " NEToolKit examples" << std::endl;
std::cout << "~~------==========------~~" << std::endl;
int choice = -1;
while (choice != EXIT) {
if (choice != -1)
wait_user();
std::cout << std::endl << "Would you like to:" << std::endl;
std::cout << "\t" << XOR_EV_EXP << ". run one detailed xor network evolution experiment?" << std::endl;
std::cout << "\t" << XOR_EV_100_EXP << ". run 100 xor network evolution experiments?" << std::endl;
std::cout << "\t" << XOR_EV_STATS_EXP << ". run 1000 xor network evolution experiments and record in a csv file?" << std::endl;
std::cout << "\t" << NOVELTY_EV_EXP << ". (novelty) run one detailed xor network evolution experiment?" << std::endl;
std::cout << "\t" << NOVELTY_EV_100_EXP << ". (novelty) run 100 xor network evolution experiments?" << std::endl;
std::cout << "\t" << NOVELTY_EV_STATS_EXP << ". (novelty) run 1000 xor network evolution experiments and record in a csv file?" << std::endl;
std::cout << "\t" << EX_XOR_NET << ". run the example xor network?" << std::endl;
std::cout << "\t" << RT_XOR_EXP << ". run one detailed xor network evolution experiment with rtNEAT?" << std::endl;
std::cout << "\t" << RAND_EVO << ". run a random evolution (random fitness at each generation)?" << std::endl;
std::cout << "\t" << GEN_MUT_CROSS << ". run various mutations and crossover on simple genomes?" << std::endl;
std::cout << "\t" << SERDES << ". run the serialization tests?" << std::endl;
std::cout << "\t" << NOVELTY_TESTS << ". run the novelty tests?" << std::endl;
std::cout << "\t" << COFFEE << ". get a cup of coffee?" << std::endl;
std::cout << "\t" << EXIT << ". exit this program?" << std::endl;
std::cout << ">>> ";
std::cin >> choice;
// for bad people who doesn't give numerical inputs...
// get rid of failure state
std::cin.clear();
// discard 'bad' character(s)
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
switch (choice) {
case EXIT:
std::cout << "Exiting..." << std::endl;
break;
case XOR_EV_EXP:
run_one_xor_experiment(false);
break;
case XOR_EV_100_EXP:
run_n_xor_experiments(100, false, false);
break;
case XOR_EV_STATS_EXP:
run_n_xor_experiments(1000, false, true, "1000_xor_results.csv");
break;
case NOVELTY_EV_EXP:
run_one_xor_experiment(true);
break;
case NOVELTY_EV_100_EXP:
run_n_xor_experiments(100, true, false);
break;
case NOVELTY_EV_STATS_EXP:
run_n_xor_experiments(1000, true, true, "1000_xor_results_novelty.csv");
break;
case EX_XOR_NET:
xor_network_test();
break;
case RT_XOR_EXP:
run_one_real_time_xor_experiment(true);
break;
case RAND_EVO:
run_random_evolution();
break;
case GEN_MUT_CROSS:
run_genome_mutations_crossovers();
break;
case SERDES:
run_serialization_tests();
break;
case NOVELTY_TESTS:
run_novelty_tests();
break;
case COFFEE:
std::cout << "I hope you will find one then." << std::endl;
break;
default:
std::cout << "Well, try to choose something I proposed, OK?" << std::endl;
}
}
}