Neural Network Drivers using a NEAT like algorithm
Usage
The pogramm will keep running while 'run' is checked
'Speed' will increase the simulation speed to the maximum possible
'persistent screen' will prevent the screen from being cleared each frame allowing to see the path the agents take more clearly
If the agents are unable to take corners after at least 20 generations they most likely ran into a lokal maxima. Reload the page and try again.
How it works
This project originated from another one using a simple feed forward network. This version however uses a Network training roughly based on NEAT.
To archive the growing of the network a fixed amount of input and output neurons is defied. Then on each mutation step nbew Neurons and connections are creeated at random
To get this to work a new Library for fully connected network was written. Each Neuron and each connection gets a unique number assigned to it when created
The fitness function is the distance traveled in a set amount of time. Each fully finished round grants an additional bonus. Crashing results in a penalty by dividing the score reached up to this point
Selection follows a simple 1/3 rule. After each epoch the agents are ordered by their fitness. The highest scoring third each create a single mutated clone which replaced one agent in the lower third. The 2/3 highest scoring agents cary over to the next epoch
Network inputs and Outputs
Each agents Network gets the distance to each wall from its center in a fixed amount of equal sized angles around it
This behaves similar to a lidar telling the network the distance to walls all around it
The network also receives the vector to the next waypoint as an input to give it the possibily to drive centered even if the walls are far away
The output of the Network is a simple regression for acceleration, steering and breaking