swarmsim.agent.control.MultibitBinaryController#

Multibit Binary Controller class.

class swarmsim.agent.control.MultibitBinaryController.MultibitBinaryController(outputs: Sequence[tuple[float, ...] | ndarray] | Mapping[int | str, tuple[float, ...] | ndarray], default_output: tuple[float, ...] | ndarray | None = None, agent=None, parent=None, sensor_ids=None, **kwargs)[source]#

Controller that maps multiple binary sensors to constant control inputs.

The controller is specified by a dictionary of sensor states to output values.

Parameters:
  • outputs (tuple[tuple[float, ...] | numpy.ndarray, ...] | dict[int | str, tuple[float, ...] | numpy.ndarray]) – The output values to return for each possible sensor state. If it is a dict, then each key should be a combined sensor state bitstring. If it is a tuple, then the index is the combined sensor state bitstring. Each output value should be a 1D array or a scalar.

  • default_output (tuple[float, ...] | numpy.ndarray | None, optional) – The output value to return if the sensor state is not in the outputs dictionary.

  • sensor_ids (list[int] | None, optional) – The sensor indices to use for the sensors.

  • agent (Agent, optional)

  • parent (Agent, optional)

Attributes:
outputs

Methods

as_config_dict

draw

get_actions

get_sensor_bitstring

set_agent

set_parent

get_actions(agent)[source]#
get_sensor_bitstring(agent)[source]#
property outputs[source]#
swarmsim.agent.control.MultibitBinaryController.ConstantOutputValues = tuple[float, ...] | numpy.ndarray#

Represent a union type

E.g. for int | str

Classes

MultibitBinaryController(outputs[, ...])

Controller that maps multiple binary sensors to constant control inputs.