The Alchemist Meta-Model
The first step to take in order to use the simulator, is to answer the question
what does Alchemist simulate?
A broad introduction is provided in form of introductory video from the DAIS 2021 conference tutorial.
The model
The world of Alchemist is composed of the following entities:
Molecule- The name of a data item
- If Alchemist were an imperative programming language, a molecule would be the concept of variable name
- Concentration
- The value associated to a particular molecule
- If Alchemist were an imperative programming language, a concentration would be the concept of value associated to a variable
Node- A container of molecules and reactions, living inside an environment
Environment- The Alchemist abstraction for space. It contains nodes and provides:
- Where the nodes are in the space - i.e. their position
- The distance between two nodes
- Optionally, support for moving nodes
- The Alchemist abstraction for space. It contains nodes and provides:
NetworkModel- Observes the status of the environment and associates to each node a neighborhood, updated as the status changes
Neighborhood- An entity composed by a node (centre) and a set of nodes (neighbors)
Reaction- A scheduled model operation that can change the state of the environment
- Nodes and environments host possibly empty collections of reactions
- Each reaction owns conditions, actions, and its absolute, observable next-occurrence time
- A
TimeDistributedReactionuses aTimeDistributionto generate delay samples and applies its own policy to samples and reactive model changes - An
AbsoluteEventinstead owns one fixed absolute occurrence - Reaction Scheduling and Ownership explains reactive invalidation, scheduling transitions, specialized policies, and the boundary with the simulation engine
Condition- A reactive prerequisite that exposes whether its owning reaction can execute
- Reactions publish a finite occurrence while all their conditions are valid
- Specialized reaction families may accept concrete condition types and read their domain state when deriving a rate
Action- Models a change in the environment.
The following image is a visualization of such model:
The behavior of the system is described in terms of reactions. As such, here’s a pictorial representation of a reaction:
In the general model, conditions gate a reaction through their validity; only specialized reaction families derive their rate from the typed state of the conditions they accept (see Reaction Scheduling and Ownership).
Incarnations
As you can see, names are given after classical chemistry terms. This is mostly for historical reasons: Alchemist has been initially conceived as a chemical-oriented multi-compartment stochastic simulation engine, able to support compartment (node) mobility while still retaining high performance.
Alchemist applies the same meta-model to broader domains through a deliberately loose interpretation of molecule and concentration. These two terms have a very precise definition in chemistry, but in Alchemist they are respectively
- a generic identifier, and
- a piece of data of some type
An Incarnation includes a type definition of concentration,
and possibly a set of specific conditions, actions and (rarely) environments and reactions that operate on such types.
In other words, an incarnation is a concrete instance of the Alchemist meta-model.
It also defines:
- Means for translating strings into named entities (molecules)
- Means for obtaining a number when given a node, a molecule and a string representing a property
- Means for building incarnation-specific nodes, time distributions, reactions, conditions, and actions, given the entity hosting or owning them (the environment, a node, or a reaction) and a parameter String
These functionalities are required in order to support a uniform access to different incarnations.
Different Incarnations can model completely different universes. For instance, if the concentration is defined as a positive integer and proper actions and conditions are provided, Alchemist becomes a stochastic simulator for chemistry featuring interconnected and mobile compartments.
The standalone distribution comes with:
- Protelis Incarnation
- SAPERE Incarnation
- Biochemistry Incarnation
- Scafi incarnation