A walk through an evolutionary algorithm

Planes       Triangles

What is this?

This is Genetech, a project we've developed about evolutionary algorithms. What that means is we use techniques that are found in nature (in evolution) to find solution to some problems, for example, how to drive a car.

The main idea is to see how can a set of individuals evolve after a certain number of generations, where only the "best" ones can survive and reproduce to keep swag going.

How does it work?

The study begins with an initial set of individuals that have random properties: the first generation. Every individual has a genetic code, which contains all the information about the individual: in this case, the way that the car will react to the inputs it receives, which come from two sensors that check the limit of the track in two diferent directions.

The evolutionary method is based on mixing two individuals' genetic code. For every piece of genetic information there's a chance both will get crossed. See how much the crossing chance affects the outcome of the mixing.
Crossing chance:  


in the case of a neural network formed by nodes and edges connecting the nodes, we can express it like:

But, how do we know what genes should we compare? In order to get the best results, we want to mimic nature. Thus, we choose the best, most prepared individuals and mix their genes. But, how do we decide which ones are the best?
Well, we use what's called a fitness function. The fitness of an individual tells us, for example, how much a set of triangles ressembles a certain picture. In fact, we check each pixel and determine how close both pictures are.

Now we are ready to roll! We can start processing generations of individuals and see how their fitness goes up as their goal is achieved.

Still, there is no clear result. We have forgotten a crucial step to evolution: random mutation. It's little changes in the genetic code that make species go forward.
Let's add a little chance that the genetic code will be mutated every time we copy, and see how that works.
Mutation chance:  
    Mutation effect:  

That's pretty much it, but there are a few details me missed. You can play with different configurations below, see if you can get the most efficient one. The titles are pretty self explanatory.
Mutation chance:  
    Mutation effect:  

Extreme mutation chance:  

Individuals per generation:  
,     New individuals each generation:  

Crossing chance:  


Who are Isomorphic To Ourselves?

We are a group of four mathematics students formed by Guillem Garcia, Nil Garcés, Josep Esquirol and the amazing Taras Yarema. We ARE Isomorphic to Ourselves! We love maths and we love to mix the life and hack the fun, so we decided to attend HackUPC Fall 2016. As it was our second time in this event we decided to do something that would challenge ourselves. We end up with the idea of studying the genetic algorithms and its applications.