ACML - Automates Cellulaires en caML

ACML is a cellular automata simulator that focuses on easy definition and exploration of arbitrary rules and initial configurations.
Download last version

In a few words

Typical target usage: mine!

  1. You're attending a conference on cellular automata, the speaker presents an interesting example and you want to play with it immediately without interrupting him/her nor stealing his/her computer. Then you start to think of a possible variant of the example, then another one, and you quickly come to a whole family of rules that you want to explore quickly by adjusting some parameters.
  2. Later, you start more serious investigations and want to test some conjecture on a large family of small examples. The test involves creating particular initial configurations and running the examples until some event occur. In addition you want to save the configuration reached in each case, and of course you want to let the whole test run autonomously during the night.
  3. Finally, you're in the process of writing a scientific paper/talk and need to illustrate it your with various figures. Some are simple screenshots, others are full Tikz code to produce a space-time diagram where some states are given a name typeseted in LaTeX. Moreover, the cellular automaton you want to define is big and very structured, so the best way to describe its transition rule is by using a high-level programming language.

Documentation

Basic usage: launch and watch

Launching ACML without any command-line option gives you an interface with two windows: a control window with many buttons, and a view window where the simulation is displayed. Using the control window should be more or less intuitive. You can also interact with ACML through the view window (click Help button to know how).

Screenshot Screenshot

Inside ACML, there's a lot of predefined cellular automata and families. Click "Open.." to get the list. You can also directly enter names in the main input text box at the top of the control window. From the command line, you get these lists in this way:
acml --list_families
acml --list_objects
To have an idea of what ACML can do, you can also try these command lines (try one line at once, control window desactivated, just watch):
acml --nogtk --run life
acml --nogtk --run bosco
acml --nogtk --run 54
acml --nogtk --run sandpile
acml -vx 200 -vy 500 -x 100 -y 250 --nogtk --run fire
acml --nogtk --run B3678/S34678
acml --nogtk --run --refresh_rate 100 langton
acml --nogtk --run majority --- neighborhood Moore states 5 radius 4
If you like animated GIFs, try this long line (needs ImageMagick's convert utility):
echo "Wait..." && acml --quiet --batch random_cyclic --stop 200 --shooting --shootfile tmp_ihopethisisafreshname.png && convert -delay 10 -loop 0 tmp_ihopethisisafreshname*.png surprise.gif && rm tmp_ihopethisisafreshname*.png && echo "Now open surprise.gif"
More about the command line:
acml --help
acml --version
acml "brian's brain" --quiet --identify

The core concept: transformations instead of objects

The core concept of ACML is to manipulate transformations or procedures that produce cellular automata, rather than manipulating cellular automata directly. A procedure can (potentially) produce a whole set of different cellular automata depending on the context. In ACML, the result of such a procedure is called an object and the procedure itself is called a family. We can therefore schematize the situation as follows: Moreover, in ACML, a family is always given by its source code. Therefore, ACML is capable of saving the current object as a new source code which is essentially the pair: current context + family.

Advantages:

  1. parameters: exploring large families of cellular automata by quickly adjusting parameters instead of painfully openning them one by one. Parameters can be anything, you are free to introduce them in your source code.
  2. compacity: for large structured rules, for highly symetric rules, for huge randomly generated rules, 'source code + parameters + random seed' is vastly better than any table-based format
  3. readability/reusability: for instance, you can write the code to define a family as "an additive cellular automata updates each cell to the sum of its neighbors modulo the number of states". It's clear, indepependant of the dimension, the number of states or the neighborhood (which are just parameters). Later you can copy/paste this code and easily add a parameter called "alpha" to define another family as "an affine cellular automata updates each cell to alpha plus the sum of its neighbors modulo the number of states". Code is often reusable.
    On the contrary "111→1, 110→0, 101→0, 100→1, 011→0, 010→1, 001→1, 000→0 " is both uncomprehensible and not reusable.
  4. shortcuts and naming conventions: you want "life", "bosco", "Brian's brain"? Easy: an object can be referenced as a pair (family + parameters). Moreover, you can implement any naming convention you want as a function "string → family + parameters". ACML already understands things like "110", "B2/S345", etc. To know the exact list:
    acml --list_shortcuts

In practice

ACML can work on the current object like any other simulator (start/stop simulation, screenshot, etc). But it also has a current family which allows you to change the current object. Try this:
acml cyclic
In this example, you can explore the family of classical cyclic cellular automata (you can get detailed information on the current family/object by clicking the info icon at the top-right corner of the control window).

A small program's worth a thousand clicks

The primary goal of ACML is to allow quick writing and testing of new automata rules. To achieve this the key features are:
  1. rules as programs: to define a transition rule you have the full expressive power of a high-level programming language (OCaml). For instance, the transition rule of Brian's Brain cellular automaton can be written like this:
    let transition_rule me howmany = match me with
    | Excited → Refractory
    | Quiescent when howmany Excited = 2 → Excited
    | _ → Quiescent
  2. automtic compilation/dynlink process: you write the source in OCaml, click Open... (right toolbar) in the user interface, select your file and ACML do the rest. For the impatient, you can also enter code directly from the command line:
    acml "fun me howmany -> if (howmany 1 = 3 && me = 0) or (me = 1 && howmany 1 <= 4 && howmany 1 >= 3) then 1 else 0"
    But there is a shorter way to obtain the same as above :)
    acml life
  3. parameters: instead of a single rule, your source code can describe a whole family of rules depending on some parameters. Then, without changing the source code, you can adjust the parameters from the user interface (or command line) and easily test all the rules in the family. From the programmer's point of view, adding a parameter is as simple as inserting in the code a line of the form:
    let x = bool_param a "left/right symmetric" false in
  4. everything is programmable: you are not only free to write new automata rules, but also new initial configurations, new ways to display the universe, new ways to measure quantities along time, new ways to interact with the mouse, etc. Moreover, all this comes with a simple plugin system which allows to factorize code. For instance, a line of code of the form:
    add_modif a ~key:"b" "Turn to 0/1" (Map (function 0 -> 0 | _ -> 1));
    gives you a new mouse action which turns all non-zero states into 1s inside the selected zone. It is selectable from the control window, or directly by holding key "b" while selecting a zone with the mouse in the view window.
  5. reproducibility: ACML can manage random seeds for you. If you use pseudo-randomness apropriately in your source files, you can generate and simulates as many rules on as many configurations as you want and just click Save when you're happy: a new source file is saved and opening it will reproduce exactly your last experiment.
  6. the code is visible: first, ACML is open source. Second, the code of each rule, family of rules, plugin, etc is accessible from within the interface in flew clicks. We think that, frequently, exposing the code (or portion of code) is the best way to explain what exactly does some function.

