CAShape Generation
CAShape Generation
Clustering?
1 Introduction
Cellular automata with clustering (CCA) is a hybrid form of cellular automata
(CA), where adjacent cells with the same attributes are allowed to join into a
super-cell named a cluster [1, 9, 10]. The cluster information is stored extraneous
to the cellular automaton itself. When a cell in a cluster is updated via the CCA
rule, all the cells in the cluster are synchronously updated to the same attribute
value. Both Adams [1] and Smal [9] showed that CCA typically require fewer
time evolutions to achieve a goal than is the case with CA.
In this article, we consider the application of CCA to shape generation. The
use of CA in shape generation has been considered before [3, 4, 8, 12], but due
to the single cell model, the shape formation is not easy to achieve. Delormea
et al. [4], for example, used signals in grouped cellular automata based on the
mathematical definition of the shapes, whilst Chavoya and Duthen [3] evolved
a shape from a single cell in a 2D grid, by using genetic algorithms to update
lookup tables for the CA. In the case of CCA, we show that simple geometric
shapes such as circles or squares can quite easily be explicitly forced in CCA. The
CCA model used for the shape formation is the standard Lumer and Faieta (LF)
ant sorting model [7]. In the LF model, an ant picks up a single object, and drops
a single object. The CCA model is identical, except that an ant picks up a cluster
of objects, and drops a cluster of objects. This requires a dropping strategy, as
the objects in the cluster have to be dropped in open cells in the immediate
vicinity of the target cell. We design three families of dropping strategies, and
show how these determine the geometrical shape of the cluster, based on different
algorithms for the dropping strategies.
?
This research was supported by the National Research Foundation, grant number
133051
2 C. Zeeman, L. van Zijl
Sect. 2 gives a brief overview of CA, CCA, and the LF ant sorting model.
Algorithms for different dropping strategies are investigated in Sect. 3, with a
discussion on how these strategies affect the shape that the clusters form. We
conclude in Sect. 4.
2 Background
It is assumed that the reader is familiar with the theoretical background to CA,
such as in [11].
r
N(a,b) = {(i, j) : |i − a| + |j − b| ≤ r} . (1)
and
r
N(a,b) = {(i, j) : |i − a| ≤ r, |j − b| ≤ r} .
Thus, any cell in the Von Neumann neighbourhood of the cell (a, b) for dis-
tance r = 1, is geometrically adjacent to it; that is, the cells share a common
border. Likewise, any cell in the Moore neighbourhood of cell (a, b) for r = 1,
is either geometrically adjacent to cell (a, b) or it is geometrically adjacent to
another cell which is adjacent to (a, b). Note that cells that are diagonally con-
nected are not considered to be adjacent. Hence, to include cells that are diagonal
to (a, b) in the Moore neighbourhood, a connected path of adjacent cells from
(a, b) to the target cell, can be constructed. The idea of neighbourhoods and
adjacency of cells are important in the CCA shape generation, and is discussed
in more detail in Sect. 2.2 and Sect. 2.4.
Shape Generation using Cellular Automata with Clustering 3
00 01 02 03 04
10 11 12 13 14
20 21 22 23 24
30 31 32 33 34
Fig. 1: Von Neumann neighbourhood for cluster {c12 , c13 , c21 , c22 }.
are located, and the resulting shape of the cluster on the grid varies depending
on the dropping strategy employed.
If there are not enough empty cells found to fully drop the cluster, the original
cluster is split into two clusters. The cells already dropped form one cluster, and
the other cells still being carried are joined into a new cluster, which remains
as the ant’s payload. The ant will then continue to search for a new dropping
location.
In addition, note that when a cluster ci is dropped directly adjacent to an-
other existing cluster cj (typically with the same attributes), the cells in ci are
dropped into empty cells next to cj . This may lead to the formation of joined
partial shapes during the time evolution of the CCA in the shape generation
process.
3 Shape Generation
In order to generate a given geometric shape in the ant sorting model, objects in
a cluster need to be dropped so that the required shape forms on the grid. Note
that geometric shapes can be formed by dropping the objects in relation to the
current cell, in a specified order. For example, to form a straight horizontal line
6 C. Zeeman, L. van Zijl
of width one, the objects in the cluster need to be dropped to the right (or the
left) of the current cell. Likewise, to form a perpendicular line of width one, the
objects need to be dropped to the top (or bottom) of the current cell. However,
in the ant sorting model, clusters are typically dropped adjacent to other clusters
with the same attributes. This means that not all the cells around the current
cell are necessarily empty, and therefore the dropping strategy needs to search
for the ‘best’ open cell to drop an object. The method of determining the best
cell can influence the eventual shape that forms.
Hence, any dropping strategy must identify the current cell, the neighbour-
hood to be explored for an empty cell, the order in which the neighbourhood
will be explored, and a method to define the best empty position in which to
drop the next object from the cluster.
Three families of dropping strategies are introduced, namely, fitness-based
strategies, queue-based strategies, and priority queue-based strategies. Within
each family, the same general dropping technique will be used, but different
neighbourhoods and different exploration orders of the neighbourhoods are con-
sidered. For each geometric shape, a strategy is suggested, and visual output is
shown to verify the correctness.
3.1.1 Basic Dropping Strategy This is the most basic of all the dropping
strategies. A comparative baseline is first established – if the fitness function
is applied to return a random empty cell in the neighbourhood, no discernible
shape should be generated. To force the simplest of shapes, a straight line can
be generated by exploring the neighbourhood in a fixed order and returning the
first empty cell. The high-level implementation is given in Algorithm 2.
Fig. 2(a),(b) demonstrate that the basic dropping strategy indeed achieves
the intended shapes. Note that the straight line strategy will always have a
Shape Generation using Cellular Automata with Clustering 7
single straight line in one direction (corresponding to the first choice in the
order), varying only when colliding with other clusters. Only the Von Neumann
neighbourhood was considered for the basic dropping strategy.
fit, the current best fit is kept. Since the fitness function must be evaluated for
all neighbours of all cells placed, this strategy is computationally more expensive
than the basic strategy.
These two examples illustrate how the order of the neighbourhood explo-
ration affects the shape of the cluster. In Fig. 2(c), the Von Neumann neigh-
bourhood is explored in the order [north, east, south, west]. This results in a
three-wide vertical line forming for each cluster. In contrast, reversing the or-
der to [west, south, east, north] provides three-wide horizontal lines instead (see
Fig. 2(d)).
The starting point in the exploration also plays a role. In Fig. 2(e), the
Moore neighbourhood is explored in a clockwise direction, starting in the north.
This produces thick horizontal clusters. In contrast, starting in the northeast
corner and exploring in a clockwise direction, results instead in diagonals in a
southeast orientation (see Fig. 2(f)). Thus, both the thickness of the cluster and
the orientation of the cluster formed is dependent on the exploration order of
the neighbourhood.
forward to implement. When adding new positions to the queue after dropping an
object, the Von Neumann neighbourhood (explored clockwise or anti-clockwise)
is used. Since a FIFO queue is being used, all positions in a Von Neumann neigh-
bourhood of radius one from the centre are considered, then radius two, and so
on. The final form is, therefore, that of a diamond. The first cell chosen will
determine the starting point of the shape, and the rotation direction will only
affect the shape if there are insufficient cells in the cluster to complete a full
layer of the diamond.
In the bottom-up approach, the pyramid will form such that the starting
coordinates of the drop will be the centre of the base of the pyramid. This is
achieved by letting the neighbourhood used for exploration consist of any three
cardinal directions. Exactly one of the three directions will be directly adjacent
to both of the other directions: this direction denotes the direction in which
the pyramid will grow. For example, if the neighbourhood [east, north, west] is
chosen, then only north is adjacent to both east and west, so the pyramid will
form with the base growing in an east-west direction, and the top directly north
of the starting point.
This family of dropping strategies follows the same general approach as the FIFO
queue-based strategies, but uses a priority queue instead. A priority is associated
with each item in the priority queue such that the item with the highest priority
is at the front of the queue. This allows more complex features to be incorporated
into the dropping strategy. The generic priority queue-based dropping strategy
is given in Algorithm 4, and the use of the priority queue is demonstrated in the
circle dropping strategy.
More complex shapes, such as squares or triangles, require the use of queue-based
strategies. Here, the computational cost is less than that of the fitness-based
strategies, at the cost of a increased memory requirement.
4 Conclusion
Geometric shape generation was successfully performed for CCA based on an
ant sorting model. It was shown that different dropping strategies, with different
exploration orders, can be used to drop clusters of different shapes. Fitness-
based dropping strategies can be more expensive in terms of execution time
depending on the given neighbourhood, whilst queue-based and priority-queue-
based strategies are computationally less expensive, but requires extra memory
usage for the queue.
The geometrical forms generated by the strategies discussed in this article
are relatively simple shapes. An investigation into other dropping strategies,
that generate more complex geometrical forms, is appropriate. As a first step,
the effect of changing the fitness function to operate over a whole cluster, rather
than over a single cell, should be investigated. Another avenue of investigation
is to extend this work to generate three-dimensional shapes.
References
1. Adams, R., van Zijl, L.: Ant sorting based on cellular automata with clustering. In:
Proceedings of the Annual Conference of the South African Institute of Computer
Scientists and Information Technologists. p. 29–38. SAICSIT ’18, Association for
Computing Machinery, New York, NY, USA (2018)
2. Baas, N.A., Helvik, T.: Higher order cellular automata. Advances in Complex Sys-
tems 8, 169–192 (2005)
3. Chavoya, A., Duthen, Y.: A cell pattern generation model based on an extended
artificial regulatory network. Biosystems 94(1-2), 95–101 (2008)
4. Delorme, M., Mazoyer, J., Tougne, L.: Discrete parabolas and circles on 2D cellular
automata. Theoretical Computer Science 218(2), 347–417 (1999)
5. Deutsch, A., Nava-Sedeño, J.M., Syga, S., Hatzikirou, H.: BIO-LGCA: a cellular
automaton modelling class for analysing collective cell migration. PLOS Compu-
tational Biology 17(6), e1009066 (2021)
6. Dorigo, M., Di Caro, G., Stützle, T.: Special issue on Ant Algorithms. Future
Generation Computer Systems 16(8), 851–956 (2000)
7. Lumer, E., Faieta, B.: Diversity and adaptation in populations of clustering ants.
In: Proceedings of the Third International Conference on Simulation of Adaptive
Behaviour: From Animals to Animats. p. 499–508. MIT Press, Cambridge, MA,
USA (1994)
8. Macedo, Y.P., Chaimowicz, L.: Improving procedural 2D map generation based
on multi-layered cellular automata and Hilbert curves. In: 2017 16th Brazilian
Symposium on Computer Games and Digital Entertainment. pp. 116–125. IEEE
(2017)
9. Van Zijl, L., Smal, E.: Cellular automata with cell clustering. In: Proceedings of
AUTOMATA 2008: Theory and Application of Cellular Automata. pp. 425–440.
Luniver Press (2008)
Shape Generation using Cellular Automata with Clustering 13
10. Van Zijl, L.: Clustering in 1D binary elementary cellular automata. In: Proceedings
of the 2015 Annual Research Conference on South African Institute of Computer
Scientists and Information Technologists. pp. 1–7. SAICSIT ’15, Association for
Computing Machinery, New York, NY, USA (2015)
11. Wolfram, S.: Theory and applications of cellular automata, vol. 1. World Scientific
Singapore (1986)
12. Zhang, D., Choi, C., Kim, J., Kim, Y.M.: Learning to generate 3D
shapes with generative cellular automata. In: 9th International Confer-
ence on Learning Representations, ICLR, poster presentation (March 2021),
https://arxiv.org/pdf/2103.04130.pdf