Skip to main content

Crate evolutionary_planning

Crate evolutionary_planning 

Source
Expand description

§Evolutionary planning

Genetic algorithms, evolution strategies and multi-objective evolutionary search over plans, paths and trajectories, for no_std + alloc.

Every objective is minimised; costs are f64 and NaN counts as +∞. All randomness comes from a caller-provided rand_core::Rng (the crate ships SplitMix64), so a seed reproduces a run. Every run takes a Budget that is asked before each evaluation; Limits covers evaluations, generations and a target cost.

§Modules

FamilyModules
Coreoperators (traits and representations), budget, observer, rng, cost, objective, problems
Single objectivega, diffusion, hill_climb, es, cmaes, de, memetic
Multi objectivepareto, nsga2, nsga3, moead
Quality diversitymap_elites
Planningrhea, stl, trajectory, graph_path, sas (feature sas-plus), programmer, gp
graph TD
    core[rng, cost, budget, observer] --> ops[operators]
    ops --> single[ga, diffusion, hill_climb, es, cmaes, de]
    single --> memetic
    ops --> multi[pareto, nsga2, nsga3, moead]
    ops --> qd[map_elites]
    single --> planning[rhea, stl, trajectory, graph_path, sas, programmer, gp]

§Example

use evolutionary_planning::cmaes::{CmaEs, Config};
use evolutionary_planning::problems::single::ellipsoid;
use evolutionary_planning::{Limits, SplitMix64};

let mut cma = CmaEs::new(vec![1.0; 6], 0.5, Config::default());
let mut objective = |x: &Vec<f64>| ellipsoid(x);
let outcome = cma.minimize(&mut objective, &mut Limits::evaluations(10_000).with_target(1e-10), &mut (), &mut SplitMix64::new(7));
assert!(outcome.best_cost() <= 1e-10);

See docs/design.md in the repository for the architecture, the paper table, the design rules and the deviations from the source papers.

Repository: https://github.com/sunsided/evolutionary-planning

Re-exports§

pub use budget::Limits;
pub use budget::Stats;
pub use budget::Stop;
pub use cost::Individual;
pub use cost::ranking;
pub use cost::sanitize;
pub use objective::MultiObjective;
pub use objective::MultiObjectiveFn;
pub use objective::Objective;
pub use objective::multi_objective_fn;
pub use observer::Event;
pub use observer::Observer;
pub use observer::ObserverFn;
pub use observer::observer_fn;
pub use rng::SplitMix64;
pub use rng::below;
pub use rng::chance;
pub use rng::standard_normal;
pub use rng::uniform;
pub use rng::unit_f64;

Modules§

