Expand description
§fugue-evo
Evolutionary computation for Rust, in two layers:
- Classic EC (
classicfeature; standalone, no fugue dependency). SimpleGA, CMA-ES, NSGA-II, Island Model, Evolution Strategy, EDA/UMDA, SteadyState, the interactive GA, all operators, checkpointing, and the WASM surface. Compiles with--no-default-features --features std,parallel,checkpoint,classicwith no probabilistic-programming dependency at all. Conversely,--features std,pplbuilds the inference layer with no classic code. - Evolutionary inference (
pplfeature, on by default): evolutionary algorithms as probabilistic programs. The prior over genomes is a user-written fugueModel(aGenomePrior), fitness enters asfactor(β·f(x)), so the Boltzmann posteriorπ_β(x) ∝ p(x)·exp(β·f(x))is a fugue program — and every sampler is fugue’s own inference machinery:EvolutionChain(typed single-site MH),EvolutionSMC(adaptive tempered SMC with a population-coupled crossover kernel and a log-evidence estimate),ArithmeticGrammarPrior(genetic programming over a probabilistic grammar, where subtree mutation/crossover are generic trace moves),GenomeLikelihood(likelihoods as observation programs, with latent nuisance parameters jointly inferred), annealed optimizer mode (EvolutionSMC::anneal), and the Pareto posterior (ParetoScalarization— multi-objective optimization as inference).
The boundary between the layers is the
TraceGenome extension trait: classic
algorithms require only EvolutionaryGenome;
genomes that also implement TraceGenome can be driven by the inference
layer.
§Features
- Multiple Algorithms: SimpleGA, CMA-ES, NSGA-II, Island Model, EDA, Interactive GA (standalone EC)
- Flexible Genomes: RealVector, BitString, Permutation, TreeGenome
- Modular Operators: Pluggable selection, crossover, and mutation operators
- Adaptive Hyperparameters: opt-in Thompson-sampling tuning of operator parameters
- Evolutionary inference (
ppl): priors as programs, tempered SMC over the Boltzmann posterior, MH with typed proposals, symbolic regression as exact Bayesian inference - Production Ready: Checkpointing (bit-identical resume), parallel evaluation, WASM support
§Quick Start (classic optimization)
ⓘ
use fugue_evo::prelude::*;
use rand::rngs::StdRng;
use rand::SeedableRng;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut rng = StdRng::seed_from_u64(42);
let bounds = MultiBounds::symmetric(5.12, 10);
let result = SimpleGABuilder::real_valued()
.population_size(100)
.bounds(bounds)
.fitness(Sphere::new(10))
.max_generations(200)
.build()?
.run(&mut rng)?;
println!("Best fitness: {:.6}", result.best_fitness);
Ok(())
}§Quick Start (evolution as inference, ppl)
ⓘ
use fugue_evo::prelude::*;
// Prior as a program; fitness as a likelihood factor; posterior by SMC.
let model = EvolutionModel::new(GaussianPrior::new(0.0, 2.0, DIM), fitness);
let posterior = EvolutionSMC::run(&mut rng, &model, EvoSmcConfig::default());
println!("posterior mean: {}", posterior.weighted_mean(0));
println!("log evidence: {}", posterior.log_evidence);§Module Overview
algorithms: Classic optimization algorithms (SimpleGA, CMA-ES, NSGA-II, Island Model)genome: Genome types,EvolutionaryGenome, and (behindppl)TraceGenomeoperators: Selection, crossover, and mutation operatorsfitness: Fitness traits and benchmark functionspopulation: Population management and individual typestermination: Stopping criteriahyperparameter: Adaptive and Bayesian hyperparameter tuninginteractive: Human-in-the-loop evolutionary optimizationcheckpoint: State serialization for pause/resumeinference: Evolution as inference — priors as programs, MH, tempered SMC, grammar GP (ppl)
§Examples
sphere_optimization.rs,rastrigin_benchmark.rs,cma_es_example.rs,island_model.rs,symbolic_regression.rs(classic GP),checkpointing.rs,interactive_evolution.rs: the classic layerbayesian_evolution.rs: the inference layer end-to-end (SMC + MH + adaptive GA)symbolic_regression_inference.rs: flagship — symbolic regression as exact Bayesian inference over a probabilistic grammar
Re-exports§
pub use inference as fugue_integration;
Modules§
- algorithms
- Evolutionary algorithms
- checkpoint
- Checkpointing support for evolution state persistence
- diagnostics
- Diagnostics and statistics
- error
- Error types for fugue-evo
- fitness
- Fitness evaluation and benchmarks
- genome
- Genome abstractions and implementations
- hyperparameter
- Hyperparameter adaptation mechanisms
- inference
- Evolution as inference: the PPL-native layer (requires the
pplfeature) - interactive
- Interactive Genetic Algorithm (IGA) module
- operators
- Genetic operators
- population
- Population management
- prelude
- Prelude module for convenient imports
- termination
- Termination criteria