Neural Network-Driven Cars

This genetic algorithm crossbreeds and mutates world-class F1 drivers in your browser.

Source Code on GitHub

You can load the trained network by clicking . It completes the track but is quickly optimized. To learn more about how this project functions, please scoll down below the demo.


About the Architecture
Neural Networks

The neural networks driving each car have the following attributes:

  • 13 inputs - 7 forward and side-facing distance sensors and the car's speed, angular velocity, steerings angle, gas throttle, and standard and emergency brakes
  • 1 hidden layer of 10 neurons - found to be a good balance of training time and function complexity for this simple problem
  • 4 outputs - steerings angle, gas throttle, and standard and emergency brakes

Each input is normalized to enhance the genetic algorithm's performance. The network applies leakyRELU activation on the hidden layer and sigmoid activation on the output. The network outputs are then denormalized and applied to the physical body of the car.

Genetic Algorithms

There are 3 different genetic algorithms that take turns acting on the neural networks in a round robin fashion. They differ in how they introduce new genetics to the genome pool through the use of mutation and cross-breeding. Two algorithms splice new, random neurons into the best performing networks, while the third cross-breeds and mutates only the champion networks.