So let's write programs for ACML!

TutorialAPI

Compilation

Prerequisites

WANRING! OcamlSDL version 0.9.0 (and maybe also some earlier versions) contains a bug in mouse click detection. OcamlSDL version 0.9.1 works.

ACML should compile on any plateform where you can install these prerequisite (tested on Ubuntu Linux and Mac OSX).

Debian-based linux distributions

On Debian-based linux distributions (tested with several Ubuntu distributions), you should get all what you need with this single command-line:
sudo apt-get install ocaml ocaml-findlib libsdl-ocaml-dev liblablgtk2-ocaml-dev libcairo-ocaml-dev libzip-ocaml-dev

Other systems

If your OS has some kind of packaging system, you may find corresponding package names starting from the list above. Alternatively, you can use GODI (source code OCaml distribution). The following list of GODI packages should be sufficient:
godi-ocaml-all godi-findlib godi-lablgtk2 godi-ocamlsdl godi-cairo godi-zip
To install these packages, external libraries (e.g. SDL, GTK+2 and CAIRO) must be installed on your system (they are not provided by GODI). This installation method works on MacOS (tested on 10.6 and 10.4, using fink for external libraries).

Compilation instructions

In the src/ directory of the decompressed archive, type:
make
sudo make install
In case of a compilation failure, it might be necessary to do run make clean before another make.

Customization

In the directory src/builtin, you can add or remove as much ACML source files as you want. Each file can contain a family of cellular automata or a plugin. During the compilation, all these families or plugins are embedded in the binary.

Download

Download last versionSee all versions

FAQ

HomePapersTalksListsPhd thesisThemesStudentsNetworksCAImagesACMLPop-scienceOpen/free
Français
English
Español
Home
Publications
Research
Others