Monday, May 28, 2012

Artificial Intelligence v/s Developer Part 2 - Why somebody invented the concept of random number?

Artificial Intelligence v/s Developer Part 1 - What the hell is this?
Artificial Intelligence v/s Developer Part 2 - Why somebody invented the concept of random number?
Artificial Intelligence v/s Developer Part 3 - Sensing & acting / IO devices and communication.
Artificial Intelligence v/s Developer Part 4 - Multi-core processors,MapReduce & Hadoop
Artificial Intelligence v/s Developer Part 5 - Are you ready to do some AI apps like this?

As a developer with at-least 2 years of experience in the software industry, you should have used the random number generation 2-3 times. What is a random number is not at all a question.Its simple as a random number as per the name. But what is the importance of a good random number generation algorithm in computer programming?

Answer is simple .It helps the program to take a decision .I am not sure yet about whether we should call that as AI because that is some sort of decision making. If you are still confused about random number generation and decision making let's take an example of a small shooting game.

The rules are simple as shooting the red bubbles coming from the top of the screen.If we shoot the green bubbles we lose some points. Coming to the programming ,how program decides what should be the color of the next bubble coming from the top? We are inside an infinite while loop and need to put a bubble at the top.Can it be a Boolean variable which flashes and helps us to put bubbles in an alternative way ie red then green then red etc...There is nobody stopping us .But if we implement like that, the player seats will be empty. Nobody will play twice.If you are developing for the sake of developing you can go ahead with that. But if you ask me, I will never develop for the sake of developing .I always need users who use my program.

That means the Boolean concept is rejected.What about deciding color based on the current time.seconds along with a delay based on the same second.ie red if the second is odd else green. Little more better in terms of keeping players in seat. If you think more you will surely feel, this is not something I needed. I want to give it an actual feeling of human throwing bubbles which plays like opponent of the player. How can I achieve that ? I need to get a random number and combine with current system variables such as position of the gun etc...to decide on the color and decide on the horizontal position in the screen from where the bubble should come.

This means apart from helping the program to take decisions the random numbers give a feel of computer as human.

What is a good random number generator?

Again a definition "Random number generator should give a random number like how human guess a  number and tell the same to another one". There are so many methods out there which are widely used in random number generation but I like the physical random number generation most as it depends on the physical condition rather than any algorithm or the current time of the system.

Random numbers in AI

Since AI needs same behavior as human intelligence it needs a good random number generator to achieve the tasks such as decision making, decision re-evaluating etc...

If we look at the decision making process we cannot find the need for a random behavior at first. But if we reach to a situation where none of our experience in the knowledge base help us to respond to a given situation, we should create a random decision and experiment with that. Also if there are 2 choices with same weight /rank the system need to choose one based on random number. Isn't it same in case of human intelligence? If we are planning to buy an android mobile and there are 2 matching our requirements including the price,feedback ,company etc... we normally buy one by random selection.Some people even go to the extend of asking his best friend to touch one finger where he had assigned one mobile to each finger. Isn't it a use of random number usage in human intelligence? If you had read my first post about AI and comparison of possessing intelligence like a child, you can easily understand the importance of random behavior.

But over the time the need for random behavior will come down because if the system is in operation for long the knowledge base will get bigger so that the situations which are not in the knowledge will be rare.

Will I be using random numbers directly ?

Never. Because you will not be keeping a list of actions which you can index directly using a random number. Instead it should be some sort of genetic algorithm where the fitness function of selection is based on the random number. This brings random combinations of genes which gives different behaviors.

Hope this gives you the idea that random behavior is a key ingredient in real intelligence which we cannot avoid when building an artificial intelligence system.

1 comment:

Blogger said...

FreedomPop is the first 100% FREE mobile communications provider.

Voice, text & data plans always start at £0.00/month.