Genetic Algorithm with Island Model

The method of solving optimization problems by letting bad solutions go extinct.

Girl with Pearl Earring - Johannes Vermeer

The image that evolution should approach. Shows the selected reference image.

Global Best

The best evolved image of the current evolution Shows the best result from the last evolution
Best fitnessMigrationCatastrophe

Control area for evolution

EvolutionDuelSettings

Evolution

Main controls for the evolution process
Main control for starting, pausing, or executing single evolution steps
Generation0Circles1 / 200Similarity0.0%Avg Diversity0.00Gen/Sec0

Global Elite Pool

The elite pool is empty. Start the evolution to fill it with the best individuals from each island.

Island Populations

How circles turn into a picture

This demo repaints a picture — not with a brush, but by rearranging hundreds of translucent circles until the result resembles the target image. Here is what you see on screen.

What you see
Two pictures above each other: on top the target image as a template, below it the picture the evolution is currently assembling. That lower picture is made of many coloured, semi-transparent circles that overlap. At first it is just a rough blob of colour; step by step it turns into a recognisable copy of the template.
What happens
Over many generations the demo keeps the best candidates and changes them slightly — moving, recolouring or swapping individual circles. If a change matches the template better, it stays; so the lower picture grows more and more similar to the template. A small curve below tracks this progress.
What you can do
Pick a target image or upload your own, start and pause the evolution, or step through it one generation at a time. In the settings you can change the number of circles, and in the duel two strategies evolve side by side against each other.
What to watch for
No single circle knows what the target looks like. The recognisable picture emerges purely from keeping the best random attempts and varying them again and again — generation after generation.

Definition

What are Evolutionary Algorithms?

Analogy

Imagine you're breeding the perfect tomato variety for your garden. You start with different types and select the best ones each year.

Just as nature optimizes living beings over generations, evolutionary algorithms use similar principles to solve problems:

The best solutions are selected for 'breeding'

Through crossover, new combinations emerge

Small mutations bring surprising improvements

Overview

This interactive demo simulates evolutionary optimization using the island model. It evolves artwork from colored circles that should resemble a target image.

Key Concepts

  • Generation: A generation corresponds to one evolution cycle. In each generation, new solutions are created through selection, crossover, and mutation.
  • Fitness: Fitness measures image quality as an error metric: it calculates pixel difference to the target image. Lower values = better match (0 = perfect match). Note: In classical evolution, higher fitness is better; here we use an inverted error metric.
  • Islands: Separate subpopulations that evolve in parallel. Each island can have different parameters and specializes in different solution approaches.
  • Elite Pool: Collection of the best individuals from all islands. These are used for special crossover operations.
  • Migration: On their own, the islands evolve in isolation and keep their own approaches; their best individuals meet only in the elite pool. Only “Force Migration” swaps the best individuals between neighboring islands, once per click.
  • Catastrophe: Drastic reduction of an island's population during stagnation. Only the best 20% survive, the rest is regenerated.
  • Diversity: Measure of genetic variety in the population. Higher diversity prevents premature convergence to suboptimal solutions.

Interaction

Experiment with different target images, adjust parameters, observe evolution in real-time, and use the benchmark feature to compare different algorithm variants.

Performance Optimizations

  • Fitness Cache: Stores previously calculated fitness values to avoid redundant computations. Since fitness calculation (pixel-by-pixel image comparison) is computationally intensive, caching dramatically improves performance when the same individual is evaluated multiple times.
  • Adaptive Parameters: Automatically adjusts mutation and crossover rates based on current evolution progress. When diversity is low, mutation rate increases to explore new solutions. When converging on a good solution, crossover rate increases for refinement.
  • Batch Rendering: Groups multiple canvas drawing operations to reduce browser redraws. Instead of updating after each change, updates are collected and rendered in batches, significantly improving animation smoothness.

TheoryPseudo-CodeStep by StepFlow Diagram

Biological Evolution as Model

Evolutionary algorithms are inspired by biological evolution: They generate solutions, select the best ones, combine them, and introduce random changes. Over many generations, better and better solutions emerge.

The algorithm works with a population of solution candidates. Each generation goes through three phases: Selection (the best survive), Crossover (combining solutions) and Mutation (random changes). These operations mimic natural selection, reproduction and genetic variation.

Advantages of Evolutionary Optimization

  • Global optimization: Finds good solutions even in complex search spaces with many local optima
  • No gradients needed: Works for non-differentiable or discrete problems
  • Parallelizable: Multiple solutions can be evaluated simultaneously
  • Flexible: Can be adapted to different problem types

Challenges

Evolutionary algorithms require many evaluations of the fitness function, which can be computationally intensive. Choosing the right parameters (population size, mutation and crossover rates) is crucial for performance. There is also no guarantee of finding the global optimum – only good approximations.

Practical Applications

Typical applications: Route optimization (Traveling Salesman Problem), feature selection in machine learning, hyperparameter tuning, neural architecture search, production scheduling problems, and game strategy optimization.

Try the demo! Watch how the population develops better solutions over generations.

Check

Quiz: Understanding Evolutionary Algorithms

Not completed

What is the main principle of evolutionary algorithms?

Select one answer

Answer Key: 1) B · 2) A · 3) C · 4) B · 5) C

Plain Language

This preview is in Plain Language. The whole portal is also available in Plain Language. You can change the language at the top. Or use the button below. Our Plain Language texts are AI-assisted and editorially reviewed. They follow the core principles of easy-to-read language, but they are not certified Easy Read: a review panel of people with learning difficulties does not test them.

Preview: Evolution as a problem solver

What the demo shows

This demo shows an evolutionary algorithm. Evolutionary algorithm means: nature is the model. Many solutions compete with each other. The best solutions survive. A better solution emerges from this.

How you use the demo

Click the start auto button. Evolution begins. The program shows a target image. It recreates the image with colorful circles. You watch the improvement.

What you learn

The demo shows: many weak solutions can produce a good solution. This is the power of evolution. Mutation means: small random changes. Crossover means: mixing parts of two solutions.

Select Target Image

Girl with Pearl Earring - Johannes Vermeer
Girl with Pearl Earring - Johannes Vermeer
The Scream - Edvard Munch
The Scream - Edvard Munch
Starry Night - Vincent van Gogh
Starry Night - Vincent van Gogh
The Night Watch - Rembrandt van Rijn
The Night Watch - Rembrandt van Rijn
Napoleon Crossing the Alps - Jacques-Louis David
Napoleon Crossing the Alps - Jacques-Louis David
The Great Wave - Katsushika Hokusai
The Great Wave - Katsushika Hokusai
Liberty Leading the People - Eugène Delacroix
Liberty Leading the People - Eugène Delacroix
Washington Crossing the Delaware - Emanuel Leutze
Washington Crossing the Delaware - Emanuel Leutze
Self-Portrait as a Mocker - Joseph Ducreux
Self-Portrait as a Mocker - Joseph Ducreux
Upload Custom Image