Two-objective MO-CMA-MAE

MO-CMA-MAE adapts a covariance search using local hypervolume improvement. Give it two objective directions and a reference that every valid candidate weakly dominates. In this example, both objectives are losses. The common reference is worse than every valid loss in each coordinate.

pip install "qdpy[cma]"
from qdpy.algorithms import MOCMAMAE
from qdpy.containers import ParetoGrid

archive = ParetoGrid(
    shape=(6,), max_items_per_bin=16,
    features_domain=((0, 1),), fitness_domain=((0, 2), (0, 2)),
    fitness_weights=(-1.0, -1.0),
)
reference = (2.0, 2.0)

def evaluate(candidate):
    x, y, behavior = candidate
    return ((x - .2)**2 + (y - .2)**2,
            (x - .8)**2 + (y - .8)**2), (behavior,)

search = MOCMAMAE(archive, budget=128, x0=[.5, .5, .5],
                  sigma0=.25, batch_size=16, reference=reference,
                  ind_domain=(0, 1), learning_rate=.1, seed=11)
search.optimise(evaluate)
print(archive.qd_hypervolume(reference))
print(search.threshold_front((2,)))

The search applies improvements in proposal order. It translates the reference to the origin and flips minimized axes before computing hypervolume. An improvement adds a discounted objective vector to the cell’s threshold front. learning_rate is a fraction of the hypervolume increment. The reporting grid stores the evaluated objectives. It uses the usual ParetoGrid capacity and seeded random truncation if a front fills.

This implementation uses one CMA emitter and the paper’s dynamic threshold fronts, whose size can grow. Use ask_batch and tell_batch to manage evaluation directly. Pass one result per proposal in the same order. The final partial generation can improve the archive and thresholds. Full generations provide covariance feedback. See Repertoire adaptation, gradient search, and exploration benchmarks for a common-grid comparison with MOME and MOUR-QD.

Zhao and Nikolaidis, Multi-Objective Covariance Matrix Adaptation MAP-Annealing, GECCO 2025.