← Back to Blog πŸ‡―πŸ‡΅ ζ—₯本θͺž

What is a Genetic Algorithm (GA)?
How It Works & Core Processes

Published: July 5, 2026 | Category: Algorithm Fundamentals

In modern computer science and artificial intelligence, researchers use many computational models to solve optimization problems β€” finding the best answer among vast numbers of possibilities. One of the most unique and powerful approaches is the Genetic Algorithm (GA), which mimics billions of years of biological evolution directly on a computer.

This article explains genetic algorithms from their origins, through encoding, fitness evaluation, selection, crossover, and mutation β€” and how these processes power the evolutionary generative-art simulator gene46.

1. Origins: Darwin's Survival of the Fittest

Genetic Algorithms were pioneered in the 1970s by Professor John Holland at the University of Michigan, inspired by Charles Darwin's theory of natural selection.

In nature, organisms best adapted to their environment survive, passing their superior DNA to offspring. Through generations of recombination and mutation, species gradually optimize their body structures to match their environment. GAs translate this generational adaptation process into a mathematical model for solving hard optimization problems.

Traditional mathematical optimization methods (like gradient descent) require smooth, differentiable functions β€” a severe limitation. GAs, by contrast, thrive on problems that are impossible to express in clean equations: combinatorial explosions, subjective evaluations, and multi-modal search landscapes.

2. Encoding: Representing Solutions as DNA

Before a GA can run, the problem's parameters must be encoded β€” represented like biological DNA. This is called encoding.

Classic GA textbooks use binary strings of 0s and 1s. Modern applications more often use real-valued encoding, where each gene is a floating-point number in an array.

Encoding in gene46

In gene46, the geometric patterns and color gradients drawn on screen are encoded as DNA arrays:

  • Line Art DNA: BΓ©zier curve control point coordinates (X, Y), line thickness, and RGBA gradient values β€” dozens of real-valued parameters forming one individual's genome.
  • Mosaic DNA: A mathematical function network (CPPN) that maps pixel coordinates to RGBA color values. The weights and structure of sin/cos/tanh functions are evolved, producing fractal-like abstract patterns.

3. The Four Core Elements of a GA

After creating an initial population, GAs repeatedly cycle through evaluation β†’ selection β†’ crossover β†’ mutation. This cycle is called a generation loop.

Step 1: Initial Population

Create multiple individuals with random DNA. The total number of individuals is the population size β€” typically 50 to 200. In gene46, each generation contains exactly 100 individuals. This is Generation 0, the evolutionary starting line.

Step 2: Fitness Evaluation

Measure how well each individual solves the target problem, producing a fitness score.

For standard optimization problems (route planning, structural design), a mathematical fitness function automatically scores each individual. But when evaluating "beauty" or "preference" β€” as in gene46 β€” no formula works. This is called Interactive Genetic Algorithm (IGA): the user's swipe decisions (right = keep, left = eliminate) directly determine fitness.

Step 3: Selection & Elimination

Based on fitness scores, select the "parent" individuals who pass their DNA to the next generation. Higher-fitness individuals are more likely to be chosen; lower-fitness ones are eliminated. Common selection strategies include:

Step 4: Crossover

Combine the DNA of two selected parents to create new child individuals β€” the core process for inheriting and merging the strengths of both parents:

Step 5: Mutation

Running crossover alone causes the population to converge on its parents' DNA range, eventually stagnating. To prevent this, a small random change is introduced in the genome at a low probability (typically 1–10%). This is mutation.

Mutation injects brand-new shapes and color variations that no parent possessed, preventing evolutionary stagnation and maintaining diversity.

4. Why Are Genetic Algorithms So Powerful?

GA's greatest strength is the ability to search complex, non-smooth landscapes for optimal solutions.

Imagine searching for a mountain's summit (the optimal solution). Gradient descent only reads the local slope and climbs step by step β€” but in a range with many peaks, it gets stuck on the nearest hilltop, mistaking it for the world's highest point (the local optima trap).

A GA instead deploys 100 explorers across the entire landscape simultaneously, comparing their positions and concentrating new explorers near the highest ones β€” while occasionally parachuting new explorers to completely random locations (mutation). This combination of parallel cooperative search and random leaps is exactly what lets GAs tackle problems that defeat conventional methods.

5. Summary & How to Experience It in gene46

Genetic Algorithms recreate the drama of biological evolution β€” trial, selection, and adaptation β€” inside a computer. They are among the most fascinating tools in computer science.

Every time you swipe in gene46, millions of parameter calculations run behind the scenes. Your swipe decisions act as the selective pressure, driving the art toward ever-more-refined geometric beauty across generations. Play with that process in mind β€” and watch evolution happen in real time.

πŸ“š References

  • John H. Holland (1975), Adaptation in Natural and Artificial Systems, University of Michigan Press
  • David E. Goldberg (1989), Genetic Algorithms in Search, Optimization, and Machine Learning, Addison-Wesley
  • Wikipedia: Genetic Algorithm

About the Author

gene46 Development Team (GA Research Unit)
A project team researching and developing autonomous evolutionary generative art using Genetic Algorithms, working at the intersection of game development and computer science.

Related Articles