chemart / metabolic-robot-controller
View on GitHubMetabolic / artificial biochemical network robot controllers — A reaction network used as a brain. Sensors feed substances into the network, the network's own reactions process them, and a motor consumes the concentration of a designated actuator species - so the robot's behaviour *…
How it works
A reaction network used as a brain. Sensors feed substances into the network, the network's own reactions process them, and a motor consumes the concentration of a designated actuator species - so the robot's behaviour *is* the network's dynamics. Hand-designed networks do light-seeking and obstacle avoidance; evolved ones transfer from simulation to real hardware with little more than a scaling factor. The appeal is that computation and its substrate are not separable here.
- S
- abstract substances s1, s2, ...; sensor substances (b, c, d, e) receive sensor-driven inflow, the actuator substance a is read and consumed by the motor · explicit
- R
- Bipartite directed weighted graph G = (V, E), V = R u S. Reaction nodes have the types s1 -> s1' ; s1 + s2 -> s1' ; s1 -> s1' + s2 ; s1 + s2 -> s1' + s2' (paper eqs. 4-7). Stoichiometric edges carry the default weight k_0; a special edge S -> R carries a catalytic or inhibitory weight k in [k_min, k_max]. A catalysed node becomes X -> Y [k_0] plus X + C -> Y + C [k_0 k]. The graph must fulfil material balance: positive species weights m with M(R) m = 0. · arity 1, 2
- A
- lattice-2d, ode · sensor substances flow in (eq. 30); the actuator substance is consumed at rate alpha above a_min (eq. 31); the 2001 lattice reactor also removes random molecules
Parameters
| name | default | meaning |
|---|---|---|
| n_substances int · structural |
8 | number of molecule nodes |S|, including the sensor and actuator substances; the others are named s1, s2, ... (the paper numbers them; the prefix keeps '2 s2' readable) [2, 500]; must include the input and output substances; the evolved graph of the paper's fig. 13 has nearly 50 nodes (molecules + reactions) and 70 edges |
| n_reactions int · structural |
8 | number of reaction nodes |R|, each kept only if the graph stays materially balanced [0, 1000] |
| reaction_types list · structural |
[4, 5, 6, 7] | allowed reaction types by the paper's equation number: 4 s1 -> s1', 5 s1 + s2 -> s1', 6 s1 -> s1' + s2, 7 s1 + s2 -> s1' + s2' (Table 1 uses all four) |
| p_modifier float · structural |
0.5 | probability that a reaction node carries a catalytic or inhibitory edge (at most one per node, as in mutation case 1); not published [0, 1] |
| p_inhibitor float · structural |
0.5 | probability that a modifier edge is inhibitory rather than catalytic; not published [0, 1] |
| k_0 float · kinetic |
1.0 | default weight k_default of stoichiometric edges, the rate constant of the spontaneous reaction (1.0 in Ziegler, Dittrich & Banzhaf 1998) [0, ∞] |
| k_min float · kinetic |
10.0 | lower bound of catalytic/inhibitory weights, drawn uniformly in [k_min, k_max] [0, ∞] |
| k_max float · kinetic |
10.0 | upper bound of catalytic/inhibitory weights [0, ∞]; the 2001 paper gives no values; the default k_min = k_max = 10 is the catalytic efficiency kappa of the 1998 paper |
| sensor_map dict · structural |
{"b": ["left1", "left2"], "c": ["front1", "front2"], "d": ["right1", "right2"], "e": ["back1", "back2"]} | input set I: each sensor substance and the Khepera proximity sensors whose maximum drives its inflow (eq. 29) |
| sensor_readings dict · population |
{"left1": 1023, "left2": 1023, "front1": 1023, "front2": 1023, "right1": 1023, "right2": 1023, "back1": 1023, "back2": 1023} | current sensor values in [0, 1023] by sensor name; unlisted sensors read 0. The default is the paper's robot surrounded by obstacles |
| max_inflow float · population |
0.1 | maxInflow of eq. 30: inflow of a sensor substance at maximum reading, as a fraction of the reactor volume per iteration (10% in the paper) [0, 1] |
| actuator_map dict · structural |
{"a": "rotate"} | output set O: each actuator substance and its action, one of rotate (2001: switch one motor's direction above a_min), left-motor, right-motor (1998: substance drives a wheel) |
| alpha float · population |
0.9 | consumption rate alpha of the actuator substance while it is above a_min (Table 2: 0.9) [0, 1] |
| a_min float · population |
0.1 | actuator activation threshold a_min (Table 2: 0.1) [0, ∞] |
Metabolic / artificial biochemical network robot controllers
One of the artificial chemistries of Banzhaf & Yamamoto, Artificial Chemistries (MIT Press, 2015), §16.1.3; first proposed by Ziegler & Banzhaf, 2001; Lones, Fuente, Turner et al..
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/metabolic-robot-controller", seed=0) # same as "metabolic-robot-controller"
print(net.summary())
What to look for
- light seeking and obstacle avoidance on a Khepera robot (1998, hand-designed enzyme-substrate network)
- evolved networks transfer between simulation and a real Khepera, with only a scale factor on sensor inflow
- the evolved kernel uses only the front and left sensor substances to raise the motor substance (fig. 14)
- genome length grows during evolution (introns, bloat) while the kernel stays small
- combined genetic + metabolic + signalling networks controlling chaotic dynamical systems (Lones et al.)
Implementation decisions
- The network is one individual of the GP system: a random reaction graph. The (mu, lambda) evolution, mutation, crossover, pathway extraction and the robot simulation act on many networks and are not generated; the v1 evolution parameter is dropped.
- Reaction nodes are drawn like mutation case 4 (type uniform over reaction_types, participants uniform over all molecules, with replacement). No-op reactions and duplicate nodes are rejected. The paper's 'grow' initialisation is not described further.
- Material balance (sec. 3.1.1) is tested as the existence of weights m >= 1 with M(R) m = 0, by linear programming. The paper's steps 4-6 set the independent weights to unity and check the rest, which can wrongly reject a balanced network whose positive solution needs other values. A node that would break the balance is rejected rather than penalised. Once the weight vector is unique, a node is kept iff it is orthogonal to it.
- Extraction garbling: eqs. 4-7 lost their primes (printed 's1 -> s1'); they are read as s1 -> s1', etc., since the unprimed forms would be no-ops.
- Catalysis: the 2001 paper only says a catalyst multiplies the rate constant by a factor. The 1998 appendix writes a catalysed reaction as a parallel mass-action channel w5 = k5 kappa [A][B][B] with k5 = k1, so a catalysed node becomes the plain reaction (k_0) plus a channel with the catalyst on both sides (k_0 k). The kappa glyph is lost in the extracted text and is restored from the table 'kappa 10'.
- Inhibition has no published functional form. An inhibited node is one mass-action reaction with k_0 whose rate dict records inhibitor and k_inhibition; a simulator must choose the inhibitory factor.
- Modifier edges: at most one per node, as mutation case 1 implies ('adding an inhibitor/catalyst if none is present'). The modifier is any molecule, with k ~ U[k_min, k_max]. p_modifier and p_inhibitor are not in the paper.
- Rate defaults: the 2001 paper gives no k_default, k_min or k_max. The defaults k_0 = 1.0 and k_min = k_max = 10 are the 1998 paper's k_i and kappa.
- Sensor inflow (eq. 30) is expressed per reactor iteration as a fraction of the reactor volume (cellsize = 1), so max_inflow = 0.1 gives 0.4 in total when all four sensor pairs read 1023, as the paper states. sensor_map and actuator_map replace the v1 callables.
- Actuator outflow (eq. 31) is recorded as outflow alpha. The threshold gate [a] > a_min is not a rate law and is kept in extras.actuators. Reactor size, fill level and cycle counts (Table 2) only size the simulation and are dropped. No initial state is set: the paper fills 50% of the lattice without giving the composition.
- The functional set (kernel, eq. 16) and pathways P(v, w) are analyses of a graph, not part of it, and are not computed. extras.reaction_graph lists each reaction node with its type, modifier and the indices of the network reactions that implement it.
Sources
- Ziegler, J. & Banzhaf, W. (2001). Evolving control metabolisms for a robot. Artificial Life 7(2):171-190. Reaction graphs sec. 3 (eqs. 4-17), material balance sec. 3.1.1, mutation sec. 3.2.1, sensors and actuators sec. 5.1-5.2 (eqs. 29-31), Tables 1-2. http://www.cs.mun.ca/~banzhaf/papers/metabolism.pdf
- Ziegler, J., Dittrich, P. & Banzhaf, W. (1998). Towards a metabolic robot control system. In Holcombe & Paton (eds.), Information Processing in Cells and Tissues, pp. 305-318. Appendix, example A: mass-action form of catalysed reactions and k = 1.0, kappa = 10. https://users.fmi.uni-jena.de/~dittrich/p/ZDB97ipcat.ps
Banzhaf & Yamamoto, Artificial Chemistries (2015), §16.1.3
Preview at default parameters
8 species · 11 reactions · status complete · seed 1
e + s2 -> s3 [mass-action k=1.0 node=r1] b -> s2 [mass-action k=1.0 node=r2] b + c -> d + s2 [mass-action k=1.0 node=r3 inhibitor=s3 k_inhibition=10.0] e -> 2 a [mass-action k=1.0 node=r4] 2 s2 -> e + s2 [mass-action k=1.0 node=r5] 2 s2 + d -> e + s2 + d [mass-action k=10.0 node=r5 catalyst=d k_catalysis=10.0] a + d -> s3 [mass-action k=1.0 node=r6] b + e -> a + c [mass-action k=1.0 node=r7] b + e + s2 -> a + c + s2 [mass-action k=10.0 node=r7 catalyst=s2 k_catalysis=10.0] s3 -> s1 [mass-action k=1.0 node=r8] s3 + s2 -> s1 + s2 [mass-action k=10.0 node=r8 catalyst=s2 k_catalysis=10.0]
Generated by the uploader with chemart push; the hub never runs uploaded code.