.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/06_visual/plot_02_generative_art.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_06_visual_plot_02_generative_art.py: Generative art: CPPNs, harmonographs, superformula and cellular automata ======================================================================== Compositional pattern-producing networks (Stanley, 2007) paint by evaluating a small network at every pixel and gave rise to Picbreeder (Secretan et al., 2011). Harmonographs draw the trace of damped pendulums; the superformula of Gielis (2003) generalizes the superellipse to natural shapes; elementary and totalistic cellular automata (Wolfram, 1983) grow textures from local rules. .. GENERATED FROM PYTHON SOURCE LINES 13-15 The four families ----------------- .. GENERATED FROM PYTHON SOURCE LINES 15-32 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import easyiec as ei from easyiec.problems import CellularAutomaton, CPPNArt, Harmonograph, SuperShape from easyiec.strategies import InteractiveMAPElites rng = np.random.default_rng(2) families = [CPPNArt(), Harmonograph(), SuperShape(), CellularAutomaton()] fig, axes = plt.subplots(4, 6, figsize=(10, 7)) for row, p in zip(axes, families): for ax in row: ax.imshow(p.to_image(p.random(rng), 140)) ax.axis("off") row[0].set_title(p.title, fontsize=8, loc="left") fig.tight_layout() .. image-sg:: /auto_examples/06_visual/images/sphx_glr_plot_02_generative_art_001.png :alt: CPPN image, Harmonograph, Superformula design, Cellular automaton :srcset: /auto_examples/06_visual/images/sphx_glr_plot_02_generative_art_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 33-37 A repertoire of CPPN images --------------------------- MAP-Elites over symmetry and colourfulness: one elite per niche, decided in duels by a simulated viewer. .. GENERATED FROM PYTHON SOURCE LINES 37-44 .. code-block:: Python problem = CPPNArt() strategy = InteractiveMAPElites(bins=4, batch=12, n_init=24) user = ei.SimulatedUser(problem, target="random", noise=0.05, seed=3) res = ei.run(problem, strategy, user, generations=20, seed=3) elites = [strategy.archive[c] for c in sorted(strategy.archive)] ei.viz.plot_gallery(problem, elites, ncols=8, size=1.0) plt.show() .. image-sg:: /auto_examples/06_visual/images/sphx_glr_plot_02_generative_art_002.png :alt: #55, #67, #92, #2, #120, #119, #18, #69, #104, #101, #98, #115, #83, #53 :srcset: /auto_examples/06_visual/images/sphx_glr_plot_02_generative_art_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.467 seconds) .. _sphx_glr_download_auto_examples_06_visual_plot_02_generative_art.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/06_visual/plot_02_generative_art.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_generative_art.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_generative_art.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_generative_art.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_