/NEAT-TidyV2fml

Primary LanguageC++MIT LicenseMIT

[C++] Topologies I Dunno Yet, eVolve &>SFML

> TidyV2fml : My very own NEAT framework in C++ (it's v2 with SFML)


Examples


How to _

cd bin

Install

./make.sh or

$ sudo apt-get update
$ sudo apt-get install g++ cmake valgrind libgtest-dev libsfml-dev

$ cd /usr/src/gtest
$ sudo cmake CMakeLists.txt
$ sudo make
$ sudo cp -v lib/*.a /usr/lib

Run

./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

./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

./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

./play.sh [-D -R] <args> or

* Debug   : $ ./play.sh -D -e 10
* Release : $ ./play.sh -R -e 10

Test

./test.sh [-D -R] <args> or

* Debug   : $ ./test.sh -D 
* Release : $ ./test.sh -R 

Memcheck

./memcheck.sh <cmd>

* Example : $ ./memcheck.sh ./train.sh -g 10 
* Example : $ ./memcheck.sh ./eval.sh -s sav

Log

./log.sh [-V] <cmd>

* Example : $ ./log.sh ./train.sh -s sav
* Example : $ ./log.sh -V ./play.sh -e 1

Readme

./readme.sh

* Update : $ ./readme.sh

Help

./help.sh

usage: apps/exec [-h] [-m MOD] [-g GEN] [-e EPO] [-t STP] [-n NOP] [-p PLT] [-s SAV]

TidyV2fml

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

Config

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          = 0
MAX_STEP             = 0
MAX_NOOP             = 0

Demo

cd bin && ./app.sh

-------------------------------TRAIN-------------------------------

log/plots/

-------------------------------EVAL--------------------------------

Docs

1. Model

include/env/env/ src/env/env/

  • 1.1. implement model

res/

  • 1.2. add resources

2. Control

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

3. View

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

4. Tests

test/include/ test/src/

  • 4.1. implement tests

5. Parameters

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

6. Readme & license

README.md

  • 6.1. update readme

LICENSE

  • 6.2. update license

@romainducrocq