Subsystem#

class hybrid_aif.system.Subsystem[source]#

Bases: NamedTuple

One component’s identity inside a merged composite, carried on System.subsystems.

Built by hybrid_aif.composition.merge.merge(). Metadata (no face computes from it) recording which edges crossed a boundary, which the flat graph does not show; subsystem() derives a per-mind view from it, and a mapping keyed by a node a binding removed is refused with a sentence naming what it became. Indices are composite state factor and modality indices; the control node fields name nodes by composite name, as the merge left them.

A record build() reconstructs from a model description carries only what the document shows: the composite’s names, its state factors, modalities and the control nodes still present. relayed, terminated and identified are empty there and boundary is derived from the edges the document shows between components (a parent, a parameter variable or a read across them), reads is the document’s own, and actions names the present control nodes only, since a node a binding removed is absent from the document (design: model-description-0.3.md Q18.2).

Design: docs/design/nesting-systems.md; docs/design/control-states.md C12; nesting-and-coupling.md N2, N3.

states: tuple[int, ...]#

The composite state factor indices of the subsystem, in its declaration order (its block is contiguous, so local index i is states[i]).

modalities: tuple[int, ...]#

The composite modality indices of the subsystem, in its declaration order.

controls: tuple[str, ...]#

The control nodes this subsystem still chooses (the composite plans them).

actions: tuple[tuple[str, str], ...]#

(control node, action node) for every control node this record names (a driven node’s is the one it had before it was driven, which is no action node of the System).

relayed: tuple[tuple[str, str], ...]#

Pairs (node, state): a control node identified with another subsystem’s state, which its reader reads a step later (a Link from a state).

terminated: tuple[str, ...]#

Control nodes a Clamp replaced with a prior.

identified: tuple[tuple[str, str], ...]#

Pairs (node, driver): a driven control node and the control node driver whose action node drives it (an Identify, or a Link from the action node, read at the same step); a joint planner makes the two one node, so every state factor that read node reads driver.

free_modalities: tuple[int, ...]#

Modalities reading only this subsystem’s state factors.

bound_modalities: tuple[tuple[int, tuple[int, ...]], ...]#

(modality, foreign parents) for the modalities an observation binding pointed across the boundary.

target_emissions: tuple[tuple[int, tuple[int, ...]], ...]#

(state factor, parents) for terminal targets whose H_deps parents lie outside this subsystem.

reads: tuple[tuple[str, str, str | Grid, str], ...]#

(modality, source, kernel, realise), composite names, for every modality of this subsystem that reads a state factor of another component (a belief Link): the view leaves the modality an ordinary observation, and the driver supplies it each round from the source component’s carry.

boundary: str#

What binds this subsystem to the others: "none" (no binding crosses its boundary), "blanket" (every binding across it is a belief read or a Link from an action node into a control node), "shared" (some binding identifies a latent outright: a relay, a structural Link, a terminal Link, an Identify), or "coupled" (a top-level component of a couple(), joined to the others by identified ports alone). nested is the "blanket" case: the subsystem keeps a blanket of its own inside the particle.

emissions: tuple[str, ...]#

The composite names of the component’s own emissions, its outputs drawn from its state factors (System.emissions).

config: tuple[tuple[str, object], ...]#

(field, value) pairs, the leaf’s own planner configuration (policy_len, planner, gamma, num_iters, decomposition, planning_belief, feedback, mixture_schedule, mixture_k, epistemic, terms and scoring, the static declaration), with names qualified as the composite’s; empty for a node that is itself a composite, whose leaves each hold their own. The leaf’s habit, precision, durations and scoring parameters are SystemParams.parts[<leaf>].

recognition: tuple[str, ...]#

The composite names of the amortized recognition variables the leaf owns (System.recognition).

property nested: bool#

Whether every binding across this component’s boundary is a belief read or a Link from an action node into a control node, so the component keeps a blanket of its own inside the particle (and at least one binding crosses it).

static __new__(
_cls,
states,
modalities,
controls=(),
actions=(),
relayed=(),
terminated=(),
identified=(),
free_modalities=(),
bound_modalities=(),
target_emissions=(),
reads=(),
boundary='none',
emissions=(),
config=(),
recognition=(),
)#

Create new instance of Subsystem(states, modalities, controls, actions, relayed, terminated, identified, free_modalities, bound_modalities, target_emissions, reads, boundary, emissions, config, recognition)