Posts Tagged ‘Genetic Algorithm’
Mario AI EANN (evolutionary artifical neural network)
I implemented a hybrid of GA and NN for an agent which plays Mario.
Training method with Genetic algorithm using a NN as a candidate in the population.
A mario framework game is provided by http://marioai.com where you get environment information, and you apply actions to the agent.
Here are two videos of my agent. I didn’t really manage to make it a generalized agent (performs good on unseen levels) but it manage well on levels which is has been trained for (over-fitting).
Below the screen is the input to the NN
Two matrix’s, one with levelscene (5×5), the other with enemies (5×5)
And then some states:
isOnGround, canJump, canShoot, marioMode, blockInFront?, enemyInFront?, pitInFront?
Outputs are: jump, left, right, fire/speed
Input 7, no matrix
Input 57, 5×5 matrix
NN topology
one hidden layer with size 20
Total outputs: 4
———-
Training method:
Fitness is distance passed + 1024 win bonus
Population 100
Generations: until level completed or maxloop is exceeded
Tournament selection
Elitism 20% no steady state
Gaussian mutation 2%
Montana uniform crossover