How Do Genetic Algorithms Work? | Two Minute Papers #32

Genetic algorithms start with random solutions, test which ones work best, breed the winners together, and repeat. Watch simple car designs and triangle art evolve toward better versions through crossover and mutation, the same way evolution works in nature.
Chapters
Dear fellow scholars, this is two minute.
Papers with genetic algorithms help us solve.
Problems that are very difficult, if not.
Impossible, to otherwise write programs for.
For instance, in this application, we have.
To build a simple car model to.
Traverse this terrain, put some number of.
Wheels on it somewhere, add a set of triangles as a chassis, and off you go. This is essentially the DNA of a solution. The farther it goes, the better the car is, and the goal is to.
Design the best car you possibly can.
First, the algorithm will try random solutions, and as it has no idea about.
The concept of a car or gravity.
It will create a lot of bad.
Solutions that don't work at all.
However, after a point, it will create something that is at least remotely similar to a car, which will immediately perform so much better than the other solutions in the population. A genetic algorithm then creates a new.
Set of solutions, however, now not randomly.
It respects a rule that we call survival of the fittest, which means that the best existing solutions are taken and mixed together to breed new solutions that.
Are also expected to do well.
Like in evolution, in nature, mutations can also happen, which means random changes are.
Also applied to the DNA code of a solution.
We know from nature that evolution works.
Extraordinarily well, and the more we run this genetic optimization program, the better the solutions get.
It's quite delightful for a programmer to.
See their own children trying vigorously and succeeding at solving a difficult task.
Even more so if the programmer wouldn't.
Be able to solve this problem by himself.
Let's run a quick example. We start with a set of solutions. The DNA of a solution is a set of zeros and ones, which can.
Encode some decision about the solution, whether.
We turn left or right in a.
Maze, or it can also be an.
Integer or any real number.
We then compute how good these solutions are according to our taste in the.
Example with cars, how far these designs can get.
Then we take, for instance, the best three solutions and combine them together to.
Create a new DNA.
Some of the better solutions may remain.
In the population unchanged.
Then, probabilistically, random mutations happen to some of the solutions, which help us explore.
The vast search space better.
Rinse and repeat.
And there you have it.
Genetic algorithms. I have also coded up a version of Roger Allsing's Evo Lisa problem, where the famous Mona Lisa painting is to be reproduced by a computer program with.
A few tens of triangles.
The goal is to paint a version that is as faithful to the original as possible. This would be quite a difficult problem for humans, but apparently a genetic algorithm.
Can deal with this really well, the.
Code is available for everyone to learn.
Experiment and play with. And it's super fun.
And if you're interested in the concept of evolution, maybe read the excellent book.
The Blind Watchmaker by Richard Dawkins.
Thanks for watching and for your generous.
Support, and I'll see you next time.










