A genetic algorithm is an algorithm that imitates the process of natural selection. They help solve optimization and search problems. Genetic algorithms are part of the bigger class of evolutionary algorithms. Genetic algorithms imitate natural biological processes, such as inheritance, mutation, selection and crossover.
The concept of genetic algorithms is a search technique often used in computer science to find complex, non-obvious solutions to algorithmic optimisation and search problems. Genetic algorithms are global search heuristics.
Natural evolution can be modeled as a game, in which the rewards for an organism that plays a good game of life are the passing on of its genetic material to its successors and its continued survival. In natural evolution, how well an individual performs depends on its who it works with and who it competes with, as well as the environment. Genetic algorithms are a simulation of natural selection on a population of candidate solutions to an optimization problem (chromosomes, individuals, creatures, or phenotypes).
Candidates are evaluated and crossbred in an attempt to make good solutions. Such solutions may take a lot of time and are not obvious to a human. An evolutionary phase is started with a population of randomly generated beings. In each generation, the fitness of every individual in the population is evaluated. Some are randomly selected from the current population (based on their fitness) and modified (recombined and possibly randomly mutated) to form a new population. The cycle repeats with this new population. The algorithm ends either after a set number of generations have passed, or a good fitness level has been reached for the population. If the algorithm has ended due to reaching a maximum number of generations, it does not necessarily mean a good fitness level has been obtained.
The pseudocode is:
The above description is abstract. A concrete example helps.
Genetic algorithms are good at solving problems that include timetabling and scheduling. They have also been applied to engineering. They are often used to solve global optimization problems.
As a general rule of thumb, genetic algorithms might be useful in problem domains that have a complex fitness landscape as mixing is designed to move the population away from local optima that a traditional hill climbing algorithm might get stuck in. Commonly used crossover operators cannot change any uniform population. Mutation alone can provide ergodicity of the overall genetic algorithm process (seen as a Markov chain).
Examples of problems solved by genetic algorithms include: mirrors designed to funnel sunlight to a solar collector, antennae designed to pick up radio signals in space, walking methods for computer figures, optimal design of aerodynamic bodies in complex flowfields
In his "Algorithm Design Manual", Skiena advises against genetic algorithms for any task: ""It is quite unnatural to model applications in terms of genetic operators like mutation and crossover on bit strings. The pseudobiology adds another level of complexity between you and your problem. Second, genetic algorithms take a very long time on nontrivial problems. [...] The analogy with evolution—where significant progress require [sic] millions of years—can be quite appropriate.
[...] I have never encountered any problem where genetic algorithms seemed to me the right way to attack it. Further, I have never seen any computational results reported using genetic algorithms that have favorably impressed me. Stick to simulated annealing for your heuristic search voodoo needs.""
Board games are a very relevant part of the area of genetic algorithms as applied to game theory problems. Much of the early work on computational intelligence and games was directed toward classic board games, such as tic-tac-toe, chess, and checkers. Board games can now, in most cases, be played by a computer at a higher level than the best humans, even with blind exhaustive search techniques. Go is a noted exception to this tendency, and has so far resisted machine attack. The best Go computer players now play at the level of a good novice. Go strategy is said to rely heavily on pattern recognition, and not just logical analysis as with chess and other more piece-independent games. The huge effective branching factor required for finding high quality solutions heavily restricts the look-ahead that can be used within a move sequence search.
The genetic algorithm can be used in computer games to create artificial intelligence (the computer plays against you). This allows for a more realistic game experience; if a human player can find a sequence of steps which always lead to success even when repeated in different games, there can be no challenge left. Conversely if a learning technique such as a genetic algorithm for a strategist can avoid repeating past mistakes, the game will have more playability.
Genetic algorithms require the following parts:
The fitness function accepts a mutated instantiation of an entity and measures its quality. This function is customized to the problem domain. In many cases, particularly those involving code optimization, the fitness function may simply be a system timing function. Once a genetic representation and fitness function are defined, a genetic algorithm will instantiate initial candidates as described before, and then improve through repetitive application of mutation, crossover, inversion and selection operators (as defined according to the problem domain).
There are limitations of the use of a genetic algorithm compared to alternative optimization algorithms:
In 1950, Alan Turing proposed a "learning machine" which would parallel the principles of evolution. Computer simulation of evolution started as early as in 1954 with the work of Nils Aall Barricelli, who was using the computer at the Institute for Advanced Study in Princeton, New Jersey. His 1954 publication was not widely noticed. Starting in 1957, the Australian quantitative geneticist Alex Fraser published a series of papers on simulation of artificial selection of organisms with multiple loci controlling a measurable trait. From these beginnings, computer simulation of evolution by biologists became more common in the early 1960s, and the methods were described in books by Fraser and Burnell (1970) and Crosby (1973). Fraser's simulations included all of the essential elements of modern genetic algorithms. In addition, Hans-Joachim Bremermann published a series of papers in the 1960s that also adopted a population of solution to optimization problems, undergoing recombination, mutation, and selection. Bremermann's research also included the elements of modern genetic algorithms. Other noteworthy early pioneers include Richard Friedberg, George Friedman, and Michael Conrad. Many early papers are reprinted by Fogel (1998).