nip.scenario_base.agents.CombinedAgentPart#
- class nip.scenario_base.agents.CombinedAgentPart(hyper_params: HyperParameters, settings: ExperimentSettings, protocol_handler: ProtocolHandler, parts: dict[str, AgentPart])[source]#
Base class for modules which combine agent parts together.
- Parameters:
hyper_params (HyperParameters) – The parameters of the experiment.
settings (ExperimentSettings) – The settings of the experiment.
protocol_handler (ProtocolHandler) – The protocol handler for the experiment.
attributes (Class)
----------------
additional_in_keys (list[NestedKey]) – Input keys required by the module, in addition to the keys required by the agent parts.
excluded_in_keys (list[NestedKey]) – Input keys required by the agent parts, which are not required as inputs to this module (i.e. these keys are populated by this module when called). Agent-level keys should be specified as nested keys, with the first element being “agents”.
additional_out_keys (list[NestedKey]) – Output keys produced by the module, in addition to the keys produced by the agent parts.
excluded_out_keys (list[NestedKey]) – Output keys produced by the agent parts, which are not output by this module. Agent-level keys should be specified as nested keys, with the first element being “agents”.
Methods Summary
__init__
(hyper_params, settings, ...)Restrict an agent's input to its visible message channels.
Attributes
additional_in_keys
additional_out_keys
excluded_in_keys
excluded_out_keys
in_keys
The keys required by the module.
out_keys
The keys produced by the module.
Methods
- __init__(hyper_params: HyperParameters, settings: ExperimentSettings, protocol_handler: ProtocolHandler, parts: dict[str, AgentPart])[source]#
- _restrict_input_to_visible_channels(agent_name: str, input_array: Tensor | ndarray[Any, dtype[_ScalarType_co]], shape_spec: str) Tensor [source]#
Restrict an agent’s input to its visible message channels.
Agents only receive messages from the channels they can see. This function restricts the input to the agent to only the visible message channels.
- Parameters:
- Returns:
restricted_input (Tensor | NDArray) – The input restricted to the visible message channels.