What are Genetic Algorithms With Python? A Genetic Algorithm (GA) is a metaheuristic inspired by natural selection and is a part of the class of Evolutionary Algorithms (EA). We use these to generate high-quality solutions to optimization and search problems, for which, these use bio-inspired operators like mutation, crossover, and selection. In other words, using these, we hope to achieve optimal or near-optimal solutions to difficult problems. Such algorithms simulate natural selection. For any problem, we have a pool of possible solutions. These undergo processes like recombination and mutation to bear new children over generations. The search space is the set of all possible solutions and values the inputs may take. In optimization, we try to find within this search space the point or set of points that gives us the optimal solution. Each individual is like a string of characters/integers/floats and the strings are like chromosomes. Python Genetic Algorithms What are Genetic Algorithms With Python The fitness value (from a fitness function) for a candidate tells us how close it is to the optimal solution. This is on the lines of Darwin's theory of 'Survival of the Fittest' and is how we keep producing better (evolving) individuals/ solutions over generations before reaching a criterion where to stop. These algorithms work in four steps: Individuals in population compete for resources, mate Fittest individuals mate to create more offsprings than others Fittest parent propagates genes through generation; parents may produce offsprings better than either parent Each successive generation evolves to suit its ambience Since the population size is constant, some individuals must die to make room for newer ones. We arrive at a situation of convergence when the difference between offsprings produced by the current and ancestral populations is no longer significant. Then, the algorithm converges to a set of solutions for the problem.