Multiple descriptors and CMA-based search¶

The examples on this page use four independent searches. Each receives new archives and a private seed. Evaluators return measurements and the search updates archives in the calling process. Install qdpy[cma] for Dynamic CMA-ME, DDS-KDE, and CMA-MEGA (ES). Multi-descriptor MAP-Elites Success uses the base package.

Multi-descriptor MAP-Elites Success¶

Use qdpy.algorithms.multi_bd_mes() when one evaluation supplies several views of behavior. For example, one navigation run can yield both its endpoint and the centroid of the path it followed. Define a success condition such as reaching a goal. Each descriptor view has its own Grid or CVTGrid, and the same evaluation can enter several archives. Fitness compares elites of equal success status. A successful candidate can replace an unsuccessful one even when its shaping fitness is lower. Parent selection favours successful elites in the current view.

from qdpy.algorithms import multi_bd_mes
from qdpy.containers import Grid

archives = {
    name: Grid(shape=8, features_domain=((0., 1.),), fitness_domain=((0., 1.),),
               fitness_weights=(1.,))
    for name in ("distance", "balance")
}

def evaluate(genome):
    left, right = genome
    distance = (left + right) / 2
    balance = 1 - abs(left - right)
    return distance > .75, (distance,), {"distance": (distance,), "balance": (balance,)}

result = multi_bd_mes(archives, evaluate, dimension=2, budget=64, seed=7)
print(result.attempts, result.successful_evaluations, result.admissions)

The implementation uses a steady-state loop, round-robin view selection, and bounded Gaussian mutation. Each stored elite has a success named score. Declare the success criterion and descriptor views in your evaluator. The reference uses a model to propose these functions. Garrabé, Khoramshahi, and Doncieux (2026 preprint).

Dynamic CMA-ME¶

qdpy.algorithms.dynamic_cma_me() probes the least recently checked elite for a change in fitness or descriptors. When a probe detects a shift, it refreshes the incumbents of the cells targeted by the new offspring. If an incumbent moves to another occupied cell, it also refreshes that cell’s incumbent. The search stages those measurements before committing them. If a refresh fails or exhausts the remaining budget, that generation leaves the archive as it was. The attempts still count toward the budget.

from qdpy.algorithms import dynamic_cma_me
from qdpy.containers import Grid

archive = Grid(shape=(6, 6), features_domain=((0., 1.),) * 2,
               fitness_domain=((0., 1.),))

def evaluate(genome, tick):
    centre = .25 if tick < 32 else .75
    cost = sum((x - centre) ** 2 for x in genome) / len(genome)
    return (cost,), genome[:2]

result = dynamic_cma_me(archive, evaluate, x0=[.5] * 4,
                        budget=93, batch_size=8, seed=7)
print(result.offspring_attempts, result.detection_attempts, result.refresh_attempts)

Use a deterministic evaluator at each tick. Each generation freezes its tick at the current number of spent attempts. Probe and refresh calls share that tick. The implementation uses one improvement emitter and passes only a complete offspring population to CMA. Use refresh=False for the matched static control. Audit both archives at the same final tick and keep audit calls separate from search. Gallotta, Liapis, and Yannakakis (2024).

Density Descent Search with a kernel density estimate¶

qdpy.algorithms.dds_kde() ranks new solutions by descriptor density using a Gaussian kernel and a bounded reservoir of past descriptors. The results grid reports discoveries. CMA and the reservoir update independently of admission to that grid. Supply constant fitness to isolate diversity in a comparison. Bandwidth is in descriptor units, so use comparable scales for distinct axes.

from qdpy.algorithms import dds_kde
from qdpy.containers import Grid

archive = Grid(shape=(8, 8), features_domain=((0., 1.),) * 2,
               fitness_domain=((0., 1.),), fitness_weights=(1.,))
result = dds_kde(archive, lambda genome: ((1.,), genome[:2]),
                 x0=[.5] * 4, budget=128, bandwidth=.1,
                 reservoir_size=64, batch_size=12, seed=7)
print(result.attempts, result.reservoir_size, archive.filled_bins)

The Gaussian estimate scores a population against the prior reservoir. Reservoir sampling adds the current population after ranking. Valid descriptors can inform the estimate even if their result falls outside the reporting grid. This is the KDE variant from Lee et al. (2024).

