ⓘ Genetic algorithm
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.
1. What is it
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.
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.
1.1. What is it Example
The above description is abstract. A concrete example helps.
2.1. Applications In general
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. 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.
2.2. Applications Computer games
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:
- A method for representing the challenge in terms of the solution e.g. routing soldiers in an attack in a strategy game
- A fitness or evaluation function in order to determine the quality of an instance e.g. a measurement of damage done to an opponent in such an attack.
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 many problems, genetic algorithms have a tendency to converge towards local optima or even arbitrary points rather than the global optimum of the problem. This means that the algorithm does not "know how" to sacrifice short-term fitness to gain longer-term fitness. The likelihood of this occurring depends on the shape of the fitness function: certain problems make it easy to find the global optimum, others may make it easier for the function to find the local optima. This problem may be lessened by using a different fitness function, increasing the rate of mutation, or by using selection techniques that maintain a diverse population of solutions. A common technique to maintain diversity is to use a "niche penalty": any group of individuals of sufficient similarity niche radius have a penalty added, which will reduce the representation of that group in the following generations, permitting other less similar individuals to be kept in the population. This trick, however, may not be effective, depending on the landscape of the problem. Another possible technique would be to simply replace part of the population with randomly generated individuals, when most of the population is too similar to each other. Diversity is important in genetic algorithms and genetic programming because crossing over a homogeneous population does not yield new solutions. In evolution strategies and evolutionary programming, diversity is not essential because of a greater reliance on mutation.
- Operating on dynamic data sets is difficult, as genomes begin to converge early on towards solutions which may no longer be valid for later data. Several methods have been proposed to fix this by increasing genetic diversity somehow and preventing early convergence, either by increasing the probability of mutation when the solution quality drops called triggered hypermutation, or by occasionally introducing entirely new, randomly generated elements into the gene pool called random immigrants. Again, evolution strategies and evolutionary programming can be implemented with a so-called "comma strategy" in which parents are not maintained and new parents are selected only from offspring. This can be more effective on dynamic problems.
- For specific optimization problems and problem instances, other optimization algorithms may be more efficient than genetic algorithms in terms of speed of convergence. Alternative and complementary algorithms include evolution strategies, evolutionary programming, simulated annealing, Gaussian adaptation, hill climbing, and swarm intelligence e.g.: ant colony optimization, particle swarm optimization and methods based on integer linear programming. The suitability of genetic algorithms is dependent on the amount of knowledge of the problem; well known problems often have better, more specialized approaches.
- Genetic algorithms cannot effectively solve problems in which the only fitness measure is a single right/wrong measure like decision problems, as there is no way to converge on the solution no hill to climb. In these cases, a random search may find a solution as quickly as a GA. However, if the situation allows the success/failure trial to be repeated giving possibly different results, then the ratio of successes to failures provides a suitable fitness measure.
- Genetic algorithms do not scale well. That is, where the number of elements which are exposed to mutation is large there is often an exponential increase in search space size. This makes it extremely difficult to use the technique on problems such as designing an engine, a house or a plane. To use genetic algorithms with such problems, they must be broken down into the simplest representation possible. For this reason, we see evolutionary algorithms encoding designs for fan blades instead of engines, building shapes instead of detailed construction plans, and airfoils instead of whole aircraft designs. The second problem of complexity is the issue of how to protect parts that have evolved to represent good solutions from further destructive mutation, particularly when their fitness assessment requires them to combine well with other parts.
- Repeated fitness function evaluation for complex problems is often the most limiting segment of artificial evolutionary algorithms. Finding the optimal solution to complex problems often requires very expensive fitness function evaluations. In real world problems such as structural optimization problems, a single function evaluation may require several hours to several days of complete simulation. Typical optimization methods cannot deal with such types of problem. It is often necessary to use approximation, as calculating the exact solution takes too long. Genetic algorithms sometimes combine different approximation models to solve complex real life problems.
- The "better" solution is only in comparison to other solutions. As a result, the stop criterion is not clear in every problem.
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. Frasers 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. Bremermanns 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.
Although Barricelli, in work he reported in 1963, had simulated the evolution of ability to play a simple game, artificial evolution became a widely recognized optimization method as a result of the work of Ingo Rechenberg and Hans-Paul Schwefel in the 1960s and early 1970s – Rechenbergs group was able to solve complex engineering problems through evolution strategies. Another approach was the evolutionary programming technique of Lawrence J. Fogel, which was proposed for generating artificial intelligence. Evolutionary programming originally used finite state machines for predicting environments, and used variation and selection to optimize the predictive logics. Genetic algorithms in particular became popular through the work of John Holland in the early 1970s, and particularly his book Adaptation in Natural and Artificial Systems 1975. His work originated with studies of cellular automata, conducted by Holland and his students at the University of Michigan. Holland introduced a formalized framework for predicting the quality of the next generation, known as Hollands schema theorem. Research in GAs remained largely theoretical until the mid-1980s, when The First International Conference on Genetic Algorithms was held in Pittsburgh, Pennsylvania.