Dynamic MAP-Elites ================== Refresh elites when the same genome can have a different objective or descriptor later in the run. The example changes the centre of a sphere and shifts its two descriptors at ticks 128 and 256. Run from the repository root with the :ref:`base package `. .. code-block:: sh python examples/dynamic_map_elites.py .. literalinclude:: ../examples/dynamic_map_elites.py :language: python Pass an empty, parentless, best-only grid to :func:`qdpy.algorithms.dynamic_map_elites`. The evaluator receives an immutable genome and a tick, which is the number of attempts already spent when a search step starts. Return ``((fitness,), descriptors)``. An offspring and its refresh calls use the same tick. With ``refresh="local"``, the runner reevaluates an occupied destination before comparing the offspring with its incumbent. If the incumbent's descriptors move it to another occupied cell, that cell's incumbent is also reevaluated. The runner follows the original grid and visits each incumbent once per step, including when moves form a cycle. Once the measurements are ready, it reinserts the refreshed entries in original archive order and offers the offspring last. Existing entries win ties at each insertion. The budget covers both offspring and refresh attempts. If the runner cannot finish a refresh, it leaves the grid as it was at the start of that step and increments ``incomplete_updates``. The calls already made still count. A detected change identifies a mismatch with the stored measurement. Several stale cells can reveal the same environmental shift on different ticks. Use a deterministic evaluator at a given tick, since the runner compares stored and fresh values exactly. The example independently reevaluates the final grid at tick 384. Its freshness is the share of entries whose stored values are still correct. The corrected QD score and coverage use the descriptors measured at that tick. With seed 42, the search spent 203 attempts on offspring and 181 on refreshes. The audit used 50 additional calls and measured 50.0% freshness and 40.6% corrected coverage. QDpy uses the replacee refresh procedure from `Gallotta et al. (2024) `__, with sequential Gaussian proposals and age-biased parent selection. See :doc:`fixed_dynamic_qd_benchmarks` for comparisons with ``refresh="all"`` and ``refresh="none"``.