For the continuous normalizing flow variant on the same CMA scheduler, see Fit a continuous descriptor density.

CMA-MEGA with ES gradient estimates¶

qdpy.algorithms.cma_mega_es() estimates fitness and descriptor gradients from the same set of mirrored perturbations. It samples linear combinations of the normalised gradients and adapts its coefficient distribution using archive improvement. As in the authors’ reference configuration, centre and perturbation measurements can enter the archive. A bounded search clips candidates to its declared genome bounds. Failed measurements count toward the budget. A pair enters the gradient estimate only if both perturbations returned valid measurements.

from qdpy.algorithms import cma_mega_es
from qdpy.containers import Grid

archive = Grid(shape=(6, 6), features_domain=((0., 1.),) * 2,
               fitness_domain=((0., 1.),))

def evaluate(genome):
    cost = sum((x - .25) ** 2 for x in genome) / len(genome)
    return (cost,), genome[:2]

result = cma_mega_es(archive, evaluate, x0=[.5] * 4, budget=93,
                     es_samples=8, batch_size=12, seed=7)
print(result.centre_attempts, result.perturbation_attempts, result.offspring_attempts)

The reported total includes all three phases. DDS-KDE and CMA-MEGA (ES) also accept a caller-owned executor exposing ordered map. For process workers, define the evaluator at module scope. See Tjanaka et al. (2022) for the algorithm and original RL experiments.

Reproduce the CPU comparisons¶

From the repository root, use the installed QDpy package to run the example with three seeds and 388 candidate calls per search.

python -m pip install ".[cma]"
python -m examples.descriptor_cma --output build/descriptor-cma/results.json

To run the navigation comparison with the base package, pass --studies success. The dynamic comparison reports an independent final-tick audit. The density comparison uses identical reporting grids and constant quality. The gradient comparison counts the perturbation cost for both ES methods. The default budget fits ME-ES initialization and whole generations exactly.

The following values are medians over seeds 7, 13, and 23. All 36 trials spent 388 search calls each. A second run reproduced every saved record.

Study

New method

Baselines

Navigation, successful endpoint cells

Multi-descriptor MES 7

Single-grid MES 7, MAP-Elites 1

Shifting sphere, final archive freshness

Dynamic CMA-ME 54.8%

Static CMA-ME 38.7%, Dynamic MAP-Elites 64.9%

Constant quality, coverage

DDS-KDE 96.9%

Novelty search 78.1%, CMA-MAE 100.0%

Rastrigin, QD score

CMA-MEGA (ES) 43.23

ME-ES 6.54, CMA-MAE 40.00

Multi-descriptor MES found a successful endpoint on all three seeds. Single-grid MES did so on two. Dynamic CMA-ME spent a median of 23 probes and 78 refresh calls. Dynamic MAP-Elites spent a median of 184 refresh calls and had higher final freshness on this task. The saved results include corrected coverage and QD scores from the independent audit.

Download the per-seed results.

qdpy.algorithms.multi_bd_mes(archives, evaluate, *, dimension, budget, ind_domain=(0, 1), mutation_sigma=0.1, seed=0, on_step=None)[source]¶

Run steady-state multi-descriptor MAP-Elites Success.

Each grid has independent local competition. A success takes precedence within its cell. Fitness breaks comparisons between entries with equal success status. Select parent grids in round-robin order, falling back to a populated grid if necessary. Within each grid, sample uniformly from successful elites when available, or from all elites while searching for a first success. Mutate real-valued candidates with bounded Gaussian noise. Garrabé et al. use the multi-grid method with inferred descriptor functions. This runner accepts them as part of the supplied evaluator.

Parameters:
  • archives – Mapping from descriptor view names to distinct, empty, parentless, best-only Grid or CVTGrid instances.

  • evaluate – Callable taking an immutable genome and returning (success, (fitness,), {view: descriptors}). Success is a bool.

  • dimension – Number of real variables in each genome.

  • budget – Total evaluator attempts across all descriptor views.

  • ind_domain – Inclusive lower and upper genome bounds.

  • mutation_sigma – Gaussian standard deviation as a fraction of the bounds’ span.

  • seed – Private random seed for initialization, selection and mutation.

  • on_step – Optional callback taking the archives and keyword arguments iteration and evaluations after each attempted evaluation.

Returns:

Live archives and shared evaluation accounting.

