Genetic Algorithm — Evolutionary Optimization

Decision Sciences
Introduced by
John Henry Holland
Year
1975
Type
Population-based metaheuristic

What does it do?

A genetic algorithm (GA) is a population-based metaheuristic formalised by John Henry Holland in 1975, a little after other researchers had proposed related evolutionary ideas, and inspired by Darwinian natural selection and genetics.

It maintains a population of candidate solutions and improves them over generations through selection, crossover (recombination) and mutation. Because it needs only a computable fitness function, it can be applied to discontinuous, non-differentiable and multimodal search spaces where gradient-based methods are hard to use, but it offers no guarantee of reaching the global optimum.

The intuition behind the method

Suppose a problem has many candidate solutions and no formula that identifies the best one. A genetic algorithm holds a population of candidates, each encoded in a form such as a binary string or a vector of real values, and scores each one with a fitness function. Fitter candidates are more likely to be chosen as parents. Their offspring are formed by exchanging segments of their encodings (crossover) and occasionally altering them at random (mutation). Repeated over many generations, this tends to move the population toward better solutions, without following a gradient.

History

John Henry Holland introduced the genetic algorithm in his 1975 book Adaptation in Natural and Artificial Systems, where he formalised the notion of a schema (building block) and analysed how selection and crossover guide the search toward fitter regions. Other researchers had proposed similar evolutionary ideas slightly earlier; Rechenberg is one notable example, and Fogel et al. are credited with pioneering the idea of genetic programming. The concrete application of genetic algorithms to selection problems for k-classifiers was developed by Rozsypal and Kubat. Kalyanmoy Deb's 2001 book Multi-Objective Optimization using Evolutionary Algorithms extends the evolutionary framework to problems with several objectives.

When to use it

Choose a genetic algorithm when the search space is large, discontinuous, non-differentiable or highly multimodal, so that gradient-based solvers cannot operate or tend to stop at local optima. It can work with continuous, binary, categorical and ordinal variables, and it makes no normality or distributional assumptions; the essential requirement is a fitness function that can be computed for any candidate. Avoid it when the problem has a smooth, convex or linear structure, since linear programming or gradient descent will be faster and more reliable. It is also a poor fit when each fitness evaluation is very expensive or when a guaranteed global optimum is required, because exact methods such as integer programming solvers provide that guarantee. A common failure is stopping the run before the population has stabilised, so convergence behaviour should be inspected rather than assuming a fixed generation budget is enough.

Limitations and considerations

  • No guarantee of convergence to the global optimum; results can vary across runs.
  • Computationally expensive: every generation evaluates the whole population, so cost grows quickly when the fitness function is slow to compute.
  • Performance is sensitive to population size, crossover probability and mutation rate, which often need tuning for each problem.
  • For smooth, convex or well-structured problems, classical gradient-based or linear methods are usually faster and more reliable.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Works on discontinuous, non-differentiable and multimodal objective landscapes where gradient-based methods break down.
  • Imposes no distributional assumptions; the essential input is a computable fitness function.
  • Handles continuous, binary, categorical and ordinal variables within the same framework.
  • Population diversity allows several regions of the search space to be explored at once, which reduces the risk of becoming trapped in a single local optimum.
  • Operators can be designed for the encoding at hand, and the same evolutionary framework has been extended to multi-objective problems (see history).

Applications

  • Engineering design optimisation: finding optimal parameter configurations for structures, circuits, or mechanical systems.
  • Scheduling and routing problems: job-shop scheduling, vehicle routing, and timetabling where the combinatorial search space is too large for exhaustive search.
  • Machine learning: hyperparameter tuning, neural architecture search, and feature selection, including selection problems for nearest-neighbour classifiers.
  • Operations research: supply chain optimisation, portfolio allocation, and resource assignment under complex constraints.

How it works

How it works

1

A population of candidate solutions is created, usually at random within the search space. Each individual encodes one candidate, for example as a binary string, a real-valued vector or a permutation. The population size sets how widely the search space is sampled at the start.

2

Each individual is scored by the fitness function, which measures how good that candidate is for the problem objective. The fitness function is the element that must be supplied to define the problem; it can be any computable measure, such as a simulation output, a cost formula or a model error. Encodings and genetic operators may also need to be tailored to the problem, as described in the next steps.

3

Individuals with higher fitness are chosen preferentially as parents for the next generation. Common selection mechanisms include tournament selection, roulette-wheel (fitness-proportionate) selection and rank-based selection. Selection pressure controls the trade-off between exploiting high-quality solutions and maintaining population diversity.

4

Selected parents produce offspring through crossover, in which segments of two parent encodings are combined, and through mutation, in which small random changes are applied to genes. The crossover probability and mutation rate are key tuning parameters: too little mutation can cause premature convergence, while too much turns the search into a random walk.

5

The evaluate, select and reproduce loop continues for a set number of generations or until a stopping criterion is met, such as no improvement over a window of generations. The best individual found across all generations is returned as the solution. Because convergence to the global optimum is not guaranteed, repeated independent runs are advisable for high-stakes problems.

Common pitfalls

  • Stopping too early is a common error: if the generation budget ends before the population stabilises, the output reflects an unfinished search. Inspect how the best and average fitness change across generations before accepting a result.
  • Premature convergence, where the population loses diversity too early, produces a locally good but globally suboptimal result. An adequate population size and mutation rate help counteract it.
  • A misspecified fitness function gives misleading results regardless of how correctly the algorithm is implemented; check the fitness function independently before running the GA.
  • Applying a GA to a smooth, convex problem where gradient descent or linear programming would suffice wastes computation and adds unnecessary stochasticity.
  • Reporting a single run as the answer without checking reproducibility. For high-stakes applications, run the algorithm several times and report the spread of outcomes.

Frequently asked questions

How is a genetic algorithm different from gradient descent?

Gradient descent requires a differentiable objective and follows the local gradient downhill. A genetic algorithm requires only that the fitness can be computed for any candidate solution. It searches by evolving a population rather than following a gradient, so it can handle discontinuous, non-differentiable and multimodal landscapes where gradient descent fails or gets stuck.

How large a population and how many generations do I need?

There is no universal rule; both depend on the complexity of the search space and on the cost of each fitness evaluation. A population that is too small, or a run that is too short, risks premature convergence. Judge the settings from the run itself: check whether the best and average fitness have levelled off across generations, and whether repeated runs reach similar results.

Is a genetic algorithm guaranteed to find the global optimum?

No. GAs are heuristics and provide no convergence guarantee to the global optimum in finite time. For deterministic guarantees you need exact methods such as integer programming solvers. For high-stakes decisions, run the GA multiple times, report the distribution of results, and compare the best solution to any known bounds.

When should I choose a GA over simulated annealing or particle swarm optimisation?

A GA is a natural choice when the solution is encoded as a combinatorial structure such as a permutation or binary string, or when multi-objective extensions are needed. Simulated annealing is often simpler for combinatorial problems with a clear neighbourhood structure, and particle swarm optimisation is commonly applied to continuous variables. Comparing a few candidate methods on a small instance of your own problem is a sensible check before committing to one.

Related methods

Sources

  1. Holland, J.H. (1975). Adaptation in Natural and Artificial Systems. University of Michigan Press.

    Open publication reference
  2. Deb, K. (2001). Multi-Objective Optimization using Evolutionary Algorithms. Wiley.

    ISBN: 9780471873396
  3. 2017_Book_AnIntroductionToMachineLearnin, ch. 16, Historical Remarks (page not recorded in library metadata)