Compare three QD baselines ========================== MAP-Elites, CVT-MAP-Elites, and CMA-MAE can all use an evaluator that returns a scalar fitness and a descriptor vector. Use the same evaluator, genome bounds, objective direction, and budget to see what changes when you choose a different archive or search operator. From a QDpy checkout, install the CMA extra and run the small comparison. Use ``uv pip install ".[cma]"`` if your virtual environment uses uv. .. code-block:: sh python -m pip install ".[cma]" python examples/baseline_comparison.py --seeds 11 --budget 65 \ --report-every 32 --audit-samples 2 \ --output build/baselines/smoke.json --plot build/baselines/smoke.png Pass ``--methods map cvt`` to use the base installation or ``--tasks rastrigin`` to run only the deterministic task. Each search evaluates one eight-dimensional genome per call. The noisy task adds noise to both fitness and descriptors. Use ``--tasks planar-arm --compare-geometry`` to compute descriptors from the arm's end-effector and evaluate the same elites on two reporting grids. The original metrics use the rectangular grid. The additional ``voronoi`` fields use a separately fitted set of 64 centroids. The held-out evaluations are reused across both geometries. Pass ``--voronoi-plot`` with an output path to save those curves. Run the same evaluator with each method --------------------------------------- The example supplies both the evaluator and the three constructors. From the checkout root, run this Python code to compare the methods and save each native archive and run manifest. Use a fresh output directory for each run. .. code-block:: python from examples.baseline_comparison import evaluate, fit_centroids, make_search from qdpy.simple import run seed = 11 centroids = fit_centroids() for method in ("map", "cvt", "cma-mae"): search = make_search(method, budget=64, seed=seed, centroids=centroids) result = run( search, evaluate, seed=seed, output_dir=f"build/baseline-archives/{method}", configuration={"method": method, "task": "rastrigin", "budget": 64}, ) print(method, result.evaluations, result.best.fitness.values, result.manifest_path) The ``map`` recipe uses :func:`qdpy.simple.map_elites` and one elite per rectangular cell. The ``cvt`` recipe uses the same polynomial variation with a :class:`qdpy.containers.CVTGrid`. Reuse the fitted centroids across seeds to hold the search geometry fixed. The ``cma-mae`` recipe uses :class:`qdpy.algorithms.CMAMAE` on the rectangular grid. It updates a covariance emitter using improvements over cell thresholds. In all three recipes, ``result.archive`` is the native best-only result archive. Read the comparison ------------------- In the benchmark JSON, each trial has a ``curve`` and an ``audit``. The curve measures coverage and QD score after projecting current elites from all three methods onto the same rectangular grid. With noisy descriptors, even a full search archive can cover fewer cells when audited. The audit remeasures every final elite, averages its fitness and descriptor coordinates, and builds a fresh reporting grid. The audit call count can vary with the number of retained elites. Its evaluations are tracked separately from search. See :doc:`baseline_comparison_benchmarks` for the full settings, plots, and raw results. See :doc:`run_results` for the JSON manifest and archive that ``run()`` saves.