Stochastic Genetic Algorithm — Randomized Evolutionary Search for Optimization

Decision Sciences
Introduced by
Holland, J. H.
Year
1975
Type
Stochastic evolutionary metaheuristic
Family
Simulation / optimization

What does it do?

The Stochastic Genetic Algorithm (SGA) is the name this page uses for the canonical genetic algorithm, a population-based metaheuristic that applies selection, crossover, and mutation to a set of candidate solutions in order to search for good solutions in complex, nonlinear, or combinatorial spaces.

All three operators involve random draws, so repeated runs can follow different trajectories and return different results. The method is used when gradient information is unavailable and an approximate solution obtained through repeated evaluation of the objective is acceptable.

The intuition behind the method

Think of a population of candidate solutions, each scored by a fitness value. Individuals with higher fitness are more likely to be chosen as parents, and their offspring recombine parts of their encodings through crossover. Occasional random mutations alter individual genes, which introduces variation that the current population may lack. Over successive generations the population tends to move toward regions of the search space with higher fitness, but nothing in the procedure guarantees that the best region has been found. The stochastic operators let the search explore several regions at once, and that exploration is what separates the method from a simple descent that follows a single trajectory.

History

John Holland set out the foundations of genetic algorithms at the University of Michigan, with Adaptation in Natural and Artificial Systems published in 1975. David Goldberg's 1989 book Genetic Algorithms in Search, Optimization, and Machine Learning made the approach widely known in engineering and computing. The canonical GA described here is the form that these two works established.

When to use it

Choose an SGA when the decision variables are combinatorial, mixed-integer, or permutation-based, or when the objective is black-box, discontinuous, or non-differentiable, so that gradient-based methods cannot be applied. It also suits problems where a good solution found within a fixed evaluation budget is more useful than a proof of optimality. If each fitness value comes from running a stochastic simulation, the simulator acts as a black-box evaluator, and its noise can mislead selection, so repeated replications or averaged outputs are often needed. Do not use an SGA when the problem is convex or smooth and gradients are cheap, because classical optimization will usually converge faster and more reliably. Avoid it when each function evaluation is very expensive and the budget allows only a few evaluations, since a population-based search needs many of them. Also avoid it when a provably optimal solution is required, because the method offers no optimality guarantee.

Limitations and considerations

  • No guarantee of reaching the global optimum; the quality of the result depends on population size, operator choice, and the number of generations.
  • Usually requires many fitness evaluations, so it is less efficient than gradient-based methods on smooth, low-dimensional problems.
  • Population size, crossover rate, and mutation rate interact with each other and with the encoding, so suitable settings generally have to be found by experiment.
  • Premature convergence occurs when selection pressure is high or mutation is too rare, leaving the population clustered in a suboptimal region.

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

Strengths

  • Does not require gradient information, so it can be applied to black-box, discontinuous, or non-differentiable objectives.
  • Works directly on combinatorial and permutation search spaces when the chromosome encoding is chosen to match the problem structure.
  • Individuals in a generation are independent of one another during fitness evaluation, so the population can be evaluated in parallel.
  • Maintains several candidate solutions at once, which helps the search explore multiple regions of a multimodal landscape.
  • Selection, encoding, crossover, and mutation operators can be replaced or adapted to incorporate domain-specific structure.

Applications

  • Job-shop and flow-shop scheduling, where permutation encodings represent the order of operations on machines
  • Feature selection, where binary chromosomes indicate which input variables are included in a model
  • Structural and topology optimization in mechanical and civil engineering, where real-valued or binary encodings describe the design variables
  • Vehicle routing and travelling salesman problems, where permutation encodings represent visiting orders
  • Protein structure prediction and molecular design, where encodings describe conformations or molecular fragments
  • Neural network architecture search and weight tuning, where encodings describe layer configurations or parameter vectors

How it works

How it works

1

Generate an initial population of N candidate solutions (chromosomes), either at random or by seeding with heuristic solutions. Each chromosome encodes a feasible point in the decision space, using binary strings, real-valued vectors, permutations, or trees, depending on the chosen representation.

2

Compute the fitness f(x_i) of every individual using the objective function or a surrogate model. Higher fitness indicates a better solution. For minimization problems, the cost must be transformed so that larger fitness values are better. The reciprocal of the cost is a common choice, but it is undefined when the cost is zero. A safer option is f = C_max − cost, where C_max is an upper bound on the cost over the search space, or a linear rescaling of the cost to a positive range. The selection step below requires non-negative fitness values with a positive total.

