# Problem Solving In Genetics

When trying to breed parents, the first idea that comes up is to take 50% from each one.However, in the Travelling Salesman Problem (TSP) it might lead to an invalid solution – in which each city will appear more than once. By taking the first part from the first parent, and then taking the rest of the cities according to their order of appearance on the second parent solution.While it often relates to mother nature, animals or humans, it’s also a part of the computing world.

Selection – Selecting pairs of parent solutions according to their Fitness value 3.

Crossover – Breeding the selected parents to produce an offspring 4.

In order to achieve this, we first need to evaluate each chromosome and give the better ones higher probabilities to produce children.

This is done by a function called the Fitness Function that receives a chromosome, and returns a score that represents how good the chromosome is in terms of the problem.

In this example, our solution population consists of a collection of lists of cities.

To form our first generation, we will randomly generate a collection of solutions, and we need to make sure that each generated solution is valid (and is a possible solution to the problem). The next step will be taking these chromosomes into a process of evolution, and use the power of natural selection to obtain a better population.

What’s the connection between evolutionary algorithms and mother nature, and how can it help solve complicated computing problems?

Wikipedia defines evolution as “a change in the heritable characteristics of biological populations over successive generations”.

And as we mentioned earlier, better chromosomes will get higher probabilities.

Or in other words, this is where we use natural selection and now it’s time to move to the process of evolution.