matrx.agents.capabilities.capability.SenseCapability

class SenseCapability(detectable_objects)

Denotes what an agent can see within a certain range.

An instance of this class describes to an agent what it can perceive within what ranges. It is used by a matrx.grid_world.GridWorld instance to construct the agent’s state.

To limit agents to sense objects more granulary then the given object types allow for, you can extend classes with your own classes. For example, one can extend the SquareBlock class into a custom class called MySquareBlock. This allows you to specify these two types separately to an agent for perception.

Examples

An example of a SenseCapability that defines the perception of all agents separate from SquareBlock objects. No other objects are perceived.

>>> from matrx.objects import AgentBody, SquareBlock
>>> SenseCapability({AgentBody: 10, SquareBlock: 25})

An example of a SenseCapability that sets the perception range of all objects.

>>> SenseCapability({None: 25})

An example of a SenseCapability that sets the range of perceiving all other agents to 25 but the perception of all other objects to 10.

>>> from matrx.objects import AgentBody
>>> SenseCapability({AgentBody: 25, None: 10})

Methods

get_capabilities(self)

Returns the sense capabilities.

Denotes what an agent can see within a certain range.

Parameters
detectable_objectsdict

A dictionary with as keys the class you wish to perceive, and as values the distance this object type can be perceived. The None key stands for all otherwise not specified object types.

Methods

get_capabilities(self)

Returns the sense capabilities.

__init__(self, detectable_objects)

Denotes what an agent can see within a certain range.

Parameters
detectable_objectsdict

A dictionary with as keys the class you wish to perceive, and as values the distance this object type can be perceived. The None key stands for all otherwise not specified object types.

Methods

__init__(self, detectable_objects)

Denotes what an agent can see within a certain range.

get_capabilities(self)

Returns the sense capabilities.