Migrating to the reactive engine
This page is migration-oriented: it maps the APIs of the dependency-graph engine to their reactive replacements, for those maintaining custom simulator extensions written against earlier releases. The current model is described in the metamodel and in the reaction scheduling pages.
Scheduling
- The engine no longer computes a dependency graph.
Reactions own their schedule and publish it through the observable
nextOccurrenceofReaction; the engine reindexes a reaction whenever it emits.Context,Dependency, input and output contexts, inbound and outbound dependencies, andCondition.getDependencies()no longer exist: a reaction subscribes to the observable model state it reads. - The batch engine, its batched schedulers, and
EngineConfigurationwere removed: useEngine. Launcher parameter batches are still supported. TimeDistributiononly samples delays (sample()) and creates fresh instances for cloned reactions (newInstanceOn); the reaction owns the occurrence time, the rate (TimeDistributedReaction), and the rescheduling policy.Eventis nowGenericReaction; one-shot behavior is provided byAbsoluteEventandConditionalEvent. Environment-wide reactions are ordinary reactions hosted by the environment, which, like nodes, is aReactionHost.
Reactions, conditions, and actions
- Reactions expose their fixed
host, and hosts register only their own reactions. - Conditions and actions expose the
reactionowning them instead of their node; the host, and possibly the node, are reached through it. A reaction rejects conditions and actions owned by other reactions. - Cloning takes the new owner only:
cloneCondition(newReaction)andcloneAction(newReaction). - Extend the base class matching what the condition or action works on:
AbstractConditionandAbstractActionfor elements independent of the kind of host;AbstractNodeConditionandAbstractNodeActionfor elements working on an explicit target node, which is the host of the new reaction after cloning if it was the host of the original one;AbstractLocalConditionandAbstractLocalActionfor elements working on the node hosting theirNodeReaction, which covers most of the former node-bound classes.
- Condition validity is the observable
isValidproperty; install it withsetValidityfrom model observables (concentrations, neighborhoods, positions, layers, …). Conditions no longer contribute to propensities: specialized reactions read the typed inputs they need.reactionReadyis nowbeforeReactionFires. - Constructors take the owning reaction where they used to take the node. In YAML, the reaction is injected like the environment and the node; in the Kotlin DSL, the generated builders take it from the context.
Model state
- Node contents, neighborhoods, positions, node counts, range queries, layer values, and host reactions are
observable: consumers subscribe to them instead of polling.
Environment.nodesis an observable list, read throughcurrent. - Layers are associated with the environment during setup and cannot be added afterwards;
their values may change over time, so read them through
Environment.observeLayerValue. - Node properties are part of the node setup: they cannot be added once the node is in an environment.
- Movement:
Environment.moveNodeTomoves to an absolute position andEuclideanEnvironment.moveNodeByby a displacement (formerlymoveNodeToPositionandmoveNode). Environments constraining movements overridemoveNodeTo, so their constraints apply to both. - Java serialization is no longer supported by the model, the engine, and the loaders.