Formula
f(x_i), \quad i = 1, \ldots, N
3

Choose parents with a stochastic selection operator. In roulette-wheel (fitness-proportionate) selection, each individual's probability of selection is its fitness divided by the total fitness of the population, as given in the formula. This probability is only well defined when all fitness values are non-negative and their sum is positive, which is why minimization problems require a transformation. Roulette-wheel selection pressure depends on the spread of fitness values. When values are close together, selection is nearly random; when one individual has a much larger fitness than the rest, it can dominate the population early. Fitness scaling, or tournament selection with a small tournament size, keeps selection pressure more stable as the population converges.

Formula
P(\text{select } x_i) = \frac{f(x_i)}{\sum_{j=1}^{N} f(x_j)}
4

With crossover probability p_c, typically between 0.6 and 0.9, recombine pairs of selected parents to produce offspring. Single-point, two-point, or uniform crossover exchange segments of the parent encodings, so that children inherit features from both parents. This operator is the main mechanism through which good partial solutions are combined.

5

Each gene of each offspring is mutated independently with a low probability per gene. A common rule is to set this probability to 1/L, where L is the number of genes in the chromosome. For chromosomes of roughly 20 to 1000 genes, 1/L lies within the range of 0.001 to 0.05 per gene. Mutation restores diversity that selection and crossover may have removed, and it allows the search to leave regions where the population has converged. The mutation rate is one of the most sensitive parameters and must be matched to the problem and encoding.

6

Form the next generation either by replacing the whole population with offspring (generational replacement) or by updating a few individuals at a time (steady-state replacement). Re-evaluate fitness and repeat from selection until a stopping rule is met, such as a maximum number of generations, a fitness target, or a number of generations without improvement.

Common pitfalls

  • A mutation rate that is too high turns the search into near-random sampling and erases the fitness gains that selection has accumulated.
  • Without elitism in the replacement step, the best individual found so far can be lost between generations.
  • Using real-valued crossover on binary-encoded chromosomes, or the reverse, produces offspring that do not correspond to valid solutions.
  • Stopping too early often leaves the population before it has improved; check convergence across independent runs.
  • Crossover and mutation do not respect constraints by default, so offspring can often become infeasible, depending on the encoding and constraints. Penalty terms or repair operators have to be added to the fitness evaluation or the operators.

Frequently asked questions

How is a Stochastic Genetic Algorithm different from a standard Genetic Algorithm?

The canonical genetic algorithm already uses random draws in selection, crossover, and mutation, so the 'stochastic' label mainly signals that results vary from run to run and should be assessed over several runs. The name does not by itself denote a distinct algorithm. Papers that use the term may define their operators differently, so compare the operator definitions before treating a variant as distinct from the standard form.

How large should the population be?

A common starting point is 50 to 200 individuals for moderate-dimensional problems. Larger populations preserve diversity and reduce the risk of premature convergence, but each generation costs more evaluations. Rules of thumb linked to chromosome length exist, but they are heuristics; empirical tuning or repeated trial runs are usually needed to choose a value.

When should I prefer Particle Swarm Optimization or Simulated Annealing over a Genetic Algorithm?

Particle Swarm Optimization is often a good choice for continuous real-valued problems because it uses velocity information to move the population. Simulated Annealing is simpler to implement and works on a single solution trajectory. A GA is more natural when the search space is combinatorial, when crossover can meaningfully recombine solution structures, or when maintaining a diverse population across a multimodal landscape is valuable.

Does the Stochastic Genetic Algorithm scale to high-dimensional problems?

Performance tends to degrade in very high dimensions, because the population must be large enough to sample the space adequately and the number of evaluations grows accordingly. Specialised variants such as linkage-learning GAs, estimation of distribution algorithms, or island models with migration are designed to address scalability, but they add implementation complexity.

How do I handle constraints in a Genetic Algorithm?

Three strategies are common: penalty functions that lower fitness for constraint violations, repair operators that move infeasible offspring back into the feasible region, and encodings and operators that produce only feasible solutions by construction. Penalty methods are the simplest to implement, but their coefficients must be calibrated, because a weak penalty lets infeasible solutions dominate and a strong one can make the search rigid.

Related methods

Sources

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

    ISBN: 978-0262581110
  2. Goldberg, D. E. (1989). Genetic Algorithms in Search, Optimization, and Machine Learning. Addison-Wesley, Reading, MA.

    ISBN: 978-0201157673