🧪 Artificial Intelligence Genetic Algorithms Simulation
Watch a genetic algorithm evolve a population of binary chromosomes to solve the 0/1 knapsack problem live: tournament selection, single-point crossover, bit-flip mutation and elitism, visualized generation by generation in 3D.
This simulation illustrates the core mechanics of genetic algorithms by solving a classic combinatorial optimization problem: the 0/1 knapsack. A population of binary chromosomes — each one a candidate packing of items into a limited-capacity knapsack — evolves generation after generation through tournament selection, single-point crossover, bit-flip mutation and elitism. Every individual is rendered live as a row of 3D cubes, sorted from best to worst, so you can watch the population converge from random noise toward a high-value, capacity-respecting solution in real time. Population size, mutation rate, crossover rate and playback speed are all adjustable, with generation count, best fitness, average fitness and best weight tracked live.
This simulation illustrates the core mechanics of genetic algorithms. Users can observe how simulated populations evolve and adapt to a problem through selection, crossover, and mutation.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install