qdpy.algorithms.dynamic_cma_me(archive, evaluate, *, x0, budget, sigma0=0.15, batch_size=16, ind_domain=(0, 1), seed=0, refresh=True, on_step=None)[source]¶

Run Dynamic CMA-ME with oldest-elite detection and replacee refresh.

A generation shares one tick, the number of attempts already spent when it starts. Probe the least recently checked elite, including with the final available call. If the probe changed, refresh occupied destinations and follow incumbent moves. Commit the updates together before ranking offspring by cell improvement. Failed or unfinished refreshes leave the archive untouched and restart the strategy. Only offspring from a full generation enter CMA feedback.

Parameters:
  • archive – Empty, parentless, best-only Grid or CVTGrid.

  • evaluate – Callable taking an immutable genome and a tick. Return a singleton fitness vector and its descriptors.

  • x0 – Initial genome used before the first archive admission.

  • budget – All attempted evaluations, including probes and refreshes.

  • sigma0 – Initial CMA sampling scale.

  • batch_size – CMA population size.

  • ind_domain – Common bounds, or None for unbounded search.

  • seed – Private CMA and restart seed.

  • refresh – Enable detection and refresh. False runs static CMA-ME with the same improvement emitter and tick convention.

  • on_step – Optional callback receiving the archive, iteration and evaluations.

Returns:

The live archive and counts per evaluation phase.

qdpy.algorithms.dds_kde(archive, evaluate, *, x0, budget, bandwidth, reservoir_size=1024, sigma0=0.15, batch_size=16, ind_domain=(0, 1), seed=0, executor=None, on_step=None)[source]¶

Run Density Descent Search with kernel density estimation.

Each generation is ranked against the descriptor reservoir from earlier generations. Reuse the previous order to break equal densities. Offer measured solutions to a passive archive. Fitness and archive admission never enter CMA feedback. Valid measurements outside the archive’s bounds still inform the density model.

Parameters:
  • archive – Empty, parentless, best-only Grid or CVTGrid.

  • evaluate – Callable taking an immutable genome and returning a singleton fitness vector and its descriptors. Use constant fitness for a pure diversity task.

  • x0 – Initial genome for CMA and its restarts.

  • budget – Total attempted evaluations.

  • bandwidth – Positive Gaussian bandwidth in descriptor units.

  • reservoir_size – Maximum number of past descriptors to retain.

  • sigma0 – Initial CMA sampling scale in genome coordinates.

  • batch_size – CMA population size. Commit a final partial batch to the passive archive and reservoir.

  • ind_domain – Shared bounds, or None for unbounded search.

  • seed – Private seed for CMA and uniform reservoir sampling.

  • executor – Optional caller-owned executor with ordered map.

  • on_step – Optional callback receiving the archive, iteration and evaluations.

Returns:

Passive archive and run accounting.

qdpy.algorithms.cma_mega_es(archive, evaluate, *, x0, budget, es_samples=32, es_sigma=0.02, sigma0=0.2, step_size=1.0, batch_size=16, ind_domain=(0, 1), seed=0, executor=None, on_step=None)[source]¶

Run CMA-MEGA (ES) with measured fitness and black-box descriptors.

Evaluate the centre and mirrored perturbations first. Use one rank gradient per output, estimated from the same perturbations. Offer all valid measurements to the archive. Branch along combinations of the normalised gradients and adapt CMA in coefficient space using archive improvement. Advance the centre by rank-weighted gradient ascent. If the budget ends, archive measured partial phases without adapting CMA from a short batch. Discard incomplete mirrored pairs when estimating gradients.

Parameters:
  • archive – Empty, parentless, best-only Grid or CVTGrid.

  • evaluate – Callable taking an immutable real-valued genome and returning a singleton fitness vector and its descriptors.

  • x0 – Initial centre in genome coordinates.

  • budget – Total attempted centre, perturbation and offspring evaluations.

  • es_samples – Even number of perturbations including both signs.

  • es_sigma – Perturbation standard deviation in genome coordinates.

  • sigma0 – Initial CMA step size in gradient coefficient coordinates.

  • step_size – Multiplier for the rank-weighted centre displacement.

  • batch_size – CMA offspring population size.

  • ind_domain – Inclusive bounds, or None for unbounded search.

  • seed – Private seed for perturbations, CMA and restart centres.

  • executor – Optional caller-owned executor with ordered map.

  • on_step – Optional callback receiving the archive, iteration and evaluations.

Returns:

The live archive and counts for each phase.

qdpy

Navigation

Contents:

  • Choose your first QDpy search
  • Run your first searches from PyPI
  • Validation for recommended methods
  • Run a seeded MAP-Elites search
  • Run a seeded NSLC search
  • Choose a QD method
  • Choose a QD algorithm
  • Compare three QD baselines
  • Run reference QD benchmarks
  • Reference QD benchmark results
  • MAP-Elites with Iso+LineDD
  • CMA-MAE with a best-only result grid
  • Dominated Novelty Search
  • Multi-Objective MAP-Elites
  • CMA-MAEGA with analytic gradients
  • Bayesian optimisation of elites
  • Discount Model Search
  • Constrained MAP-Elites with mixed variables
  • Conditional design search with HiGeME
  • Generational Adversarial MAP-Elites
  • Multi-Task Multi-Behavior MAP-Elites
  • Parametric-Task MAP-Elites
  • Learn descriptors from trajectories with AutoQD
  • MOUR-QD for unbounded descriptors
  • Mix-ME for cooperative teams
  • Quality diversity through human feedback
  • Graph-path quality diversity
  • Dynamic MAP-Elites
  • Multiple descriptors and CMA-based search
    • Multi-descriptor MAP-Elites Success
    • Dynamic CMA-ME
    • Density Descent Search with a kernel density estimate
    • CMA-MEGA with ES gradient estimates
    • Reproduce the CPU comparisons
  • Case-wise selection and policy repertoires
  • Case-wise search and policy repertoire benchmarks
  • Conditional designs and task repertoires
  • Conditional designs and task repertoire benchmarks
  • Offline search and diverse plans
  • Offline search and diverse planning benchmarks
  • Compact repertoires and skill composition
  • Compact repertoire benchmarks
  • Deep archives and scenario discovery
  • Deep archives and scenario discovery benchmarks
  • Adaptive exploration, operator selection, and phased diversity
  • Residual regression and focused QD search
  • Learned density, design portfolios, and shared controllers
  • Refine diverse starts and coevolve complementary solutions
  • Guide search with task feedback and local adaptation
  • Build repertoires for classifiers, schedules, and skills
  • Search across age layers, decoders, and learned behaviors
  • Dynamic mutation and learned novelty
  • Encodings, behavior spaces, and design prototypes
  • Editable archives, preference drift, and component credit
  • Composite designs, surrogate niching, and heuristics
  • Composite design and heuristic search benchmarks
  • Solver-backed archives, graph policies, and self-play
  • Solver-backed archives, graph controllers, and parent selection
  • Few-shot priors, basin search, and semantic trade-offs
  • Language models for context rewrites, ideas, and benchmark tasks
  • Changing constraints, structured niches, fidelity, and replay
  • Changing constraints, structured niches, fidelity, and replay
  • Hierarchical archives, counterfactuals, and generative QD
  • Hierarchical archives, counterfactuals, and generative QD
  • Constraint programming, safe exploration, and diffusion search
  • Constraint programming, safe exploration, and diffusion search
  • Sequence search, outcome distributions, and continuing control
  • Sequence search, outcome distributions, and continuing control
  • Counterexamples, design symmetries, and learned policy variation
  • Counterexamples, design symmetries, and learned policy variation
  • Few-shot priors, basin search, and semantic trade-offs
  • Feasible Pareto fronts, analytic gradients, and diverse breeding
  • Feasible fronts, gradients, and diverse breeding
  • Quality thresholds, measured surrogates, and comparable policies
  • Quality thresholds, measured surrogates, and comparable policies
  • Metric archives, peer exchange, and structured variation
  • Metric archives, peer exchange, and structured variation
  • Pareto fronts, noisy elites, and policy gradients
  • Pareto fronts, noisy elites, and policy gradients on CPU
  • Model merging, subset selection, and planning
  • CPU comparisons for model merging, subset selection, and planning
  • Binary swarms, geometric policies, and budgeted archives
  • CPU pilots for binary, geometric, and budgeted search
  • Reference niches, repertoire selection, and model-based skills
  • CPU pilots for reference repertoires and model-based skills
  • Case novelty, linked variation, and discovered skills
  • CPU pilots for case novelty, linked variation, and discovered skills
  • Near-optimal portfolios, novelty, and policy reuse
  • CPU pilots for portfolios, novelty–surprise search, and policy reuse
  • Guided variation, reward coverage, and offline priors
  • Objective voting, structural diversity, and transfer
  • CPU pilots for guided search
  • Batch acquisition, benchmark instances, feasibility, and scenario risk
  • CPU pilots for batch acquisition, benchmark instances, feasibility, and risk
  • Discrete policy search with PPO and MAP-Elites
  • Continuous control with PPO, TD3, and PGA-MAP-Elites
  • Batched neural MAP-Elites
  • Quality-diversity policy gradient
  • Descriptor-conditioned MAP-Elites
  • Quality-Diversity Actor-Critic
  • Discrete QDAC variants
  • Control evaluation with ask and tell
  • Run a QDpy seed sweep with Rundra
  • Evaluate a MAP-Elites search with Ray
  • Replay a saved search
  • Save and resume a portable run
  • Compare multi-seed runs
  • Plot archive geometry and evolution
  • Genealogy and stepping stones
  • MC-AURORA with learned descriptors
  • MAP-Elites with noisy evaluations
  • Audit a noisy archive
  • Shared noisy Rastrigin validation
  • How QDpy runs a search
  • Core Python API
  • QDpy source reference
  • QDpy release notes
  • Run the release preflight
  • Benchmark search throughput
  • QDpy parallelism benchmarks
  • Compare MAP-Elites, CVT-MAP-Elites, and CMA-MAE
  • Shared QD benchmark panels
  • Modern QD pilot results
  • Differentiable, Bayesian, and high-dimensional QD pilots
  • Constrained search and GAME pilots
  • Fixed-task and dynamic QD pilots
  • Local Pareto, team, feedback, graph, and Bayesian QD pilots
  • Joint population optimization with SQUAD
  • Segment crossover in MAP-Elites
  • Learned competition rules
  • Share policy representations with RefQD
  • Co-design bodies and controllers with Pollination
  • Population objectives, learned selection, and policy transfer
  • Adapt a repertoire with M-BOA
  • Two-objective MO-CMA-MAE
  • Gradient-informed search on categorical genomes
  • Behavior-regulated policy gradients
  • Return to promising states with Go-Explore
  • Repertoire adaptation, gradient search, and exploration benchmarks
  • Multifidelity search, adaptive grids, and curricula
  • Train controllers for objective trade-offs
  • Multifidelity search, adaptive grids, and curricula benchmarks
  • Scalable covariance search and learned genome variation
  • Gradient, imitation, and dynamics-aware policy search
  • Scalable emitters and continuous policy search benchmarks
  • Targeted search, balanced designs, and adversarial tournaments
  • SAC populations and search over frozen policy latents
  • Targeted search and policy population benchmarks
  • Interactive search, scheduling rules, and repertoire reuse
  • Distill a repertoire with the Quality-Diversity Transformer
  • Interactive and repertoire workflow benchmarks
  • Symbolic regression with MAP-Elites
  • Symbolic regression benchmark
  • Parent selection, surrogate search, and diverse skills
  • Parent selection, surrogate search, and skill pilots
  • Archive repair, ensembles, and policy reuse
  • Archive repair, ensembles, and policy reuse benchmarks
  • Differential evolution, mixed variables, and learned preferences
  • Differential evolution, mixed variables, and learned preferences
  • Solver repair, repertoire selection, and cross-component search
  • Solver repair, repertoire selection, and cross-component search
  • Offline search, learned niches, and cooperating policy parts
  • Offline search, learned niches, and cooperating policies benchmarks
  • Trace-Elites, MEMES, and asymmetric islands
  • Trace-Elites, MEMES, and AIM benchmarks
  • Deep QD, Voronoi-Elites, and occupancy CVT-MAP-Elites
  • Deep QD, Voronoi-Elites, and occupancy benchmarks
  • Sparse rewards, interpretable trees, and population diversity
  • Sparse rewards, decision trees, and determinant diversity
  • Ordered trajectories and model-guided variation
  • Ordered trajectories and model-guided variation

Related Topics

  • Documentation overview
    • Previous: Dynamic MAP-Elites
    • Next: Case-wise selection and policy repertoires
©2018, Leo Cazenille. | Powered by Sphinx 9.2.0 & Alabaster 1.0.0 | Page source