matrx.agents.agent_types.patrolling_agent.PatrollingAgentBrain

class PatrollingAgentBrain(waypoints, move_speed=0)

Defines the behavior of an agent.

This class is the place where all the decision logic of an agent is contained. This class together with the matrx.objects.agent_body.AgentBody class represent a full agent.

This agent brain simply selects a random action from the possible actions it can do.

When you wish to create a new agent, this is the class you need to extend. In specific these are the functions you should override:

  • matrx.agents.agent_brain.initialize()

    Called before a world starts running. Can be used to initialize variables that can only be initialized after the brain is connected to its body (which is done by the world).

  • matrx.agents.agent_brain.filter_observations()

    Called before deciding on an action to allow detailed and agent specific filtering of the received world state.

  • matrx.agents.agent_brain.decide_on_action()

    Called to decide on an action.

  • matrx.agents.agent_brain.get_log_data()

    Called by data loggers to obtain data that should be logged from this agent internal reasoning.

Attributes
action_set: [str, …]

List of actions this agent can perform.

agent_id: str

The unique identified of this agent’s body in the world.

agent_name: str

The name of this agent.

agent_properties: dict

A dictionary of this agent’s matrx.objects.agent_body.AgentBody properties. With as keys the property name, and as value the property’s value.

These can be adjusted iff they are said to be adjustable (e.g. inside the attribute keys_of_agent_writable_props).

keys_of_agent_writable_props: [str, …]

List of property names that this agent can adjust.

messages_to_send: [Message, …]

List of messages this agent will send. Use the method matrx.agents.agent_brain.AgentBrain.send_message() to append to this list.

previous_action: str

The name of the previous performed or attempted action.

previous_action_result: ActionResult

The matrx.actions.action.ActionResult of the previously performed or attempted action.

received_messages: [Message, …]

The list of received messages.

rnd_gen: Random

The random generator for this agent.

rnd_seed: int

The random seed with which this agent’s rnd_gen was initialized. This seed is based on the master random seed given of the matrx.grid_world.GridWorld.

Methods

create_context_menu_for_other(self, …)

Generate options for a context menu for a specific object/location that a user NOT controlling this human agent opened.

decide_on_action(self, state)

Contains the decision logic of the agent.

filter_observations(self, state)

Filters the world state before deciding on an action.

get_log_data(self)

Provides a dictionary of data for any Logger

initialize(self)

To initialize an agent’s brain.

is_action_possible(self, action, action_kwargs)

Checks if an action would be possible.

send_message(self, message)

Sends a Message from this agent to others

__init__(self, waypoints, move_speed=0)

Defines the behavior of an agent.

This class is the place where all the decision logic of an agent is contained. This class together with the matrx.objects.agent_body.AgentBody class represent a full agent.

This agent brain simply selects a random action from the possible actions it can do.

When you wish to create a new agent, this is the class you need to extend. In specific these are the functions you should override:

  • matrx.agents.agent_brain.initialize()

    Called before a world starts running. Can be used to initialize variables that can only be initialized after the brain is connected to its body (which is done by the world).

  • matrx.agents.agent_brain.filter_observations()

    Called before deciding on an action to allow detailed and agent specific filtering of the received world state.

  • matrx.agents.agent_brain.decide_on_action()

    Called to decide on an action.

  • matrx.agents.agent_brain.get_log_data()

    Called by data loggers to obtain data that should be logged from this agent internal reasoning.

Attributes
action_set: [str, …]

List of actions this agent can perform.

agent_id: str

The unique identified of this agent’s body in the world.

agent_name: str

The name of this agent.

agent_properties: dict

A dictionary of this agent’s matrx.objects.agent_body.AgentBody properties. With as keys the property name, and as value the property’s value.

These can be adjusted iff they are said to be adjustable (e.g. inside the attribute keys_of_agent_writable_props).

keys_of_agent_writable_props: [str, …]

List of property names that this agent can adjust.

messages_to_send: [Message, …]

List of messages this agent will send. Use the method matrx.agents.agent_brain.AgentBrain.send_message() to append to this list.

previous_action: str

The name of the previous performed or attempted action.

previous_action_result: ActionResult

The matrx.actions.action.ActionResult of the previously performed or attempted action.

received_messages: [Message, …]

The list of received messages.

rnd_gen: Random

The random generator for this agent.

rnd_seed: int

The random seed with which this agent’s rnd_gen was initialized. This seed is based on the master random seed given of the matrx.grid_world.GridWorld.

Methods

__init__(self, waypoints[, move_speed])

Defines the behavior of an agent.

create_context_menu_for_other(self, …)

Generate options for a context menu for a specific object/location that a user NOT controlling this human agent opened.

decide_on_action(self, state)

Contains the decision logic of the agent.

filter_observations(self, state)

Filters the world state before deciding on an action.

get_log_data(self)

Provides a dictionary of data for any Logger

initialize(self)

To initialize an agent’s brain.

is_action_possible(self, action, action_kwargs)

Checks if an action would be possible.

send_message(self, message)

Sends a Message from this agent to others

Attributes

memorize_for_ticks

state