hive.agents.agent module

class hive.agents.agent.Agent(obs_dim, act_dim, id=0)[source]

Bases: ABC, Registrable

Base class for agents. Every implemented agent should be a subclass of this class.

Parameters
  • obs_dim – Dimension of observations that agent will see.

  • act_dim – Number of actions that the agent needs to chose from.

  • id – Identifier for the agent.

property id
abstract act(observation)[source]

Returns an action for the agent to perform based on the observation.

Parameters

observation – Current observation that agent should act on.

Returns

Action for the current timestep.

abstract update(update_info)[source]

Updates the agent.

Parameters

update_info (dict) – Contains information agent needs to update itself.

train()[source]

Changes the agent to training mode.

eval()[source]

Changes the agent to evaluation mode

abstract save(dname)[source]

Saves agent checkpointing information to file for future loading.

Parameters

dname (str) – directory where agent should save all relevant info.

abstract load(dname)[source]

Loads agent information from file.

Parameters

dname (str) – directory where agent checkpoint info is stored.

classmethod type_name()[source]
Returns

“agent”