# Genetic Algorithm

Follow step-by-step instructions to solve the traveling salesperson problem with a genetic algorithm.

**Genetic algorithms** are a class of algorithms that take inspiration from genetics. They simulate the process of natural selection to find solutions to optimization problems through a sequence of steps that starts with randomly creating a population of potential routes, calculating the distance of each solution (route), and selecting the best solutions via a fitness function. The fitness of each solution is the trip’s total distance. The best solutions are combined to create new solutions, and the process will be repeated until a satisfactory solution is found.

Get hands-on with 1200+ tech skills courses.