chemart / acgp
View on GitHubAlgorithmic Chemistry GP (ACGP) — Run this one backwards from the others: instead of building a chemistry, it reads one out of a program. The registers of a virtual machine are the species, so an instruction like r3 <- r1 op r2 is read as the reaction r1…
How it works
Run this one backwards from the others: instead of building a chemistry, it reads one out of a program. The registers of a virtual machine are the species, so an instruction like r3 <- r1 op r2 is read as the reaction r1 + r2 -> r3, and the instructions are drawn in random order, so what acts like a concentration is how often each instruction appears in the multiset. Genetic programming then evolves the instruction multiset, and the evolved classifier can be inspected as a reaction network. Because an instruction is a reaction rather than a step, no execution order is stored, and the authors argue that the multiplicity of an instruction reflects its importance, which should make programs fault tolerant.
- S
- registers r0..r(n-1) of a virtual machine (species); their contents are real numbers, and the multiplicity of each instruction plays the role of a concentration · explicit
- R
- an instruction r3 <- r1 op r2 is read as a reaction r1 + r2 -> r3 · arity 1, 2
- A
- well-stirred-multiset · none
Parameters
| name | default | meaning |
|---|---|---|
| n_registers int · structural |
12 | number of registers [2, 128] |
| n_instructions int · structural |
100 | multiset size; the multiplicity of an instruction is its importance, which gives fault tolerance [1, 10000] |
| input_registers list · structural |
[0, 1, 2, 3] | read-only registers where input is fed; never written |
| output_registers list · structural |
[11] | registers the answer is read from |
Algorithmic Chemistry GP (ACGP)
One of the artificial chemistries of Banzhaf & Yamamoto, Artificial Chemistries (MIT Press, 2015), §16.6; first proposed by Banzhaf & Lasarczyk, 2004-2007.
Its generator ships with the chemart library, so loading it runs no code from the hub and needs no trust_remote_code.
import chemart
net = chemart.generate_network("chemart/acgp", seed=0) # same as "acgp"
print(net.summary())
What to look for
- evolves classifiers (e.g. UCI thyroid) as bipartite register/instruction graphs
- argued (not measured) to be fault tolerant, since an instruction's multiplicity reflects its importance
- trivially parallelisable - no coordination between instruction executions
Implementation decisions
- The generator samples one random program: n_instructions instructions with uniformly random operand registers, a random writable destination (not an input register) and an operator from {+, -, *, /}. Each instruction is the reaction of eq. 16.9, repeated instructions stay repeated (multiset), and extras.program lists the instructions in reaction order.
- Evolution of programs (population, generations, executions_per_eval) acts on populations of such networks and is not part of one network, so those parameters are dropped.
Banzhaf & Yamamoto, Artificial Chemistries (2015), §16.6
Preview at default parameters
12 species · 100 reactions · status complete · seed 1
r5 + r6 -> r10 r0 + r1 -> r10 r2 + r3 -> r10 r3 + r9 -> r6 r7 + r6 -> r4 r10 + r9 -> r10 r9 + r3 -> r7 r1 + r3 -> r4 r11 + r1 -> r7 r10 + r2 -> r8 r0 + r9 -> r4 2 r5 -> r4 r8 + r11 -> r4 r3 + r6 -> r11 r8 + r1 -> r6 r5 + r6 -> r6 r5 + r7 -> r7 r4 + r7 -> r10 r5 + r0 -> r9 r10 + r5 -> r6 r5 + r7 -> r10 r2 + r7 -> r10 r4 + r10 -> r8 r8 + r6 -> r11 r0 + r1 -> r8 r0 + r8 -> r10 r10 + r2 -> r8 r4 + r2 -> r7 r2 + r10 -> r9 2 r10 -> r6 r7 + r3 -> r11 r10 + r7 -> r6 r4 + r10 -> r11 r5 + r2 -> r9 r10 + r9 -> r11 r10 + r1 -> r4 r4 + r10 -> r10 r6 + r7 -> r11 r5 + r8 -> r7 r11 + r9 -> r7 … 60 more
Generated by the uploader with chemart push; the hub never runs uploaded code.