Evolutionary Algorithms & Neuroevolution
EvoLib bridges the gap between overly simple GA libraries and overly complex research frameworks - designed for clarity, accessibility, and easy adoption in both research and education .
pip install evolib
Minimal example
from evolib import Population
pop = Population("examples/01_basic_usage/population.yaml")
pop.run()
EvoLib combines classical evolutionary strategies (μ+λ, adaptive mutation, crossover) with structural neuroevolution in one consistent framework.
Define experiments via YAML with automatic validation - explicit, reproducible, and easy to adapt. Swap strategies or structures without touching core code.
Evolve weights, structure (connections, neurons, recurrence), and activations - combined with classical ES/GA methods.
Define runs via YAML with automatic validation - no code changes needed.
Clean API, transparent configs, examples that are easy to follow.
(μ, λ), (μ+λ), steady-state; tournament/roulette/rank/SUS selection.
Constant, exponential decay, global & individual adaptation.
Evolve neural networks (EvoNet, structural growth).
MIT-licensed, flat API (from evolib import ...
), easy to extend.
Install
pip install evolib
Create quickstart.yaml
# quickstart.yaml
parent_pool_size: 10
offspring_pool_size: 30
max_generations: 20
num_elites: 1
random_seed: 42
evolution:
strategy: mu_plus_lambda
modules:
main:
type: vector
dim: 8
bounds: [-1.0, 1.0]
initializer: random_vector
mutation:
strategy: constant
probability: 1.0
strength: 0.05
# run_quickstart.py
import numpy as np
from evolib import Indiv, Population, sphere, plot_fitness
def my_fitness(indiv: Indiv) -> None:
x = indiv.para["main"].vector
indiv.fitness = sphere(x)
pop = Population("quickstart.yaml", fitness_function=my_fitness)
pop.run(verbosity=1)
# Basic plotting (default metrics: best, mean, and median fitness)
plot_fitness(pop, show=True)
python run_quickstart.py
Evolving network topology (add neurons/edges). Small, didactic, visual.
Evolving an EvoNet to reproduce a target image. Great for lectures and demos.
Classic continuous benchmark with adaptive mutation strategies.