Genetic Algorithm (DEAP)

Evolutionary Computing Global Optimizer

Genetic Algorithm (Holland, 1970s) evolves a population of candidate solutions through selection, crossover, and mutation. HumpDay's GeneticAlgorithm uses a real-valued representation (no binary encoding), tournament-of-3 selection, one-point crossover, and per-coordinate Bernoulli mutation with uniform noise. The reference adapter for the SOTA snapshot is mealpy's BaseGA, not DEAP — mealpy is what the benchmark actually compares against.

HumpDay's GA at a glance

  • Representation: real-valued vectors in [0, 1]n.
  • Selection: tournament-of-3.
  • Crossover: one-point.
  • Mutation: per-coordinate Bernoulli with uniform noise.
  • Elitism: the best individual is carried over each generation.

Interactive 3D Visualization

See Genetic Algorithm in action on 3D optimization surfaces:

Loading 3D visualization...

Requires WebGL support

Instructions: Choose a test function and algorithm, then click Start to watch the step-by-step optimization process.

Implementation Details

Component Details Links
Original Algorithm John Holland
Evolutionary computation inspired by natural selection
Population-based search with genetic operators
Published: 1970s
Holland's Book
Reference Implementation DEAP (Distributed Evolutionary Algorithms in Python)
Comprehensive evolutionary computation framework
Flexible GA with customizable operators
Package: deap
DEAP Docs GitHub
HumpDay Python HumpDay GeneticAlgorithm
Real-valued GA: tournament-of-3 selection, one-point crossover, per-coordinate Bernoulli mutation with uniform noise, elitism on the best individual.
Pure Python; no required dependencies.
File: humpday/optimizers/evolutionary_algorithms.py
Source
HumpDay JavaScript Browser GeneticAlgorithm
Mirrors the Python port.
Class: GeneticAlgorithm
JS Port

Performance Characteristics

  • Best for: Multimodal continuous objectives where population diversity matters more than rapid local refinement.
  • Worst for: Tight-budget smooth basins — the population/generation overhead is a tax compared to CMA-ES or DE on the same problems.
  • Per generation: population_size evaluations + selection/crossover/mutation operators.
  • Relative to mealpy BaseGA at n_trials=200, n_dim=2: HumpDay wins on sphere, Rosenbrock, and Ackley. See SOTA status for the live numbers.

Educational Resources

Algorithm Components

  • Selection: Tournament, roulette wheel, rank-based selection
  • Crossover: Single/multi-point, uniform, simulated binary (SBX)
  • Mutation: Gaussian, polynomial, uniform random
  • Replacement: Generational, steady-state, elitist strategies
  • Encoding: Binary, real-valued, permutation representations

GA Variants

  • Simple GA: Holland's original binary-encoded GA
  • Real-Coded GA: Direct real number representation
  • Micro-GA: Small population with frequent restarts
  • Parallel GA: Island models and distributed populations
  • Steady-State GA: Replace individuals one at a time
  • Multi-Objective GA: NSGA-II, SPEA-2 for Pareto optimization

GA Applications

  • Scheduling: Job shop, vehicle routing, timetabling
  • Design Optimization: Antenna design, circuit layout
  • Machine Learning: Feature selection, neural network topology
  • Bioinformatics: Sequence alignment, protein folding
  • Finance: Portfolio optimization, trading strategies
  • Game AI: Strategy evolution, procedural content generation

Mathematical Foundation

  • Schema Theory: Building blocks and convergence analysis
  • No Free Lunch: Performance bounds across problem classes
  • Markov Chain Analysis: Convergence proofs for GA variants
  • Population Dynamics: Selection pressure and diversity maintenance