symbios-genetics
A battle-hardened evolutionary computation engine for Rust.
symbios-genetics is a trait-based library designed for Morphogenetic Engineering, Artificial Life, and Creative AI. Unlike general-purpose genetic libraries, it prioritizes correctness, reproducibility, and serialization above all else.
Algorithms
The library implements three distinct evolutionary strategies covering the spectrum of optimization needs:
| Algorithm | Type | Best Use Case |
|---|---|---|
| SimpleGA | Single-Objective | Converging on a specific optimal solution (e.g., maximizing speed). Features Elitism and Tournament Selection. |
| NSGA-II | Multi-Objective | Finding the Pareto Front of trade-offs between conflicting goals (e.g., maximize strength AND minimize weight). |
| MAP-Elites | Quality-Diversity | Illuminating the search space. Finds the best solution for every possible niche (e.g., "fastest robot for every possible height"). |
Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
= { = "1.0", = ["derive"] }
= "0.9"
Defining a Genome
Implement the Genotype trait for your data structure.
use Rng;
use ;
use Genotype;
Defining an Evaluator
Implement Evaluator to bridge your genome to the engine. Returns a tuple of (Fitness, Objectives, Descriptor).
use Evaluator;
;
Running Evolution
use ;
Architecture
The Evolver Trait
All algorithms implement the Evolver<G> trait. This allows you to write simulation harnesses (e.g., a Bevy plugin) that are agnostic to the specific evolutionary strategy. You can hot-swap SimpleGA for MapElites without rewriting your game loop.
Parallelism
To enable parallel evaluation, ensure the parallel feature is enabled (default) and your Evaluator implements Send + Sync. The engine automatically dispatches evaluation tasks via rayon::par_iter.
= { = "0.1.0", = ["parallel"] }
License
This project is licensed under the MIT License - see the LICENSE file for details.