merge#
- hybrid_aif.composition.merge(subsystems, params, bindings=())[source]#
Merge components into one composite
(System, SystemParams); see the module docstring.subsystemsandparamsare keyed alike; the insertion order ofsubsystemsfixes the composite’s node order: every component’s state factors in turn, then every component’s control nodes in turn (each followed by its action node), hence the action keys’ and policy set’s layout.bindingsare applied in the order given. The composite always carries explicitstate_names/control_names/modality_names/action_names: a component’s generated names are namespaced.Planner fields (
policy_len,planner,gamma,num_iters,decomposition,planning_belief,feedback) are the leaves’ value where every leaf has one andUNSETwhere they differ;mixture_scheduleand a non-Nonemixture_kare shared by one belief carry and must agree. Each leaf’s own areSubsystem.config.A leaf’s
policy_prior,precision,durationsand scoring parameters areSystemParams.parts[<leaf>](present when it holds any); the composite states none of them, andjoint_planner()composes them.epistemicis resolved and unioned (resolved_epistemic());dimsmoves with its state factors, under the namespaced names (a keypose:b1becomesarm.pose:b1).A modality observing an action node keeps it: the node’s index at or above the component’s node count becomes the composite’s,
len(B_deps) + positionamong the control nodes that stay (one a relay orClampremoved, or an action node a driven node lost, raises).Designations keep each component’s preferences under namespaced keys;
C_depsnamespaces its keys and parents asH_depsdoes.System.termsselectors carry under the component prefix, on their variable segment (namespaced_term():uncertainty:xbecomesuncertainty:arm.x); the union is the composite’s, less a term a leaf’s scoring owns (that leaf’sconfigcarries it).recognitionnamespaces both halves, the parent addresses included (Recognition("stoch", ("deter", "recognition:embed"))→Recognition("mc.stoch", ("mc.deter", "recognition:mc.embed"));obs:andexternal:operands keep their prefix and are renamed on their name).external_inputscarries under the component prefix, so two components’ inputs of one name stay distinct.A continuous control node’s box (
params.control) and an action node’s kernel (params.actuator) move with their nodes, under the namespaced names; a driven node refuses a kernel on its own action node.readings(a table’s pooled reading,System.readingsandparams.readings) carries under the component’s prefix; a node a relay orClampremoved raises. A view carries the entries of its own tables and raises where the node is another component’s.observes(a slot’s variable: a modality that observes an emission or an action node of its component, which is how a component reads its own belief or its previous action) carries under the component’s prefix, slot and variable alike; aLinkwith arealiseadds an emission to the source’s component and a modality’s entry, whose variable is in another component. A component whose every binding across its boundary is such a belief read or a link from an action node into a control node is nested (nested()). An action node an entry names must stay one its component chooses. Design: nesting-and-coupling.md N2, N3.emissions(a component’s outputs drawn from its state factors, with their kernels inparams.emissionor declared static) carry under the component’s prefix; a parent a relay or aClampremoved raises.A target on a node a binding removed raises, naming what the node became.
The composite is validated (
System._validate) before it is returned.