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.

Breeding plants with comments#

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)
plot 03 artificial life
['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']

<Figure size 800x320 with 24 Axes>

Biomorphs in the Watchmaker scheme#

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()
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

Total running time of the script: (0 minutes 12.608 seconds)

Gallery generated by Sphinx-Gallery