Evolving predator's Neural Network with Genetic Algorithm to catch the prey in best possible manner
The main objective of this project is an JAVA application that uses genetic algorithms to evolve neural network based controllers for the agent of the AI capture problem. More specifically, it is intended that the weights of the neural network(s) are evolved, because their topology (number of layers, number and type of neurons in each layer) has been decided in DataSet1.txt
file.
The performance of the controllers should be evaluated taking in consideration the ability to perform the intended task: Predator agent should move, in a fastest manner, to capture the Prey agent. The enviroment is 10x10 grid, Predator agent is blue cell and Prey agent is red cell.
The structure of the neural network is defined as 4 inputs, 10 hidden neurons and 2 output neurons. Neural network inputs are defined as 2 for Predators relative distance to Prey and 2 for position (as above/below and right/left). Weights of the network are initialized randomly, and are evolved by genetic algorithm. Only forward propagation is done when agent wants to decide in which cell to move, backpropagation is not needed because agents with better performance are kept alive for evolving.
Genetic algorithm creates initial population of 200 agents randomly, evaluates them based on certain criteria and selects best ones for mutation and recombination. Each individual agent has neural network weights as genome on wich mutation and recombination is performed. After genetic operations the individuals are mixed with initial pupulation by replacing the worst and first generation is created. This application evolves 100 generations to perfectly solve the problem. In each generation the above steps are repeated. The evaluation of agents is done by simulating them in 20 different enviroments (keeping the same weights) and summing total relative distance to the prey in each iteration until prey is cought or the maximu number of iterations is reached (200).