peter-ch / MultiNEAT

Portable NeuroEvolution Library
http://MultiNEAT.com
GNU Lesser General Public License v3.0
327 stars 104 forks source link

Adding Dockerfile to build MultiNEAT under Ubuntu 18.10 consistently. #56

Closed synaptic-axon closed 5 years ago

synaptic-axon commented 5 years ago

I found this a bit challenging to build at first so I created this Dockerfile to build and install it in a controlled environment. I saw several people had created Issues about the build process so perhaps this will enable wider experimentation and reduce the barrier to entry.

synaptic-axon commented 5 years ago

Usage

Build the image

$ docker build -t myorg/multineat .

Run the image as a container

$ docker run -it --rm myorg/multneat
root@cd9f52efeabd:/#

Find the MultiNEAT files in /opt/MultiNEAT

root@cd9f52efeabd:/opt/MultiNEAT# ls -altrh
total 260K
drwxr-xr-x  2 root root 4.0K Apr  9 21:44  travis
drwxr-xr-x  2 root root 4.0K Apr  9 21:44  src
-rw-r--r--  1 root root 4.9K Apr  9 21:44  setup.py
drwxr-xr-x  3 root root 4.0K Apr  9 21:44  examples
drwxr-xr-x  2 root root 4.0K Apr  9 21:44  conda
-rw-r--r--  1 root root  14K Apr  9 21:44  cMultiNeat.pxd
-rw-r--r--  1 root root 1.5K Apr  9 21:44  appveyor.yml
-rw-r--r--  1 root root  50K Apr  9 21:44  _MultiNEAT.pyx
-rw-r--r--  1 root root 1.3K Apr  9 21:44  README.md
-rw-r--r--  1 root root  495 Apr  9 21:44  MultiNEAT.workspace
-rw-r--r--  1 root root 5.4K Apr  9 21:44  MultiNEAT.vcproj
-rw-r--r--  1 root root  863 Apr  9 21:44  MultiNEAT.sln
-rw-r--r--  1 root root 6.1K Apr  9 21:44  MultiNEAT.project
-rw-r--r--  1 root root 2.6K Apr  9 21:44  MultiNEAT.cbp
drwxr-xr-x  2 root root 4.0K Apr  9 21:44  MultiNEAT
-rw-r--r--  1 root root  103 Apr  9 21:44  MANIFEST.in
-rw-r--r--  1 root root 7.5K Apr  9 21:44  LICENSE
-rw-r--r--  1 root root    0 Apr  9 21:44  INSTALL
-rw-r--r--  1 root root 3.9K Apr  9 21:44 'ES-HyperNEAT readme'
-rw-r--r--  1 root root  341 Apr  9 21:44  DEPENDS
-rw-r--r--  1 root root 1.3K Apr  9 21:44  CMakeLists.txt
-rw-r--r--  1 root root  278 Apr  9 21:44  .travis.yml
-rw-r--r--  1 root root  301 Apr  9 21:44  .pydevproject
-rw-r--r--  1 root root 3.5K Apr  9 21:44  .project
-rw-r--r--  1 root root  559 Apr  9 21:44  .gitignore
drwxr-xr-x  8 root root 4.0K Apr  9 21:44  .git
-rw-r--r--  1 root root  18K Apr  9 21:44  .cproject
drwxr-xr-x  4 root root 4.0K Apr  9 22:07  ..
-rw-r--r--  1 root root 1.5K Apr  9 22:07  cmake_install.cmake
-rw-r--r--  1 root root  15K Apr  9 22:07  Makefile
drwxr-xr-x  5 root root 4.0K Apr  9 22:07  CMakeFiles
-rw-r--r--  1 root root  18K Apr  9 22:07  CMakeCache.txt
drwxr-xr-x  2 root root 4.0K Apr  9 22:09  multineat.egg-info
drwxr-xr-x  2 root root 4.0K Apr  9 22:09  dist
drwxr-xr-x  5 root root 4.0K Apr  9 22:09  build
drwxr-xr-x 12 root root 4.0K Apr  9 22:09  .

Try one of the example scripts

