Skip to content

anael-seghezzi/MAP-Elites-RISC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MAP-Elites RISC

C codebase with no dependencies to evolve RISC-like instruction programs using the Multi-dimensional Archive of Phenotypic Elites (MAP-Elites, https://arxiv.org/abs/1504.04909).

Because MAP-Elites can easily explore a 2 dimensional search space, it seems well suited for the evolution of instruction programs, as it can simultaneously evolve multiple candidates and optimize the number of instructions and calls.

In the case of MAP-Elites RISC, the search space is defined as:
X = number of instruction used (size of the program)
Y = number of instruction called during execution (~speed of the program)

The codebase includes a minimal MIPS-like instruction set and interpreter and a generic MAP-Elites implementation.

Ex1, learning to play Pong:

To compile ex1 type:

gcc example/ex1_pong.c

Or import example/ex1_pong.c in your IDE. You can also run "build_unix.sh", "build_mingw.bat" or "build_vs.bat".

Every 1000 generation the best program is saved as "pong_best.cgen" and "pong_best.cgen.txt" (readable copy).
After the default 500000 generations (~5 min) the process stops and save a preview of the best game in the form of tga frames "pong_frame0000.tga", "pong_frame0001.tga"...

Ex1

A larger number of generation can progressively optimize the number of instruction and call.
Here is one solution found by MAP-Elites RISC :

5: load ($4, m[$5 + 0])
29: less ($5, $7, $3)
49: sub ($7, $4, $6)
52: store (m[$2 + 3], $7)
62: load ($6, m[$2 + 2])

More about Map-Elites and Quality Diversity

http://journal.frontiersin.org/article/10.3389/frobt.2016.00040/full

See also:

Gene Regulation Network: https://github.com/anael-seghezzi/GRN-Gene-Regulation-Network

About

Evolving RISC instruction programs with MAP-Elites

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages