Deep QD, Voronoi-Elites, and occupancy CVT-MAP-Elites

Use Deep QD to compare feasible design families within a cell. Use Voronoi-Elites when the result must fit a fixed archive capacity and descriptors are available. Use occupancy CVT-MAP-Elites when each evaluation provides a trajectory. All three run with the base installation. Benchmark settings and results

Deep QD for conditional designs

Deep QD keeps one feasible elite per configuration in each descriptor cell. A configuration can activate different variables and require different constraint residuals. The optimiser reuses HiGeME’s hidden genes and mutation rules. It draws parents from all retained configuration elites.

from qdpy.algorithms import ConditionalConfiguration, DeepQD, IntegerVariable, RealVariable
from qdpy.containers import Grid

grid = Grid(shape=8, features_domain=((0., 1.),), fitness_domain=((0., 2.),),
            fitness_weights=(1.,))
configs = (
    ConditionalConfiguration({"layout": "sheet"}, ("span",), ("load",)),
    ConditionalConfiguration({"layout": "ribbed"}, ("span", "ribs"), ("stiffness",)),
)
search = DeepQD(grid, 160, {"span": RealVariable(0., 1.), "ribs": IntegerVariable(1, 4)},
                configurations=configs, batch_size=8, seed=7)

def evaluate(ind):
    design = search.decode(ind)
    span = design["span"]
    if design["layout"] == "sheet":
        return (1.7 - .2 * span,), (span,), {"load": span - .85}
    ribs = design["ribs"]
    return (1.45 + .1 * span - .02 * (ribs - 2)**2,), (span,), {"stiffness": .5 - .3 * ribs}

search.optimise(evaluate)
alternatives = search.deep_archive
options = [search.decode(ind) for ind in alternatives.cell_elites((4,)).values()]
print(grid.filled_bins, alternatives.configuration_counts, options)

The supplied native grid contains the best elite in each occupied cell across configurations. Pass an empty parentless Grid or CVTGrid with capacity for every cell. Keep its objective direction fixed throughout the run. The evaluator returns active residuals in scores. Every attempted evaluation spends budget. A candidate whose active residual is positive enters neither archive.

len(search.deep_archive) counts cell/configuration pairs. mean_configurations divides by the number of occupied cells. cell_elites() takes a native tuple cell index and returns configuration-indexed alternatives. To plot one configuration, use plot_archive(search.deep_archive.configuration_grid(1)). The returned layer is a separate native grid. Standard QDpy callbacks and search.best() use the per-cell best projection.

This workflow implements the layered archive from Baraton et al. with black-box HiGeME proposals. The paper couples the archive to Bayesian acquisition. Deep QD paper

Voronoi-Elites

Supply a capacity and a descriptor domain. Once the archive fills, each offer creates a set containing the incumbents and the candidate. The closest Euclidean descriptor pair competes on quality. The lower quality member leaves, whether it is an incumbent or the candidate. Equal fitness keeps the older member of that pair.

from qdpy.algorithms import VoronoiElites
from qdpy.containers import VoronoiArchive

archive = VoronoiArchive(capacity=12, features_domain=((0., 1.), (0., 1.)),
                         fitness_domain=((0., 2.),), storage_type="orderedset")
search = VoronoiElites(archive, 180, 3, batch_size=6, seed=7)

def evaluate(ind):
    x, y, z = ind
    return (1.8 - (z - .35)**2,), (x, y)

search.optimise(evaluate)
print(search.nb_evaluations, len(archive), archive.best.fitness.values)

The search mutates uniformly sampled elites with Gaussian noise and clips offspring to the genome bounds. Parallel batches apply results one at a time in proposal order. Choose descriptor units so Euclidean distance has the intended meaning. To minimize, pass fitness_weights=(-1.,) to the archive. An improved measurement of an existing genome replaces that genome directly.

An offer at capacity computes pairwise distances across the current archive and the candidate. Its cost grows quadratically with archive size. Coverage and QD scores across methods can use a common reporting grid, while nearest-neighbor distances describe the original repertoire. Hagg et al., Voronoi-Elites

Occupancy CVT-MAP-Elites

Build state bins from reference observations or pass their centroids directly. Each trajectory row enters its nearest state bin. Its normalized visit counts form a descriptor in the probability simplex. The second tessellation defines the archive cells within that simplex.

import numpy as np

from qdpy.algorithms import OccupancyHistogram, OccupancyMAPElites

reference = np.random.default_rng(7).random((128, 2))
histogram = OccupancyHistogram.fit(reference, bins=8, seed=7)
archive = histogram.make_archive(24, fitness_domain=(0., 2.), seed=7)
search = OccupancyMAPElites(archive, 160, 3, histogram=histogram, batch_size=8, seed=7)

def evaluate(ind):
    x, y, timing = ind
    progress = np.linspace(0., 1., 24)[:, None]**(.5 + timing)
    trajectory = np.array([.1, .2]) + progress * (np.array([x, y]) - [.1, .2])
    return 1.8 - (x - .85)**2, trajectory

search.optimise(evaluate)
print(search.nb_evaluations, archive.filled_bins, archive.best.scores["occupancy_steps"])

Provide a finite nonempty matrix of states or state-action rows per rollout. Keep the columns and scaling the same across calibration and search. The default repertoire centroids come from a uniform Dirichlet draw. Use the centroids argument to supply fixed histograms instead. One successful evaluator call supplies both the score and the trajectory. Batch and executor feedback follow proposal order. For manual ask/tell, encode the trajectory with histogram.encode() before passing the descriptor to tell_batch().

Policies with the same endpoint can occupy different cells because they spend different fractions of time in different state bins. Permuting the same observations preserves their descriptor. Compare trajectory methods on a shared physical reporting grid since their learned or histogram cells describe different things.

Feiden and Garcke, GECCO 2025.