root@cd9f52efeabd:/opt/MultiNEAT/examples# python TestNEAT_xor.py
Run: 0 Generations to solve XOR: 31
Run: 1 Generations to solve XOR: 29
Run: 2 Generations to solve XOR: 27
Run: 3 Generations to solve XOR: 50
Run: 4 Generations to solve XOR: 42
Run: 5 Generations to solve XOR: 11
Run: 6 Generations to solve XOR: 11
Run: 7 Generations to solve XOR: 33
Run: 8 Generations to solve XOR: 25
Run: 9 Generations to solve XOR: 51
Run: 10 Generations to solve XOR: 28
Run: 11 Generations to solve XOR: 15
Run: 12 Generations to solve XOR: 12
Run: 13 Generations to solve XOR: 38
Run: 14 Generations to solve XOR: 28
Run: 15 Generations to solve XOR: 80
Run: 16 Generations to solve XOR: 15
Run: 17 Generations to solve XOR: 38
Run: 18 Generations to solve XOR: 40
Run: 19 Generations to solve XOR: 74
Run: 20 Generations to solve XOR: 27
Run: 21 Generations to solve XOR: 12
Run: 22 Generations to solve XOR: 14
Run: 23 Generations to solve XOR: 37
Run: 24 Generations to solve XOR: 27
Run: 25 Generations to solve XOR: 21
Run: 26 Generations to solve XOR: 46
Run: 27 Generations to solve XOR: 48
Run: 28 Generations to solve XOR: 27
Run: 29 Generations to solve XOR: 19
Run: 30 Generations to solve XOR: 28
Run: 31 Generations to solve XOR: 8
Run: 32 Generations to solve XOR: 48
Run: 33 Generations to solve XOR: 37
Run: 34 Generations to solve XOR: 25
Run: 35 Generations to solve XOR: 17
Run: 36 Generations to solve XOR: 32
Run: 37 Generations to solve XOR: 45
Run: 38 Generations to solve XOR: 18
Run: 39 Generations to solve XOR: 28
Run: 40 Generations to solve XOR: 11
Run: 41 Generations to solve XOR: 73
Run: 42 Generations to solve XOR: 13
Run: 43 Generations to solve XOR: 72
Run: 44 Generations to solve XOR: 39
Run: 45 Generations to solve XOR: 16
Run: 46 Generations to solve XOR: 20
Run: 47 Generations to solve XOR: 73
Run: 48 Generations to solve XOR: 36
Run: 49 Generations to solve XOR: 27
Run: 50 Generations to solve XOR: 31
Run: 51 Generations to solve XOR: 16
Run: 52 Generations to solve XOR: 18
Run: 53 Generations to solve XOR: 39
Run: 54 Generations to solve XOR: 40
Run: 55 Generations to solve XOR: 23
Run: 56 Generations to solve XOR: 41
Run: 57 Generations to solve XOR: 33
Run: 58 Generations to solve XOR: 23
Run: 59 Generations to solve XOR: 21
Run: 60 Generations to solve XOR: 10
Run: 61 Generations to solve XOR: 21
Run: 62 Generations to solve XOR: 49
Run: 63 Generations to solve XOR: 18
Run: 64 Generations to solve XOR: 8
Run: 65 Generations to solve XOR: 33
Run: 66 Generations to solve XOR: 28
Run: 67 Generations to solve XOR: 17
Run: 68 Generations to solve XOR: 45
Run: 69 Generations to solve XOR: 61
Run: 70 Generations to solve XOR: 19
Run: 71 Generations to solve XOR: 61
Run: 72 Generations to solve XOR: 39
Run: 73 Generations to solve XOR: 13
Run: 74 Generations to solve XOR: 44
Run: 75 Generations to solve XOR: 18
Run: 76 Generations to solve XOR: 51
Run: 77 Generations to solve XOR: 32
Run: 78 Generations to solve XOR: 41
Run: 79 Generations to solve XOR: 45
Run: 80 Generations to solve XOR: 21
Run: 81 Generations to solve XOR: 40
Run: 82 Generations to solve XOR: 53
Run: 83 Generations to solve XOR: 28
Run: 84 Generations to solve XOR: 30
Run: 85 Generations to solve XOR: 28
Run: 86 Generations to solve XOR: 22
Run: 87 Generations to solve XOR: 15
Run: 88 Generations to solve XOR: 32
Run: 89 Generations to solve XOR: 13
Run: 90 Generations to solve XOR: 8
Run: 91 Generations to solve XOR: 29
Run: 92 Generations to solve XOR: 26
Run: 93 Generations to solve XOR: 43
Run: 94 Generations to solve XOR: 37
Run: 95 Generations to solve XOR: 35
Run: 96 Generations to solve XOR: 47
Run: 97 Generations to solve XOR: 23
Run: 98 Generations to solve XOR: 33
Run: 99 Generations to solve XOR: 11
All: [31, 29, 27, 50, 42, 11, 11, 33, 25, 51, 28, 15, 12, 38, 28, 80, 15, 38, 40, 74, 27, 12, 14, 37, 27, 21, 46, 48, 27, 19, 28, 8, 48, 37, 25, 17, 32, 45, 18, 28, 11, 73, 13, 72, 39, 16, 20, 73, 36, 27, 31, 16, 18, 39, 40, 23, 41, 33, 23, 21, 10, 21, 49, 18, 8, 33, 28, 17, 45, 61, 19, 61, 39, 13, 44, 18, 51, 32, 41, 45, 21, 40, 53, 28, 30, 28, 22, 15, 32, 13, 8, 29, 26, 43, 37, 35, 47, 23, 33, 11]
Average: 31

Preserving Data

Attaching a data volume to the container so that generated networks are preserved is left as an exercise to the reader.

peter-ch commented 5 years ago

Thanks!