What is Genetic Algorithm?
The genetic algorithm helps us solving problems by natural selection that mimics the biological evolution.
When we need to find a single answer from a huge possibility of answers that’s when genetics algorithm comes in.
Sometimes it’s almost impossible to check every single possibility until I find the answer, Genetics algorithm helps to solve this type of problem.
There are 3 types of Genetic algorithm out there.
1. Traditional or Classic genetic algorithm
2. Interactive selection
3. Ecosystem simulation
How can we use Genetic Algorithm?
A traditional genetic algorithm is the original genetic algorithm and then there is some creative twist in Interactive genetics algorithm which allows users or audience to participate in this evolutionary process. ecosystem simulation to think of using genetics as applied to agents that moving around the screen and experiencing the sort of artificial world video games are kind of having stuff like this built into.
Here we are gonna talk about the Infinity monkey theorem, or you can say Shakespearean monkey problem, which states that a monkey typing on a typewriter for an infinite amount of time will surely type the complete works of William Shakespeare. In fact, the monkey would surely type every possible finite text an infinite number of times. However, the probability that monkeys filling the observable universe would type a complete work such as Shakespeare’s Macbeth is extremely low (but technically not zero).
|Monkey typing Shakespeare|
Ok, So let’s talk about probability here, we have a coin and if you flip the coin there are 2 possible outcomes. Either it’s head or tail, which are both equally likely, but if you flip two coins, there can be
1. Two heads
2. Two Tails
3. One head one tail
So, as you can see there are 3 possible outcomes in case of two coins.
As of this let’s suppose we have a keyboard that has 40 key and we put a monkey in front of it to type random key. Suppose we want it to type ‘Techidea12’ keyword. So possibilities of typing the first character ‘T’ is 1/40, our keyword is 10 characters long so, it gonna have 1/40^10 possibilities (^ power).
We are gonna see a fun example of genetic algorithm http://boxcar2d.com/ here. In here if we design a car with any polygon any number of wheels, if everyone designs a car like that, there will millions of design. So, one way to finding the optimized car design is to evolve that optimized car design. You can see that’s what boxcar2d is doing. It’s Testing out the different car design using a physics engine and giving points on the basis of how far they could travel without destroying.
So, the Genetic algorithm is ultimate, how can you design a system that uses the evolutionary algorithm to evolve the behavior or design or solve some particular kind of search problem and there are lots of ways you can apply them.