Translate

Wednesday, 24 April 2013

Logic Learning AI


This is a video to show a basic AI program at work. It is a logic learning program that aims to learn how to play a game by working out what output it should give for each input. The AI is given no previous information about the rules or objective of the game; it is simply told if it has succeeded or not.


It has a 2 bit input and hence has only four possible inputs:
00, 01, 10, 11
For each of these inputs it must find a 2 bit output. To find out the correct outputs it will look at what could have caused it to fail in its previous attempt and hence will change one of the outputs until it finds the correct combination and wins the game.


Statistically, the chance of it finding the correct output for all 4 inputs, by chance on its first guess, is 1/256. And so if it searched systematically for the correct answer it would take on average 128 attempts.

My AI system tends to find the correct answer after only 11 attempts. And so is more than 10 times faster at solving this problem.

This short film shows the simulation running and storing the number of fails for each time.

The aim of this game is for the circle to find its way to the square. If the Circle leaves the game area, or gets stuck in on place then it losses. The simulation will end when it detects that the circle has survived the game for an adequate length of time to prove that it has found the correct outputs for all 4 inputs.



I ran this simulation 1000 times, and recorded the number of times the AI failed before it succeeded. I then used graphs to work out the probability distribution of errors before success for this AI program. 

Average number of fails before success: 11.242
Number of simulations 1000



The few times that it took the AI longer than 35 proves that there is no max number of times. It is unlikely, but theoretically the AI could never find the correct solution, but the probability gets very small for large number of attempts.





No comments:

Post a Comment