Construction & simulation

An authored network becomes a runnable problem via ReactionNetworkProblem, which owns the live simulation state and the per-run RNG (a run is determined by (model, seed)). @agentize builds the problem inside an AlgebraicAgents hierarchy.

ReactiveDynamics.ReactionNetworkProblemType

The live simulation state — an AlgebraicAgents @aagent, so a running network is itself a node in a larger heterogeneous AA hierarchy (an AbstractAlgebraicAgent). It is constructed from a static authoring store by the ReactionNetworkProblem(net; …) outer constructor and advanced by the _step! loop. Key fields: .network (the static ReactionNetwork IR store the run was compiled from), .u (the current plain-species marking vector), .p (parameters), .t/.tspan/.dt (time control), .sol (the per-step marking log as a DataFrame), .log (the event/message log), .observables, .ongoing_transitions (in-flight transition instances), .program_ledgers (per-program economics, §12), and .token_trajectory (per-token trajectory log, §14.1). Determinism is contractual (§4): .rng is the state-owned RNG that is the SOLE source of randomness in the step loop, .seed records the realized construction seed, and .initial_rng snapshots the stream at t=0 so _reinit! restores it exactly. The endogenous decision channel lives in .rules/.registry; the runtime store is append-only (ADR 0004), so compiled attribute closures may position-index it safely.

source
ReactiveDynamics.@agentizeMacro
@agentize net [u0] [p] [seed=…] [tspan=…] [name=…] …

Thin authoring sugar over the ReactionNetworkProblem constructor: expand to exactly one ReactionNetworkProblem(net[, u0, p]; kwargs...) call (ADR 0001 / ADR 0012). Agentization is already implicit in that constructor — it builds the @aagent and entangles the "structured" container — so this macro adds NO second construction path; it only lowers to the public constructor call.

The one ergonomic win is AUTO-NAMING: when net is a plain binding (a Symbol), the agent name defaults to that binding's name (@agentize netname = "net"). An explicit name= kwarg always wins, and a non-symbol net expression (@agentize build_net()) falls back to the constructor's own name default — the auto-name is a compile-time String literal, so it never fights macro hygiene.

Examples

prob = @agentize net                          # name = "net"
prob = @agentize net u0 p seed=1 tspan=10     # positional u0/p + forwarded kwargs
prob = @agentize net name="custom"            # explicit name overrides the auto-name
prob = @agentize build_net()                  # non-symbol acs → constructor's default name
source

Stepping the problem

A ReactionNetworkProblem is an AlgebraicAgents.jl agent, so it is stepped and reset with AA's verbs — simulate (advance the run to its horizon) and reinit! (restore the exact RNG stream for a fresh run, taking a seed kwarg). These are AlgebraicAgents functions, reexported by ReactiveDynamics; see the AlgebraicAgents documentation for their full signatures.

prob = ReactionNetworkProblem(net; seed = 1)
simulate(prob)     # AlgebraicAgents verb, reexported by RD
reinit!(prob)      # AlgebraicAgents verb, reexported by RD