GenerativeEnv#
- class hybrid_aif.envs.GenerativeEnv[source]#
Bases:
EnvA positional process
innerwith name-keyed faces;namesis static.paramsgiven asGenerativeEnvParamsmust key their containers by name (asSystem.as_env()returns them; a tuple container raises, namingsystem.from_positional("params", ...)); any other params (an outside environment’s own) pass toinneruntouched.- names: FaceNames#
The System’s names (static), used to key the containers.
- factor_actions: bool = False#
Whether
innertakes the action one level per state factor (an outside, pymdp-style environment) rather than one per control node (the System’s own process).
- classmethod wrap(env, system, params=None)[source]#
An outside positional environment, keyed by
system’s names.envspeaks the positional convention (hybrid_aif.envs.base): observations and states as tuples, the action as one level per state factor (or the flat continuous vector). Its state factor and modality counts are checked against the System’s; their order must match the System’s node order too, which cannot be checked.params(the System’s, keyed) are needed when a control node is continuous: its box lives inparams.control. Wrapping an already keyed env raises.
- reset(key, params, state=None)[source]#
Sample (or, with
state, set) an initial state and an observation of it.
- step(key, state, action, params, states=None)[source]#
Sample the next state under
actionand an observation of it (the intended action, realised throughparams.actuator; seestep_actuated()).statesnames the state factors to step; the others keep their values (seestep_actuated()).
- step_actuated(key, state, action, params, states=None)[source]#
step(), also returning the realised action, keyed by action node.actionis the intended action. An action node with a kernel inparams.actuatoris realised as a draw from its column at the intended level, with a key folded fromkey; any other is realised as given (andkeyis used asstep()always uses it). The world moves on the realised action.statesnames the state factors to step, by state factor name; the others keep their values and the observation is of the state so made. It is the System’s own process that steps in parts (the driver’s sequential and async orders step each component’s state factors at that component’s turn); an outside environment wrapped bywrap()has no parts to name, and is refused.
- __init__(inner, names, factor_actions=False)#