.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/02_algorithms/plot_04_map_elites.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_02_algorithms_plot_04_map_elites.py: Interactive MAP-Elites: a diverse archive instead of one winner =============================================================== Designers often want a *repertoire* of good, different solutions rather than a single optimum. MAP-Elites (Mouret and Clune, 2015) keeps one elite per cell of a behaviour grid. In the interactive version the evaluator only decides duels between a newcomer and the incumbent elite of its cell; empty cells are filled without asking, so effort concentrates where a decision is really needed. .. GENERATED FROM PYTHON SOURCE LINES 13-17 An archive of Julia sets ------------------------ The two behaviour descriptors are image features: the entropy of the grey-level histogram and the colourfulness of Hasler and Süsstrunk (2003). .. GENERATED FROM PYTHON SOURCE LINES 17-29 .. code-block:: Python import matplotlib.pyplot as plt import easyiec as ei from easyiec.problems import JuliaSet from easyiec.strategies import InteractiveMAPElites problem = JuliaSet() strategy = InteractiveMAPElites(bins=5, batch=10, n_init=20, max_pairs=6) user = ei.SimulatedUser(problem, target="random", noise=0.05, seed=2) result = ei.run(problem, strategy, user, generations=25, seed=2) print(f"archive coverage {strategy.coverage():.0%}, {result.summary()['queries']} queries, " f"{result.summary()['items']} items shown") .. rst-class:: sphx-glr-script-out .. code-block:: none archive coverage 52%, 25 queries, 221 items shown .. GENERATED FROM PYTHON SOURCE LINES 30-33 The archive ----------- Colour: the ground-truth utility of each elite. .. GENERATED FROM PYTHON SOURCE LINES 33-35 .. code-block:: Python ei.viz.plot_strategy_state(strategy) .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_04_map_elites_001.png :alt: MAP-Elites archive (52 % filled) :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_04_map_elites_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 36-39 The repertoire -------------- The elites ordered by cell; each is the best the user has seen in its niche. .. GENERATED FROM PYTHON SOURCE LINES 39-43 .. code-block:: Python elites = [strategy.archive[c] for c in sorted(strategy.archive)] ei.viz.plot_gallery(problem, elites, ncols=8, size=1.0, labels=[f"{c[0]},{c[1]}" for c in sorted(strategy.archive)]) plt.show() .. image-sg:: /auto_examples/02_algorithms/images/sphx_glr_plot_04_map_elites_002.png :alt: 0,0, 0,1, 1,0, 1,1, 2,0, 2,1, 2,2, 3,0, 3,1, 3,2, 4,0, 4,1, 4,2 :srcset: /auto_examples/02_algorithms/images/sphx_glr_plot_04_map_elites_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.626 seconds) .. _sphx_glr_download_auto_examples_02_algorithms_plot_04_map_elites.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/ComplexSystemsIntelligence/easyiec/main?urlpath=lab/tree/notebooks/auto_examples/02_algorithms/plot_04_map_elites.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_04_map_elites.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_04_map_elites.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_04_map_elites.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_