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.

The four families#

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()
CPPN image, Harmonograph, Superformula design, Cellular automaton

A repertoire of CPPN images#

MAP-Elites over symmetry and colourfulness: one elite per niche, decided in duels by a simulated viewer.

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()
#55, #67, #92, #2, #120, #119, #18, #69, #104, #101, #98, #115, #83, #53

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

Gallery generated by Sphinx-Gallery