.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/06_visual/plot_03_artificial_life.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_03_artificial_life.py: Artificial life: biomorphs and L-system plants ============================================== Richard Dawkins' biomorphs (1986) — recursive trees whose genes set branch lengths and angles — started interactive evolution; the user acts as the selective environment. Lindenmayer systems (Prusinkiewicz and Lindenmayer, 1990) rewrite strings into plant architectures; here the genes set the branching angle, the rewriting rules and the colours. .. GENERATED FROM PYTHON SOURCE LINES 13-15 Breeding plants with comments ----------------------------- .. GENERATED FROM PYTHON SOURCE LINES 15-28 .. code-block:: Python import matplotlib.pyplot as plt import easyiec as ei from easyiec.problems import Biomorph, LSystemPlant from easyiec.strategies import InteractiveGA, Watchmaker problem = LSystemPlant() print(sorted(problem.semantic_axes)) user = ei.SimulatedUser(problem, target="random", noise=0.03, comments=0.7, seed=4) result = ei.run(problem, InteractiveGA(pop_size=8), user, generations=10, seed=4) print([r.feedback.comment for r in result.log.records if r.feedback.comment]) ei.viz.plot_history(result.log, problem, steps=[0, 4, 9], max_items=8, size=1.0) .. image-sg:: /auto_examples/06_visual/images/sphx_glr_plot_03_artificial_life_001.png :alt: plot 03 artificial life :srcset: /auto_examples/06_visual/images/sphx_glr_plot_03_artificial_life_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none ['bushier', 'denser', 'greener', 'more leaves', 'more upright', 'thicker'] ['much more upright', 'much denser', 'much more leaves', 'much thicker', 'much thicker', 'much thicker', 'more upright', 'more upright', 'thicker', 'more leaves']
.. GENERATED FROM PYTHON SOURCE LINES 29-31 Biomorphs in the Watchmaker scheme ---------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 31-36 .. code-block:: Python problem = Biomorph() user = ei.SimulatedUser(problem, target="random", noise=0.03, seed=9) res = ei.run(problem, Watchmaker(pop_size=9), user, generations=20, seed=9) ei.viz.plot_lineage(res.log, problem, size=0.9) plt.show() .. image-sg:: /auto_examples/06_visual/images/sphx_glr_plot_03_artificial_life_002.png :alt: g0 init, g0 mutation, g1 mutation, g2 mutation, g3 mutation, g7 mutation, g10 mutation, g11 mutation, g13 mutation, g15 mutation, g16 mutation, g17 mutation, g18 mutation, g19 mutation :srcset: /auto_examples/06_visual/images/sphx_glr_plot_03_artificial_life_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 12.608 seconds) .. _sphx_glr_download_auto_examples_06_visual_plot_03_artificial_life.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_03_artificial_life.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_03_artificial_life.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_03_artificial_life.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_03_artificial_life.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_