# Introduction to evolutionary algorithms

Jorge Martinez

September 11, 2024

**Evolutionary Algorithms** (EA) are computer programs whose goal is to find the
(near-)optimal solution to a problem among a set of posible solutions by
mimicking natural selection.

Let’s dive a bit into previous definition!

## Computer programs

Evolutionary algorithms are software routines. Therefore, they need to be coded as any computer program.

The reason why we make such distinction is because evolutionary algorithms are
a set of a broader subject named **Evolutionary Computation** (EC), which is a
field of **Artificial intelligence** (AI).

Evolutionary computation includes many other techniques. Some of the most popular are:

- Genetic Algorithms (GA)
- Differential Evolution (DA)
- Ant Colony Optimization (ACO)

## Find the (near-)optimal solution

Evolutionary algorithms are metaheuristic or stochastic solvers. Let’s dive a bit more into these concepts:

**Metaheuristic.**This term refers to algorithms whose goal is to find a solution that may not be the best but that it is close to the optimum one.**Stochastic.**It refers to a process or model that appears to vary in a random manner.

Thus, we can say that a genetic algorithm can find for a solution close to the optimum one by using some logic that involves some randomness. How is this possible? More about it in future posts…

## Set of possible solutions

The solution found by an evolutionary algorithm does not appear out of nowhere; we need to know it in advance. In fact, we need to feed the algorithm with a set of solutions to our problem. Let me give an example:

Guess a number between 0 and 99.

You do not know the optimum answer, that is the right number. However, you know that a possible solution can be any number within that range.

Despite this example being very simple, we can apply the same idea to any problem. The core concept here is to generate possible solutions in a smart way.

Generating initial solutions in a heuristic way for evolutionary algorithms can significantly improve their efficiency and speed up convergence to an optimal solution.

Of course, use case problems for evolutionary algorithms are not this simple. Some of them involve computing the optimum solution for a multi-constrained multi-variable. In addition, the solution for them may not be analytic. Here is where evolutionary algorithms really shine.

## Mimicking natural selection

The key point of evolutionary algorithms: emulate the rules of nature for the survival of the best individuals.

What if we could combine solutions to create better solutions? Do all solutions have a change to “mate”? How can we do this? How can we evaluate the fitness of a solution? What happens if a solution is just no longer valid? What about mutation of solutions? Can we generate a new generation for our population of solutions?

All these questions will be solved in future posts. For the moment, just focus on the idea of combining solutions in a smart wat to create better solutions in an iterative way until an optimum solution is found.