A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Genetic Algorithms

Graduate Depth 98 in the knowledge graph ☐ I know this ☆ Set as goal
8topics build on this
606prerequisites beneath it
See this on the map →
Algorithm Design BasicsLocal Search Optimization→→Optimization Algorithms: SGD, Adam, RMSpropStochastic Gradient Descent and Variants
evolutionary-algorithms optimization population-based

Core Idea

Genetic algorithms maintain a population of candidate solutions and apply crossover and mutation operators to simulate evolution. Fitness-proportionate selection ensures better solutions are more likely to reproduce; a balance between parent selection and genetic variation is essential to avoid premature convergence. Genetic algorithms are population-based methods suitable for discrete and continuous optimization with minimal problem structure required.

How It's Best Learned

Implement a genetic algorithm for a symbolic regression or function optimization problem, experimenting with population size, crossover, and mutation rates to understand their effects.

Explainer

From your study of local search optimization, you know that methods like hill climbing can get trapped in local optima — they improve a single solution step by step but have no mechanism to escape a peak that is not the global best. Genetic algorithms (GAs) address this by maintaining an entire population of candidate solutions that evolve simultaneously, using mechanisms inspired by biological evolution: selection, crossover, and mutation. The population-based approach provides implicit parallelism — many regions of the search space are explored at once — and the recombination of solutions allows the algorithm to combine good building blocks from different candidates.

The basic cycle works as follows. Each candidate solution is encoded as a chromosome — often a binary string, but integer, real-valued, or tree-based representations are common depending on the problem. A fitness function evaluates how good each candidate is. Selection then chooses parents for the next generation, with higher-fitness individuals more likely to be selected. Common selection methods include tournament selection (pick the best of k random candidates) and roulette-wheel selection (probability proportional to fitness). Selected parents undergo crossover (recombination), where portions of two parent chromosomes are exchanged to create offspring — for example, one-point crossover swaps everything after a random position. Mutation then randomly perturbs a small fraction of the offspring's genes, introducing fresh genetic material. The new population replaces the old one, and the cycle repeats.

The balance between exploitation (refining known good solutions through selection and crossover) and exploration (discovering new regions through mutation and population diversity) is the central design challenge. If selection pressure is too strong, the population converges prematurely to a local optimum — all individuals become nearly identical, and crossover produces no new information. If mutation rate is too high, the search becomes essentially random. Typical configurations use moderate selection pressure, crossover rates of 0.6–0.9, and mutation rates of 0.001–0.01 per gene. Elitism — always preserving the best individual(s) from one generation to the next — prevents the algorithm from losing its best-known solution and generally improves convergence.

GAs are especially valuable for problems where the search space is large, discrete, multimodal, or poorly understood. Unlike gradient-based methods, they require no derivative information — only the ability to evaluate fitness. This makes them applicable to combinatorial optimization (scheduling, routing), design problems (antenna shapes, circuit layouts), and symbolic regression (evolving mathematical expressions to fit data). The tradeoff is efficiency: GAs typically require many more fitness evaluations than gradient methods on smooth problems, so they are best suited for problems where gradient information is unavailable or the landscape is rugged with many local optima. Understanding when a GA is the right tool — versus simulated annealing, gradient descent, or exhaustive search — is as important as understanding how to tune one.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Boolean Algebra → Boolean Type and Truth Values → Comparison Operators and Boolean Tests → Logical Operators and Boolean Algebra → Conditional Statements → Defining and Calling Functions → Functions: Decomposing Problems → Function Parameters and Argument Passing → Return Values → Variable Scope → Introduction to Classes → Objects and Instances → Methods and Attributes → Algorithm Design Basics → Tree Structure and Node Properties → Binary Trees → Tree Traversals → Depth-First Search (DFS) → Depth-First Search: Implementation and Applications → Topological Sort → Dynamic Programming → Longest Common Subsequence (LCS) Problem → Edit Distance: Levenshtein Distance and DP → 0/1 Knapsack Problem: Bounded Capacity DP → Greedy Algorithms → Activity Selection Problem Using Greedy Algorithms → Dijkstra's Algorithm → A* Search Algorithm → Heuristic Search Functions → Local Search Optimization → Genetic Algorithms

Longest path: 99 steps · 606 total prerequisite topics

Prerequisites (2)

Leads To (2)