budget
Run counters (Stats), early stopping (Budget, Limits) and why a run ended (Stop).
cmaes
CMA-ES, the covariance matrix adaptation evolution strategy, exactly as in Hansen’s tutorial (arXiv:1604.00772): Figure 6 with the default parameters of Table 1, including the negative (“active”) recombination weights, h_σ and δ(h_σ), the rescaling (46) of negatively weighted steps, the lazy eigendecomposition of Appendix B.2 (each one warm-started from the previous eigenbasis) and the termination criteria of Appendix B.3. IPOP restarts (Auger and Hansen 2005) with growing population size are in Ipop.
cost
Costs and evaluated individuals: the NaN policy, the total order used for every sort, and the Individual pair of a genome and its cost.
de
Differential evolution (Storn and Price 1997) on real vectors, with Latin hypercube initialisation and a warm-start library (Yue et al. 2023), and RADES, the rank-based DE with a success archive (Parque 2024), in rades.
diffusion
GLEAM’s diffusion model (Jakob 2021, section 7): a structured population on a ring, where every individual mates only within its deme of neighbours, so good genes spread slowly, niches form and premature convergence is counteracted.
es
Evolution strategies on real vectors: the (μ/ρ,λ)- and (μ/ρ+λ)-ES with self-adaptive step sizes (Schwefel; Beyer and Schwefel 2002), and the (1+1)-ES with the 1/5th success rule (Rechenberg).
ga
Genetic algorithms: generational with elitism, and steady state.
gp
Tree-based genetic programming over a small operator language, for evolving planning programs such as reactive navigation policies (the idea of Lou, Ding and Wu 2022 taken to program trees; see also Koza 1992).
graph_path
Genetic path planning on graphs and grids: a genome is a simple path from start to goal, initialised by randomised depth-first search, recombined at shared vertices, mutated by rerouting a stretch, and repaired by cutting loops.
hill_climb
Random-mutation hill climbing (RMHC): mutate a copy of the current genome and keep it if it is not worse.
map_elites
MAP-Elites (Mouret and Clune 2015): quality diversity over a grid of behaviour descriptors. The archive keeps, for every cell of the descriptor grid, the cheapest genome whose behaviour falls into it, so a run returns a map of diverse, locally optimal solutions (for example plans that differ in length and risk) instead of one optimum.
memetic
Memetic search: local searchers applied to offspring, with HyGLEAM’s cost-benefit adaptation of how often and how long they run (Jakob 2021, section 5; Jakob, Blume and Bretthauer 2004).
moead
MOEA/D (Zhang and Li 2007): multi-objective search by decomposition into N scalar subproblems, one per weight vector, each improved by mating within its neighbourhood of the T closest weight vectors; with the neighbourhood mating probability δ and the replacement limit n_r of Li and Zhang (2009).
nsga2
NSGA-II (Deb, Pratap, Agarwal and Meyarivan 2002): elitist multi-objective search by non-dominated sorting and crowding distance, with Deb’s constrained domination.
nsga3
NSGA-III (Deb and Jain 2014): NSGA-II’s non-dominated sorting with reference-point based niching instead of crowding, for three or more objectives.
objective
What is optimised: Objective for one cost, MultiObjective for a cost vector with a constraint violation.
observer
Runtime reporting: an Observer receives Events while an algorithm runs.
operators
Variation operators: the genome-agnostic traits (Initializer, Mutation, Crossover, Repair, Selection), closure adapters, combinators, and ready-made operators per representation in the submodules.
pareto
Pareto tools shared by the multi-objective algorithms: dominance and constrained dominance, fast non-dominated sorting, crowding distance, bounded Pareto archives and exact hypervolume. All objectives are minimised.
problems
Benchmark problems with known optima, for tests, benches and examples.
programmer
An evolutionary programmer after Lou, Ding and Wu (2022): a meta-GA evolves bit strings that encode complete path-planning GAs (operators and their parameters, drawn from an operator library), scored by how well the decoded planner solves a set of training instances within a fixed evaluation budget.
rhea
Rolling-horizon evolutionary planning (RHEA; Perez et al. 2013) over a caller-supplied forward model, with random-mutation hill climbing (RMHC) as the population-of-one case used by Olesen et al. (2020) to plan in the latent space of a learned world model.
rng
The seeded pseudo-random generator SplitMix64 and the sampling helpers every algorithm uses: uniform floats, unbiased integers, standard normals and shuffles.
sas
Genetic search over SAS+ plans (feature sas-plus): plans are GLEAM action chains of operator ids, decoded by simulating the sas_plus::Task, scored by EvoPlan’s fitness cascade, and repaired phenotypically or genotypically.
stl
Finite-trace signal temporal logic (STL) with quantitative semantics, for evolutionary search under temporal-logic constraints (after EvoPlan, Nukapotula et al. 2026).
trajectory
Online trajectory optimisation with warm-started CMA-ES, after the online motion planner of Yue et al. (2023): a trajectory is a control sequence of steps × controls reals that the caller’s objective rolls out through its dynamics, and every control period the plan is re-optimised under a small evaluation budget, starting from

Structs§

MultiOutcome
The result of a multi-objective run.
Outcome
The result of a single-objective run.

Traits§

Budget
Decides when a search must stop before it finishes, given its counters so far.