class mlpy.environments.Environment(agents=None)[source]

Bases: mlpy.modules.Module

The environment base class.

The environment specifies the setting in which the agent(s) act. The class is responsible to update the agent(s) at each time step of the program loop and keeps track if the agents’ task is complete.


agents : Agent or list[Agent], optional

A list of agents that act in the environment.


mid The module’s unique identifier.


add_agents(agent) Add an agent to the environment.
enter(t) Enter the environment and all agents.
exit() Exit the environment and all agents.
get_agent(mid) Return the agent specified by the id.
is_complete() Checks if the environment has completed.
load(filename) Load the state of the module from file.
reset(t, **kwargs) Resets the environment.
save(filename) Save the current state of the module to file.
update(dt) Update the environment and all agents.