sourceflow.dev

swirlnet

15 February 2017 · Andrew Engelbrecht

This page demonstrates an evolved neural network balancing an inverted double (or jointed) pendulum. Click the arrows below the simulation to gently or forcefully push the upper and lower pendula.

This network was trained using swirlnet, a neuroevolution library, and phyzzie, a physics simulation and Web display framework. Phyzzie uses Chipmunk-js for 2D physics, and swirlnet is based on NEAT (NeuroEvolution of Augmenting Topologies) (white paper). I wrote both of these libraries in JavaScript so they could be run server-side and displayed on the Web.

I’ve made some tweaks to the NEAT algorithm. If you would like to take a look at the evolutionary algorithm in my source code, you could start by looking at the code for reproduction.

The code is split up into multiple git repos and can be installed via npm.

I wrote a library for multi-core network evolution that sends genomes to subprocesses. You can try out the single threaded and multi-core variants of XOR in the swirlnet repository, or run the code for this demo.