.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/06_visual/plot_01_fractals.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_01_fractals.py: Fractals: Julia sets, strange attractors, IFS and flames ======================================================== Fractals are the classical playground of interactive evolution (Sims, 1991; Ventrella's and Draves' electric sheep): small genomes, endless variety, and a quality — beauty — that only a viewer can judge. easyiec has four families: Julia sets of :math:`z\mapsto z^2+c` with smooth colouring, Clifford and de Jong attractors, iterated function systems (Barnsley, 1988) and fractal flames with nonlinear variations (Draves and Reckase, 2003). .. GENERATED FROM PYTHON SOURCE LINES 14-16 One random gallery per family ----------------------------- .. GENERATED FROM PYTHON SOURCE LINES 16-33 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np import easyiec as ei from easyiec.problems import FractalFlame, IFSFractal, JuliaSet, StrangeAttractor from easyiec.strategies import InteractiveGA rng = np.random.default_rng(4) families = [JuliaSet(), StrangeAttractor(), IFSFractal(), FractalFlame()] 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_01_fractals_001.png :alt: Julia set, Strange attractor, Iterated function system, Fractal flame :srcset: /auto_examples/06_visual/images/sphx_glr_plot_01_fractals_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 34-38 Breeding attractors towards a mood ---------------------------------- A simulated viewer whose taste is a set of target image features: bright, colourful and fairly complex. .. GENERATED FROM PYTHON SOURCE LINES 38-44 .. code-block:: Python problem = StrangeAttractor() user = ei.SimulatedUser(problem, target={"brightness": 0.45, "colorfulness": 0.6, "complexity": 0.7}, noise=0.03, seed=1) result = ei.run(problem, InteractiveGA(pop_size=9), user, generations=12, seed=1) ei.viz.plot_history(result.log, problem, steps=[0, 5, 11], size=1.0) plt.show() .. image-sg:: /auto_examples/06_visual/images/sphx_glr_plot_01_fractals_002.png :alt: plot 01 fractals :srcset: /auto_examples/06_visual/images/sphx_glr_plot_01_fractals_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.834 seconds) .. _sphx_glr_download_auto_examples_06_visual_plot_01_fractals.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_01_fractals.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_01_fractals.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_01_fractals.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_01_fractals.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_