- My very own NEAT framework in C++ (it's neat & tidy) : [v1. BASE] - [v2. SFML] - [v3. EMUL]
- The NeuroEvolution of Augmenting Topologies (NEAT) User Page : http://www.cs.ucf.edu/~kstanley/neat.html
- MarI/O - Machine Learning for Video Games (SethBling) : https://www.youtube.com/watch?v=qv6UVOQ0F44
- NEAT-Python documentation XOR problem : https://neat-python.readthedocs.io/en/latest/xor_example.html
cd bin
./make.sh
or
$ sudo apt-get update
$ sudo apt-get install g++ cmake valgrind libgtest-dev
$ cd /usr/src/gtest
$ sudo cmake CMakeLists.txt
$ sudo make
$ sudo cp -v lib/*.a /usr/lib
./app.sh
or
$ ./build.sh -R
$ ./compile.sh
$ ./run.sh -m train -g 150 -t 0 -n 0 -p plt -s sav
$ ./run.sh -m eval -e 10 -t 0 -n 0 -s sav
./train.sh [-D -R] <args>
or
* Debug : $ ./train.sh -D -g 150 -t 0 -n 0 -p plt -s sav
* Release : $ ./train.sh -R -g 150 -t 0 -n 0 -p plt -s sav
./eval.sh [-D -R] <args>
or
* Debug : $ ./eval.sh -D -e 10 -t 0 -n 0 -s sav
* Release : $ ./eval.sh -R -e 10 -t 0 -n 0 -s sav
./play.sh [-D -R] <args>
or
* Debug : $ ./play.sh -D -e 10
* Release : $ ./play.sh -R -e 10
./test.sh [-D -R] <args>
or
* Debug : $ ./test.sh -D
* Release : $ ./test.sh -R
./memcheck.sh <cmd>
* Example : $ ./memcheck.sh ./train.sh -g 10
* Example : $ ./memcheck.sh ./eval.sh -s sav
./log.sh [-V] <cmd>
* Example : $ ./log.sh ./train.sh -s sav
* Example : $ ./log.sh -V ./play.sh -e 1
./readme.sh
* Update : $ ./readme.sh
./help.sh
usage: apps/exec [-h] [-m MOD] [-g GEN] [-e EPO] [-t STP] [-n NOP] [-p PLT] [-s SAV]
NEAT XOR
optional args:
-h Print help and exit
-m MOD Set mode < train | eval | play | test >
params:
-g GEN [train] Set number generation (0=inf)
-e EPO [eval, play] Set number epoch (0=inf)
-t STP [train, eval] Set number max step (0=inf)
-n NOP [train, eval] Set number max noop (0=inf)
utils:
-p PLT [train] Set file name plot plt
-s SAV [train, eval] Set file name save sav
include/env/conf.hpp
* HYPERPARAMETER VALUES :
INPUTS = 2
OUTPUTS = 1
LIM_HIDDEN = 1000000
MUTATE_WEIGHT_RATE = 0.1f
MUTATE_GENE_RATE = 0.25f
MUTATE_LINK_RATE = 2.f
MUTATE_BIAS_RATE = 0.4f
MUTATE_NEURON_RATE = 0.5f
MUTATE_ENABLE_RATE = 0.2f
MUTATE_DISABLE_RATE = 0.4f
MUTATE_OFFSET_SIZE = 0.1f
MUTATE_RATE_DECAY = 0.f
DELTA_DISJOINT = 2.f
DELTA_WEIGHTS = 0.4f
DELTA_THRESHOLD = 1.f
CROSSOVER_PROB = 0.75f
STALE_SPECIES = 15
POPULATION_SIZE = 150
END_POPULATION_SIZE = 0
POPULATION_GENS_INC = 150
POPULATION_INC_FREQ = 10
ACT_REPEAT = 0
MVG_AVG = 150
PLT_FREQ = 0
SAV_FREQ = 1
GENERATIONS_TRAIN = 150
EPOCHS_EVAL = 10
MAX_STEP = 0
MAX_NOOP = 0
cd bin && ./app.sh
-------------------------------TRAIN-------------------------------
Time: 2296.96ms
log/plots/
-------------------------------EVAL--------------------------------
EPOCH : 1 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 1 0 | 1 | 1 |
#2 | 0 0 | 0 | 0 |
#3 | 1 1 | 0 | 0 |
#4 | 0 1 | 1 | 1 |
------------------
EPOCH : 2 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 0 0 | 0 | 0 |
#2 | 1 1 | 0 | 0 |
#3 | 1 0 | 1 | 1 |
#4 | 0 1 | 1 | 1 |
------------------
EPOCH : 3 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 1 0 | 1 | 1 |
#2 | 1 1 | 0 | 0 |
#3 | 0 1 | 1 | 1 |
#4 | 0 0 | 0 | 0 |
------------------
EPOCH : 4 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 1 1 | 0 | 0 |
#2 | 0 1 | 1 | 1 |
#3 | 0 0 | 0 | 0 |
#4 | 1 0 | 1 | 1 |
------------------
EPOCH : 5 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 0 1 | 1 | 1 |
#2 | 1 0 | 1 | 1 |
#3 | 1 1 | 0 | 0 |
#4 | 0 0 | 0 | 0 |
------------------
EPOCH : 6 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 1 0 | 1 | 1 |
#2 | 1 1 | 0 | 0 |
#3 | 0 0 | 0 | 0 |
#4 | 0 1 | 1 | 1 |
------------------
EPOCH : 7 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 0 0 | 0 | 0 |
#2 | 1 0 | 1 | 1 |
#3 | 1 1 | 0 | 0 |
#4 | 0 1 | 1 | 1 |
------------------
EPOCH : 8 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 1 1 | 0 | 0 |
#2 | 0 0 | 0 | 0 |
#3 | 1 0 | 1 | 1 |
#4 | 0 1 | 1 | 1 |
------------------
EPOCH : 9 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 0 0 | 0 | 0 |
#2 | 0 1 | 1 | 1 |
#3 | 1 0 | 1 | 1 |
#4 | 1 1 | 0 | 0 |
------------------
EPOCH : 10 / 10
SUCCESS : 4 / 4
RATE : 1
MVG AVG : 4
| X | Y | H |
---|-----|---|---|
#1 | 1 0 | 1 | 1 |
#2 | 1 1 | 0 | 0 |
#3 | 0 0 | 0 | 0 |
#4 | 0 1 | 1 | 1 |
------------------
Time: 4.8907ms
include/env/env/
src/env/env/
- 1.1. implement model
res/
- 1.2. add resources
include/env/env.hpp
- 2.1. add include
- 2.2. declare model struct
src/env/env.hpp
- 2.3. define initialization function
- 2.4. define observation function
- 2.5. define action function
- 2.6. define is done function
- 2.7. define fitness function
- 2.8. define information function
- 2.9. define no operation function
- 2.10. define reset function
- 2.11. define step function
- 2.12. define reset render function
- 2.13. define step render function
include/env/view.hpp
- 3.1. add include
- 3.2. declare event state struct
- 3.3. declare draw variables
- 3.4. declare draw functions
src/env/view.cpp
- 3.5. define event setup function
- 3.6. define get action function
- 3.7. define draw setup function
- 3.8. define draw loop function
test/include/
test/src/
- 4.1. implement tests
include/env/conf.hpp
- 5.1. add include
- 5.2. define default arguments
- 5.3. declare actions enum
- 5.4. declare optional parameters
- 5.5. define argv cmds commands
- 5.6. define help error message
- 5.7. define optional commands
- 5.8. define params parameters
- 5.9. define optional parameters
README.md
- 6.1. update readme
LICENSE
- 6.2. update license
@romainducrocq