This page runs evolution in your browser. Each candidate is a tiny neural "brain" โ a list of numbers, the weights. Random brains drive the robot; the best-scoring ones breed (their weights mix like genes), their children get small random mutations, and the elite survive unchanged. Generation after generation the brains get better at the task. The fitness function is the score evolution optimises: go fast, go straight, don't hit walls.
IRIN O2 (UPM, 2019) โ a Webots e-puck whose neural controller is evolved by a genetic algorithm instead of learned by gradient descent. The lab evolves layered distributed NN controllers; this page reproduces the pipeline in miniature: an 8-4-2 MLP (proximity rays โ hidden โ wheel speeds) in a 2D arena, evolved live with the same fitness function.
Each genome is the weight vector of the controller. The population of \(P\) individuals is evaluated, then a new generation is built by
Each genome drives the robot for 120 steps; the per-step fitness rewards fast, straight, obstacle-avoiding motion:
\[ f = V\,(1 - \sqrt{\Delta v})\,(1 - i) \]
where \(V\) is the translational speed, \(\Delta v\) the rotational difference between wheels (penalizing turns) and \(i \in [0,1]\) the strongest proximity reading (penalizing walls). The chart plots the best fitness per generation; with the default settings the population reaches the task ceiling (\(f \approx 0.53\)) within ~100 generations.
Press โถ Evolve โ the button becomes โธ Pause while the GA runs. The arena shows the best individual so far driving with its proximity rays; the fitness curve climbs as the population improves. Adjust population size, mutation \(\sigma\) and speed; โป Reset starts a fresh run with a new random seed.
github.com/alejp1998/irin_o2 โ C++ controllers, Python model, tests.