Lenia Explained
Lenia is a family of cellular automata created by Bert Wang-Chak Chan.[1] [2] [3] It is intended to be a continuous generalization of Conway's Game of Life, with continuous states, space and time. As a consequence of its continuous, high-resolution domain, the complex autonomous patterns ("lifeforms" or "spaceships") generated in Lenia are described as differing from those appearing in other cellular automata, being "geometric, metameric, fuzzy, resilient, adaptive, and rule-generic".
Lenia won the 2018 Virtual Creatures Contest at the Genetic and Evolutionary Computation Conference in Kyoto,[4] an honorable mention for the ALIFE Art Award at ALIFE 2018 in Tokyo,[5] and Outstanding Publication of 2019 by the International Society for Artificial Life (ISAL).[6]
Rules
Iterative updates
Let
be the
lattice or
grid containing a set of states
. Like many cellular automata, Lenia is updated iteratively; each output state is a
pure function of the previous state, such that
where
is the initial state and
is the
global rule, representing the application of the
local rule over every site
. Thus
.
If the simulation is advanced by
at each timestep, then the time resolution
.
State sets
Let
with maximum
. This is the
state set of the automaton and characterizes the possible states that may be found at each site. Larger
correspond to higher
state resolutions in the simulation. Many cellular automata use the lowest possible state resolution, i.e.
. Lenia allows for much higher resolutions. Note that the actual value at each site is not in
but rather an integer multiple of
; therefore we have
for all
. For example, given
,
At(x)\in\{0,0.25,0.5,0.75,1\}
.
Neighborhoods
Mathematically, neighborhoods like those in Game of Life may be represented using a set of position vectors in
. For the classic
Moore neighborhood used by Game of Life, for instance,
; i.e. a square of size 3 centered on every site.
In Lenia's case, the neighborhood is instead a ball of radius
centered on a site,
l{N}=\{x\inl{L}:\lVertx\rVert2\leqR\}
, which may include the original site itself.
Note that the neighborhood vectors are not the absolute position of the elements, but rather a set of relative positions (deltas) with respect to any given site.
Local rule
There are discrete and continuous variants of Lenia. Let
be a vector in
within
representing the position of a given site, and
be the set of sites neighboring
. Both variations comprise two stages:
- Using a convolution kernel
to compute the
potential distribution
.
- Using a growth mapping
to compute the final
growth distribution
.Once
is computed, it is scaled by the chosen time resolution
and added to the original state value:
Here, the clip function is defined by
\operatorname{clip}(u,a,b):=min(max(u,a),b)
.
The local rules are defined as follows for discrete and continuous Lenia:
Kernel generation
There are many ways to generate the convolution kernel
. The final kernel is the composition of a
kernel shell
and a
kernel skeleton
.
For the kernel shell
, Chan gives several functions that are defined
radially. Kernel shell functions are
unimodal and subject to the constraint
(and typically
as well). Example kernel functions include:
Here,
is the
indicator function.
Once the kernel shell has been defined, the kernel skeleton
is used to expand it and compute the actual values of the kernel by transforming the shell into a series of
concentric rings. The height of each ring is controlled by a
kernel peak vector
\beta=(\beta1,\beta2,\ldots,\betaB)\in[0,1]B
, where
is the
rank of the parameter vector. Then the kernel skeleton
is defined as
The final kernel
is therefore
such that
is normalized to have an element sum of
and
(for
conservation of mass).
} \displaystyle K_S \, \Delta x^2 in the discrete case, and
in the continuous case.
Growth mappings
The growth mapping
, which is analogous to an
activation function, may be any function that is unimodal,
nonmonotonic, and accepts parameters
. Examples include
where
is a potential value drawn from
.
Game of Life
The Game of Life may be regarded as a special case of discrete Lenia with
. In this case, the kernel would be rectangular, with the function