Objective voting, structural diversity, and transfer

Run the five examples with the base QDpy install.

python examples/objective_voting_transfer.py --seed 42
python examples/objective_voting_transfer.py --case transfer --seed 42

Each search owns its random streams. Evaluators receive a genome and an integer seed, so an evaluator can use a local random generator. Return None for a failed evaluation that should consume an attempt. Call run() again with a budget for additional work and read stats for cumulative counts. Genomes are tuples whose elements should be immutable.

MOVE

Use qdpy.algorithms.MOVE when you have many objectives and want specialists for combinations of them. Each generation produces one offspring per slot from a snapshot of the champions. An offspring can replace any champion by strictly improving more than half of that slot’s objectives. An objective can get worse when enough of the others improve. Scores can have different units. Set maximize to control direction for each objective.

from qdpy.algorithms import MOVE

search = MOVE(
    3,
    sample=lambda rng: (float(rng.random()),),
    mutate=lambda genome, rng: (float(rng.beta(2, 2)),),
    subsets=((0, 1, 2), (0,), (1,)),
)

def evaluate(genome, seed):
    x, = genome
    return (x, 1 - x, 1 - (x - 0.5) ** 2)

search.run(evaluate, 60)
for objectives, champion in zip(search.subsets, search.champions):
    print(objectives, champion.genome, champion.objectives)

If you omit subsets, QDpy draws subsets independently and keeps their slot order. Duplicate subsets can occur. Inspect parent_slot and parent_id on retained entries to see where their proposals came from. goal_switches counts cross-slot replacements. One child can contribute several events. The example compares MOVE with CMOEA on a shared panel of objective subsets. Dean2023.

Diversity-Enhancing NSGA-II

qdpy.algorithms.DiversityEnhancingNSGAII accepts a callback over two behavior objects. The example returns the selected components of a design as a frozenset and uses the size of the symmetric difference as the distance. Return (objectives, behavior) from the evaluator. Keep the behavior immutable. Mark minimization objectives with maximize=False or supply a direction for each objective.

Mean dissimilarity becomes an additional Pareto objective. By default it also orders survivors within a front. To use a different crowding measure, pass crowding_distance(entry_a, entry_b) and read the genome or behavior from each entry. Use standard_crowding=True to measure the effect of ordinary objective-space crowding while retaining the diversity objective. Pairwise dissimilarity work grows quadratically with population size. Read the survivors from population. Komosinski2025.

EDO-CS

Pass a numeric policy vector to the evaluator of qdpy.algorithms.EDOCS. Return one reward and a descriptor, such as a final position after a rollout. The search reclusters the measured archive each round. It chooses the highest-return policy and one of the top candidates from each other cluster, then applies a raw Gaussian evolution strategy to each representative. A UCB bandit uses return gains to choose the weight on descriptor novelty. Use a one-element weights tuple for a fixed-weight control.

Each round costs one final policy evaluation plus probes * es_steps perturbation evaluations per representative. The number of distinct descriptors can reduce the number of clusters. After initialization, next_round_cost gives the reservation for the following round. The runner can leave budget unused when the next round will not fit. Read both kinds of attempted evaluation in stats. The supplied example uses fixed-cost analytic rollouts and compares equal call counts with DvD-ES. For variable-length simulator episodes, record environment steps in the evaluator and report those counts too. Wang2022.

Cosine-kernel MAP-Elites for ensembles

Pass supervised training targets to qdpy.algorithms.CosineMAPElites. The evaluator returns a scalar fitness and predictions for those same observations in the same order. The default minimizes the scalar fitness. Out-of-fold predictions let a fitted learner compete using estimates from training data that it did not fit directly.

After each batch, the search keeps the top half of the merged candidate pool by default. It forms two references per retained predictor by moving from the target toward that prediction and by the same amount in the opposite direction. It fits cosine-kernel PCA to those references and rebuilds the Grid using the resulting coordinates. QDpy computes the same projection with SVD on centered unit vectors. Cached predictions allow old elites to move without a fresh evaluation. The caller supplies the representation and variation. The example evolves a small numeric regressor with optional crossover.

archive contains the latest grid, whose coordinates can change across batches. Compare held-out ensembles by predicting with search.predict(predict_on_holdout, size=5). The prediction callback takes one model genome at a time. The example reports mean squared error for equal ensemble sizes and uses the same evaluation log to construct its quality-only comparison. Zhang2023.

Transferability-based Behavioral Repertoire Evolution

Use qdpy.algorithms.TBREvolution with separate source and target evaluators. The source returns (quality, descriptor) and the target returns a descriptor in the same coordinates. The algorithm fits a linear nu-SVR to the Euclidean errors it observes. Simulated quality, novelty, and predicted transferability guide breeding through local ranks.

Repertoire replacement follows the transfer threshold priority described in section 3.3 of the paper. If both predicted errors are within the threshold, the higher-quality candidate wins. When either is outside it, the lower predicted error wins. Before any successful transfer, the model assigns zero error. With one successful transfer it uses the single observed error as a constant.

search.run(simulate, 192, evaluate_target=evaluate_target, target_budget=6)
print(search.stats.simulation_evaluations, search.stats.target_evaluations)
print(search.predict_error(row.descriptor for row in search.archive))

Treat predicted error and measured error separately in reports. transfers contains the paired measurements used for fitting. For an independent audit, choose a common selection rule and test final repertoires using fresh target calls. The example uses two analytic systems with a position-dependent discrepancy and counts its target audits separately. Cully2016.

CPU pilot

The example ran on seeds 0 through 7. Both sides used 360 candidate calls for voting, 240 for structural search, and 268 for clustered policy search. The ensemble experiment used 288 evaluations and the same number of retained models on both sides. Each transfer search used 192 simulator calls and eight target audit calls. The calibrated method also used six target calls during search.

Measurement, averaged across seeds

Method

Comparison

MOVE mean best score per objective

0.6870

0.7608 (CMOEA)

DE-NSGA-II mean set dissimilarity

5.9958

6.0146 (objective-space crowding)

EDO-CS best return

0.9105

0.9443 (DvD-ES)

Cosine-kernel ensemble held-out MSE

0.04570

0.04581 (fitness-ranked models from the same search)

TBR mean held-out descriptor error

0.2241

0.2255 (simulation-only search)

TBR share of audited entries within the error threshold

0.547

0.578 (simulation-only search)

Measure transfer coverage on the target coordinates. The calibrated repertoire occupied an average of 6.875 of 25 possible cells in the audit. The simulation-only repertoire occupied 7.125. The pilot verifies that all five workflows complete and produce the expected accounting. It uses small analytic problems for fast CPU runs.